Skip to content

Commit

Permalink
Enable Starlark java_binary
Browse files Browse the repository at this point in the history
Last remaining CPU regression is due to 04e8b63

PiperOrigin-RevId: 475221152
Change-Id: I030df46a83d90a2591e7f431bc16da1d2fcd5435
  • Loading branch information
hvadehra authored and copybara-github committed Sep 19, 2022
1 parent 92f5e8f commit e96507b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,7 @@ private static BuildLanguageOptions parseBuildLanguageOptions(String... options)
throws Exception {
OptionsParser parser =
OptionsParser.builder().optionsClasses(BuildLanguageOptions.class).build();
parser.parse("--experimental_google_legacy_api"); // For starlark java_binary;
parser.parse(options);
return parser.getOptions(BuildLanguageOptions.class);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ protected void useConfiguration(ImmutableMap<String, Object> starlarkOptions, St
ImmutableList.Builder<String> fullArgs = ImmutableList.builder();
fullArgs.add("--incompatible_enable_android_toolchain_resolution");
// Uncomment the below to get more info when tests fail because of toolchain resolution.
// fullArgs.add("--toolchain_resolution_debug=tools/android:.*toolchain_type");
// fullArgs.add("--toolchain_resolution_debug=tools/android:.*toolchain_type");
boolean hasPlatform = false;
for (String arg : args) {
if (arg.startsWith("--android_sdk=")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1615,12 +1615,14 @@ public void starlarkJavaToJavaBinaryAttributes() throws Exception {
" deps = [':mya'], runtime_deps = [':myb'])");
assertNoEvents();

setBuildLanguageOptions("--experimental_google_legacy_api");
// Test that all bottom jars are on the runtime classpath.
ConfiguredTarget binary = getConfiguredTarget("//foo:binary");
assertThat(
prettyArtifactNames(
binary
.getProvider(JavaRuntimeClasspathProvider.class)
.get(JavaInfo.PROVIDER)
.getCompilationInfoProvider()
.getRuntimeClasspath()
.getSet(Artifact.class)))
.containsAtLeast("foo/libjl_bottom_for_deps.jar", "foo/libjl_bottom_for_runtime_deps.jar");
Expand Down Expand Up @@ -1971,6 +1973,7 @@ public void javaBinary_propagatesDirectNativeLibrariesInJavaInfo() throws Except
"my_rule(name = 'r', dep = ':jl', cc_dep = ':ccl')",
"java_binary(name = 'binary', main_class = 'C', srcs = ['java/C.java'], deps = [':r'])");

setBuildLanguageOptions("--experimental_google_legacy_api");
ConfiguredTarget testTarget = getConfiguredTarget("//foo:binary");

TemplateExpansionAction action =
Expand Down Expand Up @@ -2218,6 +2221,7 @@ public void javaCommonCompileNeverlink() throws Exception {
" fragments = ['java']",
")");

setBuildLanguageOptions("--experimental_google_legacy_api");
ConfiguredTarget target = getConfiguredTarget("//java/test:plugin");
assertThat(
actionsTestUtil()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ public void splitDeps() throws Exception {
"java/a/BUILD",
"cc_library(name = 'lib', srcs = ['lib.cc'])",
"android_binary(name='a', manifest = 'AndroidManifest.xml', deps = [':lib'])");
useConfiguration("--fat_apk_cpu=k8,armeabi-v7a");
useConfiguration("--fat_apk_cpu=k8,armeabi-v7a", "--experimental_google_legacy_api");
List<ConfiguredTarget> deps = getConfiguredDeps("//java/a:a", "deps");
assertThat(deps).hasSize(2);
ConfiguredTarget dep1 = deps.get(0);
Expand Down

0 comments on commit e96507b

Please sign in to comment.