Exemplo n.º 1
0
    def execute_export(self, *specs, **options_overrides):
        options = {
            ScalaPlatform.options_scope: {"version": "custom"},
            JvmResolveSubsystem.options_scope: {"resolver": "coursier"},
            JvmPlatform.options_scope: {
                "default_platform": "java8",
                "platforms": {"java8": {"source": "1.8", "target": "1.8"}},
            },
        }
        options.update(options_overrides)

        # We are only initializing ZincCompile to access the instance method `calculate_jvm_modulizable_targets`
        ZincCompile.options_scope = "compile.rsc"
        BootstrapJvmTools.options_scope = "bootstrap-jvm-tools"
        context = self.context(
            options=options,
            target_roots=[self.target(spec) for spec in specs],
            for_subsystems=[JvmPlatform],
            for_task_types=[BootstrapJvmTools, ZincCompile],
        )

        context.products.safe_create_data("zinc_args", init_func=lambda: MagicMock())
        self.prep_before_export(context)

        context.products.require_data("jvm_modulizable_targets")
        # This simulates ZincCompile creates the product.
        ZincCompile(context, self.pants_workdir).calculate_jvm_modulizable_targets()

        bootstrap_task = BootstrapJvmTools(context, self.pants_workdir)
        bootstrap_task.execute()
        task = self.create_task(context)
        return list(task.console_output(list(task.context.targets())))
Exemplo n.º 2
0
    def execute_export(self, *specs, **options_overrides):
        options = {
            ScalaPlatform.options_scope: {"version": "custom"},
            JvmResolveSubsystem.options_scope: {"resolver": "coursier"},
            JvmPlatform.options_scope: {
                "default_platform": "java8",
                "platforms": {"java8": {"source": "1.8", "target": "1.8"}},
            },
        }
        options.update(options_overrides)

        BootstrapJvmTools.options_scope = "bootstrap-jvm-tools"
        context = self.context(
            options=options,
            target_roots=[self.target(spec) for spec in specs],
            for_subsystems=[JvmPlatform],
            for_task_types=[BootstrapJvmTools],
        )
        context.products.safe_create_data(
            "compile_classpath", init_func=ClasspathProducts.init_func(self.pants_workdir)
        )
        bootstrap_task = BootstrapJvmTools(context, self.pants_workdir)
        bootstrap_task.execute()
        task = self.create_task(context)
        return list(
            task.console_output(
                list(task.context.targets()), context.products.get_data("compile_classpath")
            )
        )
Exemplo n.º 3
0
  def execute_export(self, *specs, **options_overrides):
    options = {
      ScalaPlatform.options_scope: {
        'version': 'custom'
      },
      JvmResolveSubsystem.options_scope: {
        'resolver': 'ivy'
      },
      JvmPlatform.options_scope: {
        'default_platform': 'java8',
        'platforms': {
          'java8': {'source': '1.8', 'target': '1.8'}
        }
      },
    }
    options.update(options_overrides)

    BootstrapJvmTools.options_scope = 'bootstrap-jvm-tools'
    context = self.context(options=options, target_roots=[self.target(spec) for spec in specs],
                           for_subsystems=[JvmPlatform],
                           for_task_types=[BootstrapJvmTools])
    context.products.safe_create_data('compile_classpath',
                                      init_func=ClasspathProducts.init_func(self.pants_workdir))
    bootstrap_task = BootstrapJvmTools(context, self.pants_workdir)
    bootstrap_task.execute()
    task = self.create_task(context)
    return list(task.console_output(list(task.context.targets()),
                                    context.products.get_data('compile_classpath')))
Exemplo n.º 4
0
  def prepare_execute(self, context, workdir, task_type):
    """Prepares a jvm tool using task for execution, ensuring any required jvm tools are
    bootstrapped.

    NB: Other task pre-requisites will not be ensured and tests must instead setup their own product
    requirements if any.

    :returns: The prepared Task
    """
    # TODO(John Sirois): This is emulating Engine behavior - construct reverse order, then execute;
    # instead it should probably just be using an Engine.
    task = task_type(context, workdir)
    BootstrapJvmTools(context, workdir).execute()
    return task