diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/BUILD b/src/main/java/com/google/devtools/build/lib/rules/java/BUILD index 8fa8c30e2ec3c2..d7c291e6e18054 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/java/BUILD +++ b/src/main/java/com/google/devtools/build/lib/rules/java/BUILD @@ -61,11 +61,13 @@ java_library( "//src/main/java/com/google/devtools/build/lib/analysis:config/build_options", "//src/main/java/com/google/devtools/build/lib/analysis:config/compilation_mode", "//src/main/java/com/google/devtools/build/lib/analysis:config/core_option_converters", + "//src/main/java/com/google/devtools/build/lib/analysis:config/execution_transition_factory", "//src/main/java/com/google/devtools/build/lib/analysis:config/fragment", "//src/main/java/com/google/devtools/build/lib/analysis:config/fragment_options", "//src/main/java/com/google/devtools/build/lib/analysis:config/fragment_provider", "//src/main/java/com/google/devtools/build/lib/analysis:config/host_transition", "//src/main/java/com/google/devtools/build/lib/analysis:config/invalid_configuration_exception", + "//src/main/java/com/google/devtools/build/lib/analysis:config/transitions/no_transition", "//src/main/java/com/google/devtools/build/lib/analysis:configured_target", "//src/main/java/com/google/devtools/build/lib/analysis:file_provider", "//src/main/java/com/google/devtools/build/lib/analysis:package_specification_provider", diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/JavaToolchainRule.java b/src/main/java/com/google/devtools/build/lib/rules/java/JavaToolchainRule.java index f171a03ea06e11..fec02fe16e5bbe 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/java/JavaToolchainRule.java +++ b/src/main/java/com/google/devtools/build/lib/rules/java/JavaToolchainRule.java @@ -28,7 +28,8 @@ import com.google.devtools.build.lib.analysis.BaseRuleClasses; import com.google.devtools.build.lib.analysis.RuleDefinition; import com.google.devtools.build.lib.analysis.RuleDefinitionEnvironment; -import com.google.devtools.build.lib.analysis.config.HostTransition; +import com.google.devtools.build.lib.analysis.config.ExecutionTransitionFactory; +import com.google.devtools.build.lib.analysis.config.transitions.NoTransition; import com.google.devtools.build.lib.cmdline.Label; import com.google.devtools.build.lib.packages.RuleClass; import com.google.devtools.build.lib.util.FileTypeSet; @@ -72,12 +73,16 @@ The Java target version (e.g., '6' or '7'). It specifies for which Java runtime .add( attr("bootclasspath", LABEL_LIST) .value(ImmutableList.of()) - .allowedFileTypes(FileTypeSet.ANY_FILE)) + .allowedFileTypes(FileTypeSet.ANY_FILE) + // This should be in the target configuration. + .cfg(NoTransition.createFactory())) .add( attr("extclasspath", LABEL_LIST) .undocumented("internal") .value(ImmutableList.of()) - .allowedFileTypes(FileTypeSet.ANY_FILE)) + .allowedFileTypes(FileTypeSet.ANY_FILE) + // This should be in the target configuration. + .cfg(NoTransition.createFactory())) /* The list of warning to add or removes from default list. Precedes it with a dash to removes it. Please see the Javac documentation on the -Xlint options for more information. @@ -118,7 +123,8 @@ The Java target version (e.g., '6' or '7'). It specifies for which Java runtime */ .add( attr("javac", LABEL_LIST) - .cfg(HostTransition.createFactory()) + // This needs to be in the execution configuration. + .cfg(ExecutionTransitionFactory.create()) .singleArtifact() .allowedFileTypes(FileTypeSet.ANY_FILE)) /* @@ -126,7 +132,8 @@ The Java target version (e.g., '6' or '7'). It specifies for which Java runtime */ .add( attr("tools", LABEL_LIST) - .cfg(HostTransition.createFactory()) + // This needs to be in the execution configuration. + .cfg(ExecutionTransitionFactory.create()) .allowedFileTypes(FileTypeSet.ANY_FILE)) /* Label of the JavaBuilder deploy jar. @@ -134,7 +141,8 @@ The Java target version (e.g., '6' or '7'). It specifies for which Java runtime .add( attr("javabuilder", LABEL_LIST) .mandatory() - .cfg(HostTransition.createFactory()) + // This needs to be in the execution configuration. + .cfg(ExecutionTransitionFactory.create()) .allowedFileTypes(FileTypeSet.ANY_FILE) .exec()) /* @@ -143,8 +151,9 @@ The Java target version (e.g., '6' or '7'). It specifies for which Java runtime .add( attr("singlejar", LABEL_LIST) .mandatory() - .cfg(HostTransition.createFactory()) .singleArtifact() + // This needs to be in the execution configuration. + .cfg(ExecutionTransitionFactory.create()) .allowedFileTypes(FileTypeSet.ANY_FILE) .exec()) /* @@ -154,7 +163,8 @@ The Java target version (e.g., '6' or '7'). It specifies for which Java runtime attr("genclass", LABEL_LIST) .mandatory() .singleArtifact() - .cfg(HostTransition.createFactory()) + // This needs to be in the execution configuration. + .cfg(ExecutionTransitionFactory.create()) .allowedFileTypes(FileTypeSet.ANY_FILE) .exec()) /* @@ -162,8 +172,9 @@ The Java target version (e.g., '6' or '7'). It specifies for which Java runtime */ .add( attr("resourcejar", LABEL_LIST) - .cfg(HostTransition.createFactory()) .singleArtifact() + // This needs to be in the execution configuration. + .cfg(ExecutionTransitionFactory.create()) .allowedFileTypes(FileTypeSet.ANY_FILE) .exec()) /* @@ -172,8 +183,9 @@ The Java target version (e.g., '6' or '7'). It specifies for which Java runtime */ .add( attr("timezone_data", LABEL) - .cfg(HostTransition.createFactory()) .singleArtifact() + // This needs to be in the execution configuration. + .cfg(ExecutionTransitionFactory.create()) .allowedFileTypes(FileTypeSet.ANY_FILE) .exec()) /* @@ -182,7 +194,8 @@ The Java target version (e.g., '6' or '7'). It specifies for which Java runtime .add( attr("ijar", LABEL_LIST) .mandatory() - .cfg(HostTransition.createFactory()) + // This needs to be in the execution configuration. + .cfg(ExecutionTransitionFactory.create()) .allowedFileTypes(FileTypeSet.ANY_FILE) .exec()) /* @@ -190,8 +203,9 @@ The Java target version (e.g., '6' or '7'). It specifies for which Java runtime */ .add( attr("header_compiler", LABEL_LIST) - .cfg(HostTransition.createFactory()) .singleArtifact() + // This needs to be in the execution configuration. + .cfg(ExecutionTransitionFactory.create()) .allowedFileTypes(FileTypeSet.ANY_FILE) .exec()) /* @@ -202,7 +216,8 @@ The Java target version (e.g., '6' or '7'). It specifies for which Java runtime */ .add( attr("header_compiler_direct", LABEL_LIST) - .cfg(HostTransition.createFactory()) + // This needs to be in the execution configuration. + .cfg(ExecutionTransitionFactory.create()) .allowedFileTypes(FileTypeSet.ANY_FILE) .exec()) .add( @@ -226,8 +241,9 @@ The Java target version (e.g., '6' or '7'). It specifies for which Java runtime */ .add( attr("oneversion", LABEL) - .cfg(HostTransition.createFactory()) .singleArtifact() + // This needs to be in the execution configuration. + .cfg(ExecutionTransitionFactory.create()) .allowedFileTypes(FileTypeSet.ANY_FILE) .exec()) /* @@ -235,8 +251,9 @@ The Java target version (e.g., '6' or '7'). It specifies for which Java runtime */ .add( attr("oneversion_whitelist", LABEL) - .cfg(HostTransition.createFactory()) .singleArtifact() + // This needs to be in the execution configuration. + .cfg(ExecutionTransitionFactory.create()) .allowedFileTypes(FileTypeSet.ANY_FILE) .exec()) /* @@ -253,15 +270,17 @@ The Java target version (e.g., '6' or '7'). It specifies for which Java runtime */ .add( attr("package_configuration", LABEL_LIST) - .cfg(HostTransition.createFactory()) .allowedFileTypes() + // This needs to be in the execution configuration. + .cfg(ExecutionTransitionFactory.create()) .mandatoryNativeProviders(ImmutableList.of(JavaPackageConfigurationProvider.class))) /* Label of the JacocoCoverageRunner deploy jar. */ .add( attr("jacocorunner", LABEL) - .cfg(HostTransition.createFactory()) + // This needs to be in the execution configuration. + .cfg(ExecutionTransitionFactory.create()) .allowedFileTypes(FileTypeSet.ANY_FILE) .exec()) .build();