示例#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())))