Esempio n. 1
0
class _JvmCompileWorkflowType(enum(['zinc-only', 'rsc-then-zinc'])):
    """Target classifications used to correctly schedule Zinc and Rsc jobs.

  There are some limitations we have to work around before we can compile everything through Rsc
  and followed by Zinc.
  - rsc is not able to outline all scala code just yet (this is also being addressed through
    automated rewrites).
  - javac is unable to consume rsc's jars just yet.
  - rsc is not able to outline all java code just yet (this is likely to *not* require rewrites,
    just some more work on rsc).

  As we work on improving our Rsc integration, we'll need to create more workflows to more closely
  map the supported features of Rsc. This enum class allows us to do that.

    - zinc-only: compiles targets just with Zinc and uses the Zinc products of their dependencies.
    - rsc-then-zinc: compiles targets with Rsc to create "header" jars, then runs Zinc against the
      Rsc products of their dependencies. The Rsc compile uses the Rsc products of Rsc compatible
      targets and the Zinc products of zinc-only targets.
  """
    @classmethod
    def classify_target(cls, target):
        # NB: Java targets, Scala+Java targets, and some test targets are not currently supported for
        # compile with Rsc.
        # TODO: Rsc's produced header jars don't yet work with javac. Once this is resolved, we may add
        #       additional workflow types.
        if target.has_sources('.java') or \
          isinstance(target, JUnitTests) or \
          (isinstance(target, ScalaLibrary) and tuple(target.java_sources)):
            target_type = _JvmCompileWorkflowType.zinc_only
        elif target.has_sources('.scala'):
            target_type = _JvmCompileWorkflowType.rsc_then_zinc
        else:
            target_type = None
        return target_type
Esempio n. 2
0
class GlobExpansionConjunction(enum('conjunction',
                                    ['any_match', 'all_match'])):

    # NB: The `default_value` is automatically the first element of the value list, but can be
    # overridden or made more explicit in the body of the class. We want to be explicit here about
    # which behavior we have when merging globs, as that can affect performance.
    default_value = 'any_match'
Esempio n. 3
0
class GlobMatchErrorBehavior(enum('failure_behavior', ['ignore', 'warn', 'error'])):
  """Describe the action to perform when matching globs in BUILD files to source files.

  NB: this object is interpreted from within Snapshot::lift_path_globs() -- that method will need to
  be aware of any changes to this object's definition.
  """

  default_option_value = 'warn'
Esempio n. 4
0
class DetailLevel(enum(['none', 'summary', 'nonmatching', 'all'])):
    """How much detail about validation to emit to the console.

  none: Emit nothing.
  summary: Emit a summary only.
  nonmatching: Emit details for source files that failed to match at least one required pattern.
  all: Emit details for all source files.
  """
    pass
Esempio n. 5
0
class Platform(enum(all_normalized_os_names())):

    # TODO: try to turn all of these accesses into v2 dependency injections!
    @memoized_classproperty
    def current(cls):
        return cls(get_normalized_os_name())

    @memoized_property
    def runtime_lib_path_env_var(self):
        return self.resolve_for_enum_variant({
            'darwin': 'DYLD_LIBRARY_PATH',
            'linux': 'LD_LIBRARY_PATH',
        })
Esempio n. 6
0
class GlobExpansionConjunction(enum(['any_match', 'all_match'])):
    """Describe whether to require that only some or all glob strings match in a target's sources.
Esempio n. 7
0
class Status(enum(['SUCCESS', 'FAILURE'])):
    pass
Esempio n. 8
0
 class HasAttrs(enum(['a', 'b'])): pass
 self.assertEqual(HasAttrs.a, HasAttrs('a'))
Esempio n. 9
0
class _CompileWorkflowChoice(enum(['zinc-only', 'guess'])):
    """Enum covering the values for the default workflow option.
Esempio n. 10
0
class SomeEnum(enum([1, 2])): pass


class DatatypeTest(TestBase):
Esempio n. 11
0
 class ExecutionStrategy(enum([NAILGUN, SUBPROCESS, HERMETIC])):
     pass
Esempio n. 12
0
 class StrEnum(enum(['a'])): pass
 enum_instance = StrEnum('a')
Esempio n. 13
0
class ToolchainVariant(enum(['gnu', 'llvm'])): pass


class NativeBuildStep(CompilerOptionSetsMixin, MirroredTargetOptionMixin, Subsystem):
Esempio n. 14
0
 class StrEnum(enum(['a'])):
     pass
Esempio n. 15
0
class PlatformConstraint(enum(list(all_normalized_os_names()) + ['none'])):
    @memoized_classproperty
    def local_platform(cls):
        return cls(Platform.current.value)
Esempio n. 16
0
 class HasAttrs(enum(['a', 'b'])):
     pass
Esempio n. 17
0
 class DuplicateAllowedValues(enum([1, 2, 3, 1])):
     pass
Esempio n. 18
0
class SomeEnum(enum([1, 2])):
    pass
Esempio n. 19
0
      class DuplicateAllowedValues(enum([1, 2, 3, 1])): pass

  def test_enum_instance_creation(self):
Esempio n. 20
0
class GlobMatchErrorBehavior(enum(['ignore', 'warn', 'error'])):
    """Describe the action to perform when matching globs in BUILD files to source files.
Esempio n. 21
0
 class OutOfOrderEnum(enum([2, 1, 3])):
     pass
Esempio n. 22
0
 class OutOfOrderEnum(enum([2, 1, 3])): pass
 two_out_of_order_instance = OutOfOrderEnum(2)
Esempio n. 23
0
class ToolchainVariant(enum('descriptor', ['gnu', 'llvm'])):
    @property
    def is_gnu(self):
        return self.descriptor == 'gnu'
 class ExpectedPlatformType(enum(['any', 'current'])):
     """Whether to check that the produced wheel has the 'any' platform, or the current one."""
Esempio n. 25
0
class Platform(enum(all_normalized_os_names())):

  # TODO: try to turn all of these accesses into v2 dependency injections!
  @memoized_classproperty
  def current(cls):
    return cls(get_normalized_os_name())
Esempio n. 26
0
class ToolchainVariant(enum(['gnu', 'llvm'])):
    pass
Esempio n. 27
0
 class JvmCompileWorkflowType(
         enum(['zinc-only', 'zinc-java', 'rsc-and-zinc'])):
     """Target classifications used to correctly schedule Zinc and Rsc jobs.
Esempio n. 28
0
class SomeEnum(enum('x', [1, 2])):
    pass