Skip to content

Commit bc1e9d8

Browse files
hvadehracopybara-github
authored andcommitted
Rollforward of e96507b: Enable Starlark java_binary
PiperOrigin-RevId: 476136813 Change-Id: I1b778832ed52fb732bae1ed4cd1b32ebd72720f8
1 parent a2177dc commit bc1e9d8

File tree

4 files changed

+8
-3
lines changed

4 files changed

+8
-3
lines changed

src/test/java/com/google/devtools/build/lib/analysis/util/BuildViewTestCase.java

+1
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,7 @@ private static BuildLanguageOptions parseBuildLanguageOptions(String... options)
546546
throws Exception {
547547
OptionsParser parser =
548548
OptionsParser.builder().optionsClasses(BuildLanguageOptions.class).build();
549+
parser.parse("--experimental_google_legacy_api"); // For starlark java_binary;
549550
parser.parse(options);
550551
return parser.getOptions(BuildLanguageOptions.class);
551552
}

src/test/java/com/google/devtools/build/lib/rules/android/AndroidBuildViewTestCase.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ protected void useConfiguration(ImmutableMap<String, Object> starlarkOptions, St
9595
ImmutableList.Builder<String> fullArgs = ImmutableList.builder();
9696
fullArgs.add("--incompatible_enable_android_toolchain_resolution");
9797
// Uncomment the below to get more info when tests fail because of toolchain resolution.
98-
// fullArgs.add("--toolchain_resolution_debug=tools/android:.*toolchain_type");
98+
// fullArgs.add("--toolchain_resolution_debug=tools/android:.*toolchain_type");
9999
boolean hasPlatform = false;
100100
for (String arg : args) {
101101
if (arg.startsWith("--android_sdk=")) {

src/test/java/com/google/devtools/build/lib/rules/java/JavaStarlarkApiTest.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -1615,12 +1615,14 @@ public void starlarkJavaToJavaBinaryAttributes() throws Exception {
16151615
" deps = [':mya'], runtime_deps = [':myb'])");
16161616
assertNoEvents();
16171617

1618+
setBuildLanguageOptions("--experimental_google_legacy_api");
16181619
// Test that all bottom jars are on the runtime classpath.
16191620
ConfiguredTarget binary = getConfiguredTarget("//foo:binary");
16201621
assertThat(
16211622
prettyArtifactNames(
16221623
binary
1623-
.getProvider(JavaRuntimeClasspathProvider.class)
1624+
.get(JavaInfo.PROVIDER)
1625+
.getCompilationInfoProvider()
16241626
.getRuntimeClasspath()
16251627
.getSet(Artifact.class)))
16261628
.containsAtLeast("foo/libjl_bottom_for_deps.jar", "foo/libjl_bottom_for_runtime_deps.jar");
@@ -1971,6 +1973,7 @@ public void javaBinary_propagatesDirectNativeLibrariesInJavaInfo() throws Except
19711973
"my_rule(name = 'r', dep = ':jl', cc_dep = ':ccl')",
19721974
"java_binary(name = 'binary', main_class = 'C', srcs = ['java/C.java'], deps = [':r'])");
19731975

1976+
setBuildLanguageOptions("--experimental_google_legacy_api");
19741977
ConfiguredTarget testTarget = getConfiguredTarget("//foo:binary");
19751978

19761979
TemplateExpansionAction action =
@@ -2218,6 +2221,7 @@ public void javaCommonCompileNeverlink() throws Exception {
22182221
" fragments = ['java']",
22192222
")");
22202223

2224+
setBuildLanguageOptions("--experimental_google_legacy_api");
22212225
ConfiguredTarget target = getConfiguredTarget("//java/test:plugin");
22222226
assertThat(
22232227
actionsTestUtil()

src/test/java/com/google/devtools/build/lib/skyframe/ConfigurationsForTargetsTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ public void splitDeps() throws Exception {
351351
"java/a/BUILD",
352352
"cc_library(name = 'lib', srcs = ['lib.cc'])",
353353
"android_binary(name='a', manifest = 'AndroidManifest.xml', deps = [':lib'])");
354-
useConfiguration("--fat_apk_cpu=k8,armeabi-v7a");
354+
useConfiguration("--fat_apk_cpu=k8,armeabi-v7a", "--experimental_google_legacy_api");
355355
List<ConfiguredTarget> deps = getConfiguredDeps("//java/a:a", "deps");
356356
assertThat(deps).hasSize(2);
357357
ConfiguredTarget dep1 = deps.get(0);

0 commit comments

Comments
 (0)