diff options
author | cushon <cushon@google.com> | 2018-07-05 11:54:59 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-07-05 11:56:37 -0700 |
commit | 6e0466f2c9d76d1ad9c1ee8ef7b3013e002765f1 (patch) | |
tree | deb76183d2d00f137f341b57e69f5ca199ac1e17 /src/main/java/com/google/devtools/build/lib/rules/java | |
parent | 55d0c1c649d3117f59e3d5d7b79de12d6b090381 (diff) |
Remove support for java_runtime_suite
RELNOTES: Remove support for java_runtime_suite; use alias() together with select() instead.
PiperOrigin-RevId: 203393253
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/java')
3 files changed, 17 insertions, 153 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/JavaOptions.java b/src/main/java/com/google/devtools/build/lib/rules/java/JavaOptions.java index b794bcbc51..9245257c01 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/java/JavaOptions.java +++ b/src/main/java/com/google/devtools/build/lib/rules/java/JavaOptions.java @@ -74,16 +74,15 @@ public class JavaOptions extends FragmentOptions { } @Option( - name = "javabase", - defaultValue = "@bazel_tools//tools/jdk:jdk", - converter = LabelConverter.class, - documentationCategory = OptionDocumentationCategory.UNCATEGORIZED, - effectTags = {OptionEffectTag.UNKNOWN}, - help = - "JAVABASE used for the JDK invoked by Blaze. This is the " - + "java_runtime_suite which will be used to execute " - + "external Java commands." - ) + name = "javabase", + defaultValue = "@bazel_tools//tools/jdk:jdk", + converter = LabelConverter.class, + documentationCategory = OptionDocumentationCategory.UNCATEGORIZED, + effectTags = {OptionEffectTag.UNKNOWN}, + help = + "JAVABASE used for the JDK invoked by Blaze. This is the " + + "java_runtime which will be used to execute " + + "external Java commands.") public Label javaBase; @Option( @@ -107,15 +106,14 @@ public class JavaOptions extends FragmentOptions { public Label hostJavaToolchain; @Option( - name = "host_javabase", - defaultValue = "@bazel_tools//tools/jdk:host_jdk", - converter = LabelConverter.class, - documentationCategory = OptionDocumentationCategory.UNCATEGORIZED, - effectTags = {OptionEffectTag.UNKNOWN}, - help = - "JAVABASE used for the host JDK. This is the java_runtime_suite which is used to execute " - + "tools during a build." - ) + name = "host_javabase", + defaultValue = "@bazel_tools//tools/jdk:host_jdk", + converter = LabelConverter.class, + documentationCategory = OptionDocumentationCategory.UNCATEGORIZED, + effectTags = {OptionEffectTag.UNKNOWN}, + help = + "JAVABASE used for the host JDK. This is the java_runtime which is used to execute " + + "tools during a build.") public Label hostJavaBase; @Option( diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/JavaRuntimeSuite.java b/src/main/java/com/google/devtools/build/lib/rules/java/JavaRuntimeSuite.java deleted file mode 100644 index f1c895f473..0000000000 --- a/src/main/java/com/google/devtools/build/lib/rules/java/JavaRuntimeSuite.java +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright 2017 The Bazel Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package com.google.devtools.build.lib.rules.java; - -import com.google.devtools.build.lib.actions.MutableActionGraph.ActionConflictException; -import com.google.devtools.build.lib.analysis.ConfiguredTarget; -import com.google.devtools.build.lib.analysis.FileProvider; -import com.google.devtools.build.lib.analysis.RuleConfiguredTargetBuilder; -import com.google.devtools.build.lib.analysis.RuleConfiguredTargetFactory; -import com.google.devtools.build.lib.analysis.RuleContext; -import com.google.devtools.build.lib.analysis.RunfilesProvider; -import com.google.devtools.build.lib.analysis.TemplateVariableInfo; -import com.google.devtools.build.lib.analysis.TransitiveInfoCollection; -import com.google.devtools.build.lib.analysis.configuredtargets.RuleConfiguredTarget.Mode; - -/** Implementation for the {@code java_runtime_suite} rule. */ -public class JavaRuntimeSuite implements RuleConfiguredTargetFactory { - @Override - public ConfiguredTarget create(RuleContext ruleContext) - throws InterruptedException, RuleErrorException, ActionConflictException { - TransitiveInfoCollection runtime = - ruleContext.getPrerequisiteMap("runtimes").get(ruleContext.getConfiguration().getCpu()); - if (runtime == null) { - runtime = ruleContext.getPrerequisite("default", Mode.TARGET); - } - - if (runtime == null) { - ruleContext.throwWithRuleError( - "could not resolve runtime for cpu " + ruleContext.getConfiguration().getCpu()); - } - - JavaRuntimeInfo javaRuntimeInfo = JavaRuntimeInfo.from(runtime, ruleContext); - - TemplateVariableInfo templateVariableInfo = - runtime.get(TemplateVariableInfo.PROVIDER); - - return new RuleConfiguredTargetBuilder(ruleContext) - .addNativeDeclaredProvider(javaRuntimeInfo) - .addNativeDeclaredProvider(new JavaRuntimeToolchainInfo(javaRuntimeInfo)) - .addProvider(RunfilesProvider.class, runtime.getProvider(RunfilesProvider.class)) - .addNativeDeclaredProvider(templateVariableInfo) - .setFilesToBuild(runtime.getProvider(FileProvider.class).getFilesToBuild()) - .build(); - } -} diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/JavaRuntimeSuiteRule.java b/src/main/java/com/google/devtools/build/lib/rules/java/JavaRuntimeSuiteRule.java deleted file mode 100644 index 1b7c437771..0000000000 --- a/src/main/java/com/google/devtools/build/lib/rules/java/JavaRuntimeSuiteRule.java +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2017 The Bazel Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package com.google.devtools.build.lib.rules.java; - -import static com.google.devtools.build.lib.packages.Attribute.attr; -import static com.google.devtools.build.lib.packages.BuildType.LICENSE; - -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.packages.BuildType; -import com.google.devtools.build.lib.packages.RuleClass; -import com.google.devtools.build.lib.util.FileTypeSet; - -/** Rule definition for {@code java_runtime_suite} */ -public final class JavaRuntimeSuiteRule implements RuleDefinition { - @Override - public RuleClass build(RuleClass.Builder builder, RuleDefinitionEnvironment env) { - return builder - /* <!-- #BLAZE_RULE(java_runtime_suite).ATTRIBUTE(runtimes) --> - A map from each supported architecture to the corresponding <code>java_runtime</code>. - <!-- #END_BLAZE_RULE.ATTRIBUTE --> */ - .add(attr("runtimes", BuildType.LABEL_DICT_UNARY).allowedFileTypes(FileTypeSet.NO_FILE)) - /* <!-- #BLAZE_RULE(java_runtime_suite).ATTRIBUTE(default) --> - The default <code>java_runtime</code>, used if - <a href="${link java_runtime_suite.runtimes}"><code>runtimes</code></a> - does not contain an entry for the configured architecture. - <!-- #END_BLAZE_RULE.ATTRIBUTE --> */ - .add( - attr("default", BuildType.LABEL) - .mandatoryProviders(JavaRuntimeInfo.PROVIDER.id()) - .allowedFileTypes(FileTypeSet.NO_FILE)) - .add(attr("output_licenses", LICENSE)) - .build(); - } - - @Override - public Metadata getMetadata() { - return RuleDefinition.Metadata.builder() - .name("java_runtime_suite") - .ancestors(BaseRuleClasses.BaseRule.class) - .factoryClass(JavaRuntimeSuite.class) - .build(); - } -} -/*<!-- #BLAZE_RULE (NAME = java_runtime_suite, TYPE = OTHER, FAMILY = Java) --> - -<p> -Specifies the configuration for the Java runtimes for each architecture. -</p> - -<h4 id="java_runtime_suite">Example:</h4> - -<pre class="code"> -java_runtime_suite( - name = "jdk9", - runtimes = { - "k8": ":jdk9-k8", - "ppc": ":jdk9-ppc", - "arm": ":jdk9-arm", - }, -) -</pre> - -<!-- #END_BLAZE_RULE -->*/ |