Merge "Bp2build converter for java_host_for_device."
diff --git a/bp2build/java_library_conversion_test.go b/bp2build/java_library_conversion_test.go
index 69d0db9..683ee27 100644
--- a/bp2build/java_library_conversion_test.go
+++ b/bp2build/java_library_conversion_test.go
@@ -740,7 +740,7 @@
})
}
-func TestJavaLibraryArchVariantLibs(t *testing.T) {
+func TestJavaLibraryArchVariantDeps(t *testing.T) {
runJavaLibraryTestCase(t, Bp2buildTestCase{
Description: "java_library with arch variant libs",
Blueprint: `java_library {
@@ -750,6 +750,7 @@
target: {
android: {
libs: ["java-lib-3"],
+ static_libs: ["java-lib-4"],
},
},
bazel_module: { bp2build_available: true },
@@ -762,12 +763,23 @@
java_library{
name: "java-lib-3",
}
+
+ java_library{
+ name: "java-lib-4",
+}
`,
ExpectedBazelTargets: []string{
MakeBazelTarget("java_library", "java-lib-1", AttrNameToString{
"srcs": `["a.java"]`,
+ "exports": `select({
+ "//build/bazel/platforms/os:android": [":java-lib-4"],
+ "//conditions:default": [],
+ })`,
"deps": `[":java-lib-2-neverlink"] + select({
- "//build/bazel/platforms/os:android": [":java-lib-3-neverlink"],
+ "//build/bazel/platforms/os:android": [
+ ":java-lib-3-neverlink",
+ ":java-lib-4",
+ ],
"//conditions:default": [],
})`,
}),
@@ -776,6 +788,8 @@
MakeNeverlinkDuplicateTarget("java_library", "java-lib-2"),
MakeBazelTarget("java_library", "java-lib-3", AttrNameToString{}),
MakeNeverlinkDuplicateTarget("java_library", "java-lib-3"),
+ MakeBazelTarget("java_library", "java-lib-4", AttrNameToString{}),
+ MakeNeverlinkDuplicateTarget("java_library", "java-lib-4"),
},
})
}
diff --git a/cc/afdo.go b/cc/afdo.go
index 4a8498b..be4f50a 100644
--- a/cc/afdo.go
+++ b/cc/afdo.go
@@ -71,10 +71,10 @@
func (afdo *afdo) flags(ctx ModuleContext, flags Flags) Flags {
if path := afdo.Properties.FdoProfilePath; path != nil {
+ // The flags are prepended to allow overriding.
profileUseFlag := fmt.Sprintf(afdoCFlagsFormat, *path)
- flags.Local.CFlags = append(flags.Local.CFlags, profileUseFlag)
- flags.Local.LdFlags = append(flags.Local.LdFlags, profileUseFlag)
- flags.Local.LdFlags = append(flags.Local.LdFlags, "-Wl,-mllvm,-no-warn-sample-unused=true")
+ flags.Local.CFlags = append([]string{profileUseFlag}, flags.Local.CFlags...)
+ flags.Local.LdFlags = append([]string{profileUseFlag, "-Wl,-mllvm,-no-warn-sample-unused=true"}, flags.Local.LdFlags...)
// Update CFlagsDeps and LdFlagsDeps so the module is rebuilt
// if profileFile gets updated
diff --git a/java/core-libraries/TxtStubLibraries.bp b/java/core-libraries/TxtStubLibraries.bp
index b63ce42..813187e 100644
--- a/java/core-libraries/TxtStubLibraries.bp
+++ b/java/core-libraries/TxtStubLibraries.bp
@@ -33,8 +33,8 @@
"system-modules-no-annotations",
],
static_libs: [
- "core.current.stubs.from-txt",
- "core-lambda-stubs-for-system-modules",
+ "core.current.stubs.from-text",
+ "core-lambda-stubs.from-text",
],
// TODO: Enable after stub generation from .txt file is available
enabled: false,
@@ -58,8 +58,8 @@
"system-modules-no-annotations",
],
static_libs: [
- "core.module_lib.stubs.txt",
- "core-lambda-stubs-for-system-modules",
+ "core.module_lib.stubs.from-text",
+ "core-lambda-stubs.from-text",
],
// TODO: Enable after stub generation from .txt file is available
enabled: false,
@@ -89,7 +89,7 @@
visibility: core_platform_visibility,
libs: [
"legacy.core.platform.api.no.annotations.stubs.from-text",
- "core-lambda-stubs-for-system-modules",
+ "core-lambda-stubs.from-text",
],
// TODO: Enable after stub generation from .txt file is available
enabled: false,
@@ -118,7 +118,7 @@
visibility: core_platform_visibility,
libs: [
"stable.core.platform.api.no.annotations.stubs.from-text",
- "core-lambda-stubs-for-system-modules",
+ "core-lambda-stubs.from-text",
],
// TODO: Enable after stub generation from .txt file is available
enabled: false,
@@ -140,3 +140,17 @@
// TODO: Enable after stub generation from .txt file is available
enabled: false,
}
+
+java_api_library {
+ name: "core-lambda-stubs.from-text",
+ api_surface: "toolchain",
+ api_contributions: [
+ "art.module.toolchain.api.api.contribution",
+ ],
+ libs: [
+ // LambdaMetaFactory depends on CallSite etc. which is part of the Core API surface
+ "core.current.stubs.from-text",
+ ],
+ // TODO: Enable after stub generation from .txt file is available
+ enabled: false,
+}
diff --git a/java/java.go b/java/java.go
index 97d5514..403f503 100644
--- a/java/java.go
+++ b/java/java.go
@@ -2905,10 +2905,6 @@
}
}
- if m.properties.Static_libs != nil {
- staticDeps.Append(android.BazelLabelForModuleDeps(ctx, android.LastUniqueStrings(android.CopyOf(m.properties.Static_libs))))
- }
-
protoDepLabel := bp2buildProto(ctx, &m.Module, srcPartitions[protoSrcPartition])
// Soong does not differentiate between a java_library and the Bazel equivalent of
// a java_proto_library + proto_library pair. Instead, in Soong proto sources are
@@ -2920,7 +2916,18 @@
depLabels := &javaDependencyLabels{}
depLabels.Deps = deps
- depLabels.StaticDeps = bazel.MakeLabelListAttribute(staticDeps)
+
+ for axis, configToProps := range archVariantProps {
+ for config, _props := range configToProps {
+ if archProps, ok := _props.(*CommonProperties); ok {
+ archStaticLibs := android.BazelLabelForModuleDeps(
+ ctx,
+ android.LastUniqueStrings(android.CopyOf(archProps.Static_libs)))
+ depLabels.StaticDeps.SetSelectValue(axis, config, archStaticLibs)
+ }
+ }
+ }
+ depLabels.StaticDeps.Value.Append(staticDeps)
hasKotlin := !kotlinSrcs.IsEmpty()
commonAttrs.kotlinAttributes = &kotlinAttributes{
diff --git a/java/sdk.go b/java/sdk.go
index 1b18ba4..8b4918a 100644
--- a/java/sdk.go
+++ b/java/sdk.go
@@ -151,7 +151,7 @@
systemModules := android.JavaApiLibraryName(ctx.Config(), fmt.Sprintf("core-%s-stubs-system-modules", systemModulesKind))
return sdkDep{
useModule: true,
- bootclasspath: []string{module, config.DefaultLambdaStubsLibrary},
+ bootclasspath: []string{module, android.JavaApiLibraryName(ctx.Config(), config.DefaultLambdaStubsLibrary)},
systemModules: systemModules,
java9Classpath: []string{module},
frameworkResModule: "framework-res",
@@ -197,7 +197,7 @@
case android.SdkCore:
return sdkDep{
useModule: true,
- bootclasspath: []string{android.SdkCore.JavaLibraryName(ctx.Config()), config.DefaultLambdaStubsLibrary},
+ bootclasspath: []string{android.SdkCore.JavaLibraryName(ctx.Config()), android.JavaApiLibraryName(ctx.Config(), config.DefaultLambdaStubsLibrary)},
systemModules: android.JavaApiLibraryName(ctx.Config(), "core-public-stubs-system-modules"),
noFrameworksLibs: true,
}