Merge "Install required deps for flattened APEX."
diff --git a/android/bazel.go b/android/bazel.go
index f4fc038..becf988 100644
--- a/android/bazel.go
+++ b/android/bazel.go
@@ -379,6 +379,11 @@
"tools/platform-compat/java/android/compat": Bp2BuildDefaultTrueRecursively,
}
+ // Per-module allowlist to always opt modules in of both bp2build and mixed builds.
+ bp2buildModuleAlwaysConvertList = []string{
+ "junit-params-assertj-core",
+ }
+
// Per-module denylist to always opt modules out of both bp2build and mixed builds.
bp2buildModuleDoNotConvertList = []string{
"libnativehelper_compat_libc", // Broken compile: implicit declaration of function 'strerror_r' is invalid in C99
@@ -569,11 +574,16 @@
// Used for quicker lookups
bp2buildModuleDoNotConvert = map[string]bool{}
+ bp2buildModuleAlwaysConvert = map[string]bool{}
bp2buildCcLibraryStaticOnly = map[string]bool{}
mixedBuildsDisabled = map[string]bool{}
)
func init() {
+ for _, moduleName := range bp2buildModuleAlwaysConvertList {
+ bp2buildModuleAlwaysConvert[moduleName] = true
+ }
+
for _, moduleName := range bp2buildModuleDoNotConvertList {
bp2buildModuleDoNotConvert[moduleName] = true
}
@@ -649,7 +659,14 @@
}
func (b *BazelModuleBase) shouldConvertWithBp2build(ctx BazelConversionContext, module blueprint.Module) bool {
- if bp2buildModuleDoNotConvert[module.Name()] {
+ moduleNameNoPrefix := RemoveOptionalPrebuiltPrefix(module.Name())
+ alwaysConvert := bp2buildModuleAlwaysConvert[moduleNameNoPrefix]
+
+ if bp2buildModuleDoNotConvert[moduleNameNoPrefix] {
+ if alwaysConvert {
+ ctx.(BaseModuleContext).ModuleErrorf("a module cannot be in bp2buildModuleDoNotConvert" +
+ " and also be in bp2buildModuleAlwaysConvert")
+ }
return false
}
@@ -663,12 +680,17 @@
// This is a tristate value: true, false, or unset.
propValue := b.bazelProperties.Bazel_module.Bp2build_available
if bp2buildDefaultTrueRecursively(packagePath, config) {
+ if alwaysConvert {
+ ctx.(BaseModuleContext).ModuleErrorf("a module cannot be in a directory marked Bp2BuildDefaultTrue" +
+ " or Bp2BuildDefaultTrueRecursively and also be in bp2buildModuleAlwaysConvert")
+ }
+
// Allow modules to explicitly opt-out.
return proptools.BoolDefault(propValue, true)
}
// Allow modules to explicitly opt-in.
- return proptools.BoolDefault(propValue, false)
+ return proptools.BoolDefault(propValue, alwaysConvert)
}
// bp2buildDefaultTrueRecursively checks that the package contains a prefix from the
diff --git a/apex/apex.go b/apex/apex.go
index 9ef5e4b..fe4c205 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -1755,6 +1755,7 @@
fi := apexFileForRustLibrary(ctx, r)
fi.isJniLib = isJniLib
filesInfo = append(filesInfo, fi)
+ return true // track transitive dependencies
} else {
propertyName := "native_shared_libs"
if isJniLib {
diff --git a/apex/apex_test.go b/apex/apex_test.go
index 990b6b2..f6b840f 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -971,6 +971,9 @@
rustDeps := ctx.ModuleForTests("foo.rust", "android_arm64_armv8-a_apex10000").Rule("rustc").Args["linkFlags"]
ensureContains(t, rustDeps, "libfoo.shared_from_rust/android_arm64_armv8-a_shared_current/libfoo.shared_from_rust.so")
ensureNotContains(t, rustDeps, "libfoo.shared_from_rust/android_arm64_armv8-a_shared/libfoo.shared_from_rust.so")
+
+ apexManifestRule := ctx.ModuleForTests("myapex", "android_common_myapex_image").Rule("apexManifestRule")
+ ensureListContains(t, names(apexManifestRule.Args["requireNativeLibs"]), "libfoo.shared_from_rust.so")
}
func TestApexCanUsePrivateApis(t *testing.T) {
@@ -6830,7 +6833,7 @@
apex {
name: "myapex",
key: "myapex.key",
- jni_libs: ["mylib"],
+ jni_libs: ["mylib", "libfoo.rust"],
updatable: false,
}
@@ -6856,15 +6859,41 @@
stl: "none",
apex_available: [ "myapex" ],
}
+
+ rust_ffi_shared {
+ name: "libfoo.rust",
+ crate_name: "foo",
+ srcs: ["foo.rs"],
+ shared_libs: ["libfoo.shared_from_rust"],
+ prefer_rlib: true,
+ apex_available: ["myapex"],
+ }
+
+ cc_library_shared {
+ name: "libfoo.shared_from_rust",
+ srcs: ["mylib.cpp"],
+ system_shared_libs: [],
+ stl: "none",
+ stubs: {
+ versions: ["10", "11", "12"],
+ },
+ }
+
`)
rule := ctx.ModuleForTests("myapex", "android_common_myapex_image").Rule("apexManifestRule")
// Notice mylib2.so (transitive dep) is not added as a jni_lib
- ensureEquals(t, rule.Args["opt"], "-a jniLibs mylib.so")
+ ensureEquals(t, rule.Args["opt"], "-a jniLibs libfoo.rust.so mylib.so")
ensureExactContents(t, ctx, "myapex", "android_common_myapex_image", []string{
"lib64/mylib.so",
"lib64/mylib2.so",
+ "lib64/libfoo.rust.so",
+ "lib64/libc++.so", // auto-added to libfoo.rust by Soong
+ "lib64/liblog.so", // auto-added to libfoo.rust by Soong
})
+
+ // b/220397949
+ ensureListContains(t, names(rule.Args["requireNativeLibs"]), "libfoo.shared_from_rust.so")
}
func TestApexMutatorsDontRunIfDisabled(t *testing.T) {
diff --git a/cc/androidmk.go b/cc/androidmk.go
index 9290272..318cd7c 100644
--- a/cc/androidmk.go
+++ b/cc/androidmk.go
@@ -560,10 +560,6 @@
func (c *snapshotBinaryDecorator) AndroidMkEntries(ctx AndroidMkContext, entries *android.AndroidMkEntries) {
entries.Class = "EXECUTABLES"
entries.SubName = c.baseProperties.Androidmk_suffix
-
- entries.ExtraEntries = append(entries.ExtraEntries, func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
- entries.AddStrings("LOCAL_MODULE_SYMLINKS", c.Properties.Symlinks...)
- })
}
func (c *snapshotObjectLinker) AndroidMkEntries(ctx AndroidMkContext, entries *android.AndroidMkEntries) {
diff --git a/cc/binary.go b/cc/binary.go
index 6c7d581..0fe4490 100644
--- a/cc/binary.go
+++ b/cc/binary.go
@@ -441,6 +441,16 @@
// Need to determine symlinks early since some targets (ie APEX) need this
// information but will not call 'install'
+ binary.setSymlinkList(ctx)
+
+ return ret
+}
+
+func (binary *binaryDecorator) unstrippedOutputFilePath() android.Path {
+ return binary.unstrippedOutputFile
+}
+
+func (binary *binaryDecorator) setSymlinkList(ctx ModuleContext) {
for _, symlink := range binary.Properties.Symlinks {
binary.symlinks = append(binary.symlinks,
symlink+String(binary.Properties.Suffix)+ctx.toolchain().ExecutableSuffix())
@@ -457,12 +467,6 @@
binary.preferredArchSymlink = symlinkName
}
}
-
- return ret
-}
-
-func (binary *binaryDecorator) unstrippedOutputFilePath() android.Path {
- return binary.unstrippedOutputFile
}
func (binary *binaryDecorator) symlinkList() []string {
diff --git a/cc/snapshot_prebuilt.go b/cc/snapshot_prebuilt.go
index 753d74c..9d40ad0 100644
--- a/cc/snapshot_prebuilt.go
+++ b/cc/snapshot_prebuilt.go
@@ -680,6 +680,9 @@
Input: in,
})
+ // binary snapshots need symlinking
+ p.setSymlinkList(ctx)
+
return outputFile
}
diff --git a/cc/vendor_snapshot_test.go b/cc/vendor_snapshot_test.go
index 645b2cc..2bb43ab 100644
--- a/cc/vendor_snapshot_test.go
+++ b/cc/vendor_snapshot_test.go
@@ -741,6 +741,7 @@
src: "bin",
},
},
+ symlinks: ["binfoo", "binbar"],
}
vendor_snapshot_binary {
@@ -920,7 +921,21 @@
ctx.ModuleForTests("libvendor_without_snapshot", sharedVariant).Output("libvendor_without_snapshot.so")
// bin is installed by bin.vendor_binary.31.arm64
- ctx.ModuleForTests("bin.vendor_binary.31.arm64", binaryVariant).Output("bin")
+ bin64Module := ctx.ModuleForTests("bin.vendor_binary.31.arm64", binaryVariant)
+ bin64Module.Output("bin")
+
+ // also test symlinks
+ bin64MkEntries := android.AndroidMkEntriesForTest(t, ctx, bin64Module.Module())
+ bin64KatiSymlinks := bin64MkEntries[0].EntryMap["LOCAL_SOONG_INSTALL_SYMLINKS"]
+
+ // Either AndroidMk entries contain symlinks, or symlinks should be installed by Soong
+ for _, symlink := range []string{"binfoo", "binbar"} {
+ if inList(symlink, bin64KatiSymlinks) {
+ continue
+ }
+
+ bin64Module.Output(symlink)
+ }
// bin32 is installed by bin32.vendor_binary.31.arm64
ctx.ModuleForTests("bin32.vendor_binary.31.arm64", binary32Variant).Output("bin32")
diff --git a/mk2rbc/mk2rbc.go b/mk2rbc/mk2rbc.go
index cb50a50..2b46c2e 100644
--- a/mk2rbc/mk2rbc.go
+++ b/mk2rbc/mk2rbc.go
@@ -430,7 +430,6 @@
{"TARGET_COPY_OUT_RECOVERY", "recovery"},
{"TARGET_COPY_OUT_VENDOR_RAMDISK", "vendor_ramdisk"},
// TODO(asmundak): to process internal config files, we need the following variables:
- // BOARD_CONFIG_VENDOR_PATH
// TARGET_VENDOR
// target_base_product
//
diff --git a/rust/OWNERS b/rust/OWNERS
index d07ef7e..ddaebc5 100644
--- a/rust/OWNERS
+++ b/rust/OWNERS
@@ -1,5 +1,5 @@
# Additional owner/reviewers for rust rules, including parent directory owners.
-per-file * = chh@google.com, ivanlozano@google.com, jeffv@google.com, mmaurer@google.com, srhines@google.com
+per-file * = chiw@google.com, chriswailes@google.com, ivanlozano@google.com, jeffv@google.com, mmaurer@google.com, srhines@google.com
# Limited owners/reviewers of the allowed list.
-per-file allowed_list.go = chh@google.com, ivanlozano@google.com, jeffv@google.com, mmaurer@google.com, srhines@google.com
+per-file allowed_list.go = chiw@google.com, chriswailes@google.com, ivanlozano@google.com, jeffv@google.com, mmaurer@google.com, srhines@google.com