Permalink
Browse files

Remove support for java_runtime_suite

RELNOTES: Remove support for java_runtime_suite; use alias() together with select() instead.
PiperOrigin-RevId: 203393253
  • Loading branch information...
cushon authored and Copybara-Service committed Jul 5, 2018
1 parent 55d0c1c commit 6e0466f2c9d76d1ad9c1ee8ef7b3013e002765f1
@@ -929,8 +929,6 @@ java_library(
"rules/java/JavaRuntimeAliasRule.java",
"rules/java/JavaRuntimeClasspathProvider.java",
"rules/java/JavaRuntimeRule.java",
"rules/java/JavaRuntimeSuite.java",
"rules/java/JavaRuntimeSuiteRule.java",
"rules/java/JavaSkylarkCommon.java",
"rules/java/JavaSourceInfoProvider.java",
"rules/java/JavaToolchain.java",
@@ -37,7 +37,6 @@
import com.google.devtools.build.lib.rules.java.JavaRuleClasses.IjarBaseRule;
import com.google.devtools.build.lib.rules.java.JavaRuntimeAliasRule;
import com.google.devtools.build.lib.rules.java.JavaRuntimeRule;
import com.google.devtools.build.lib.rules.java.JavaRuntimeSuiteRule;
import com.google.devtools.build.lib.rules.java.JavaSkylarkCommon;
import com.google.devtools.build.lib.rules.java.JavaToolchainAliasRule;
import com.google.devtools.build.lib.rules.java.JavaToolchainRule;
@@ -78,7 +77,6 @@ public void init(ConfiguredRuleClassProvider.Builder builder) {
builder.addRuleDefinition(JavaToolchainRule.create(BazelJavaToolchain.class));
builder.addRuleDefinition(new JavaPackageConfigurationRule());
builder.addRuleDefinition(new JavaRuntimeRule());
builder.addRuleDefinition(new JavaRuntimeSuiteRule());
builder.addRuleDefinition(new JavaRuntimeAliasRule());
builder.addRuleDefinition(new JavaHostRuntimeAliasRule());
builder.addRuleDefinition(new JavaToolchainAliasRule());
@@ -74,16 +74,15 @@ public ImportDepsCheckingLevelConverter() {
}
@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 ImportDepsCheckingLevelConverter() {
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(

This file was deleted.

Oops, something went wrong.

This file was deleted.

Oops, something went wrong.
@@ -141,14 +141,8 @@ filegroup(
]),
)
java_runtime_suite(
name = "jdk",
runtimes = {},
default = ":jdk-default",
)
java_runtime(
name = "jdk-default",
name = "jdk",
srcs = [
":jdk-bin",
":jdk-include",
@@ -92,13 +92,12 @@ public void setupMockClient(MockToolsConfig config) throws IOException {
" genclass = ['GenClass_deploy.jar'],",
" ijar = ['ijar'],",
")",
"java_runtime(name = 'jdk-default', srcs = [])",
"java_runtime(name = 'jdk', srcs = [])",
"java_runtime(name = 'host_jdk', srcs = [])",
"java_runtime_alias(name = 'current_java_runtime')",
// This isn't actually the host runtime, but will do. This way, we don't need to pull in the
// Skylark implementation of the java_host_runtime_alias rule.
"java_runtime_alias(name = 'current_host_java_runtime')",
"java_runtime_suite(name = 'jdk', runtimes = {}, default = ':jdk-default')",
"java_runtime_suite(name = 'host_jdk', runtimes = {}, default = ':jdk-default')",
"filegroup(name='langtools', srcs=['jdk/lib/tools.jar'])",
"filegroup(name='bootclasspath', srcs=['jdk/jre/lib/rt.jar'])",
"filegroup(name='extdir', srcs=glob(['jdk/jre/lib/ext/*']))",
@@ -111,7 +110,6 @@ public void setupMockClient(MockToolsConfig config) throws IOException {
" 'turbine_deploy.jar','ExperimentalTestRunner_deploy.jar'])",
"sh_binary(name = 'proguard_whitelister', srcs = ['empty.sh'])");
ImmutableList<String> androidBuildContents = createAndroidBuildContents();
config.create(
"/bazel_tools_workspace/tools/android/BUILD",
@@ -53,7 +53,6 @@ public void testJavaRuntimeProviderJavaExecutableAbsolute() throws Exception {
scratch.file("a/BUILD",
"load(':rule.bzl', 'jrule')",
"java_runtime(name='jvm', srcs=[], java_home='/foo/bar/')",
"java_runtime_suite(name='suite', default=':jvm')",
"java_runtime_alias(name='alias')",
"jrule(name='r')");
@@ -67,7 +66,7 @@ public void testJavaRuntimeProviderJavaExecutableAbsolute() throws Exception {
")",
"jrule = rule(_impl, attrs = { '_java_runtime': attr.label(default=Label('//a:alias'))})");
useConfiguration("--javabase=//a:suite");
useConfiguration("--javabase=//a:jvm");
ConfiguredTarget ct = getConfiguredTarget("//a:r");
@SuppressWarnings("unchecked") PathFragment javaExecutable =
(PathFragment) ct.get("java_executable");
@@ -82,7 +81,6 @@ public void testJavaRuntimeProviderJavaExecutableHermetic() throws Exception {
scratch.file("a/BUILD",
"load(':rule.bzl', 'jrule')",
"java_runtime(name='jvm', srcs=[], java_home='foo/bar')",
"java_runtime_suite(name='suite', default=':jvm')",
"java_runtime_alias(name='alias')",
"jrule(name='r')");
@@ -96,7 +94,7 @@ public void testJavaRuntimeProviderJavaExecutableHermetic() throws Exception {
")",
"jrule = rule(_impl, attrs = { '_java_runtime': attr.label(default=Label('//a:alias'))})");
useConfiguration("--javabase=//a:suite");
useConfiguration("--javabase=//a:jvm");
ConfiguredTarget ct = getConfiguredTarget("//a:r");
@SuppressWarnings("unchecked") PathFragment javaExecutable =
(PathFragment) ct.get("java_executable");
@@ -111,7 +109,6 @@ public void testJavaRuntimeProviderJavaHome() throws Exception {
scratch.file("a/BUILD",
"load(':rule.bzl', 'jrule')",
"java_runtime(name='jvm', srcs=[], java_home='/foo/bar/')",
"java_runtime_suite(name='suite', default=':jvm')",
"java_runtime_alias(name='alias')",
"jrule(name='r')");
@@ -124,7 +121,7 @@ public void testJavaRuntimeProviderJavaHome() throws Exception {
")",
"jrule = rule(_impl, attrs = { '_java_runtime': attr.label(default=Label('//a:alias'))})");
useConfiguration("--javabase=//a:suite");
useConfiguration("--javabase=//a:jvm");
ConfiguredTarget ct = getConfiguredTarget("//a:r");
@SuppressWarnings("unchecked") PathFragment javaHome =
(PathFragment) ct.get("java_home");
@@ -2008,27 +2008,6 @@ public void testCoverageInstrumentedMatchesFilterNonDefaultLabel() throws Except
assertThat((Boolean) result).isTrue();
}
@Test
public void testStringKeyedLabelDictAttributeInSkylarkRuleContext() throws Exception {
scratch.file("jvm/BUILD",
"java_runtime(name='runtime', srcs=[], java_home='')",
"java_runtime_suite(",
" name = 'suite',",
" runtimes = {'x86': ':runtime'},",
" default = ':runtime',",
")");
invalidatePackages();
SkylarkRuleContext ruleContext = createRuleContext("//jvm:suite");
assertNoEvents();
String keyString =
(String) evalRuleContextCode(ruleContext, "ruleContext.attr.runtimes.keys()[0]");
assertThat(keyString).isEqualTo("x86");
Label valueLabel =
(Label) evalRuleContextCode(ruleContext, "ruleContext.attr.runtimes.values()[0]");
assertThat(valueLabel).isEqualTo(Label.parseAbsolute("//jvm:runtime", ImmutableMap.of()));
}
// A list of attributes and methods ctx objects have
private final List<String> ctxAttributes = ImmutableList.of(
"attr",
@@ -179,12 +179,8 @@ def testJavaTestWithRuntimeRunsRemotely(self):
' use_testrunner = 0,',
' data = ["//bar:bar.txt"],',
')',
'java_runtime_suite(',
' name = "jdk8",',
' default = ":jdk8-default",',
')',
'java_runtime(',
' name = "jdk8-default",',
' name = "jdk8",',
' srcs = [],',
' java_home = "' + java_home + '",',
')',
@@ -254,14 +254,13 @@ function assert_singlejar_works() {
mkdir -p "$pkg/jvm"
cat > "$pkg/jvm/BUILD" <<EOF
package(default_visibility=["//visibility:public"])
java_runtime_suite(name='suite', default=':runtime')
java_runtime(name='runtime', java_home='$javabase')
EOF
# Set javabase to an absolute path.
bazel build //$pkg/java/hello:hello //$pkg/java/hello:hello_deploy.jar \
"$stamp_arg" --javabase="//$pkg/jvm:suite" "$embed_label" >&"$TEST_log" \
"$stamp_arg" --javabase="//$pkg/jvm:runtime" "$embed_label" >&"$TEST_log" \
|| fail "Build failed"
mkdir $pkg/ugly/ || fail "mkdir failed"

0 comments on commit 6e0466f

Please sign in to comment.