Merge "Skip py2-cmd tests on Mac" into main
diff --git a/cc/vndk.go b/cc/vndk.go
index 82a2a4b..5ac5032 100644
--- a/cc/vndk.go
+++ b/cc/vndk.go
@@ -41,21 +41,33 @@
func VndkLibrariesTxtModules(vndkVersion string, ctx android.BaseModuleContext) []string {
if vndkVersion == "current" {
- result := []string{
- vndkCoreLibrariesTxt,
- vndkSpLibrariesTxt,
- vndkPrivateLibrariesTxt,
- vndkProductLibrariesTxt,
- }
+ // We can assume all txt files are snapshotted if we find one of them.
+ currentVndkSnapshotted := ctx.OtherModuleExists(insertVndkVersion(llndkLibrariesTxt, ctx.DeviceConfig().PlatformVndkVersion()))
+ if currentVndkSnapshotted {
+ // If the current VNDK is already snapshotted (which can happen with
+ // the `next` config), use the prebuilt txt files in the snapshot.
+ // This is because the txt files built from source are probably be
+ // for the in-development version.
+ vndkVersion = ctx.DeviceConfig().PlatformVndkVersion()
+ } else {
+ // Use the txt files generated from the source
+ result := []string{
+ vndkCoreLibrariesTxt,
+ vndkSpLibrariesTxt,
+ vndkPrivateLibrariesTxt,
+ vndkProductLibrariesTxt,
+ }
- // TODO(b/290159430) This part will not be required once deprecation of VNDK
- // is handled with 'ro.vndk.version' property
- if !ctx.Config().IsVndkDeprecated() {
- result = append(result, llndkLibrariesTxt)
- }
+ // TODO(b/290159430) This part will not be required once deprecation
+ // of VNDK is handled with 'ro.vndk.version' property
+ if !ctx.Config().IsVndkDeprecated() {
+ result = append(result, llndkLibrariesTxt)
+ }
- return result
+ return result
+ }
}
+
// Snapshot vndks have their own *.libraries.VER.txt files.
// Note that snapshots don't have "vndkcorevariant.libraries.VER.txt"
result := []string{
@@ -535,6 +547,15 @@
return filename
}
+func (txt *vndkLibrariesTxt) DepsMutator(mctx android.BottomUpMutatorContext) {
+ versionedName := insertVndkVersion(txt.Name(), mctx.DeviceConfig().PlatformVndkVersion())
+ if mctx.OtherModuleExists(versionedName) {
+ // If the prebuilt vndk libraries txt files exist, install them instead.
+ txt.HideFromMake()
+ mctx.AddDependency(txt, nil, versionedName)
+ }
+}
+
func (txt *vndkLibrariesTxt) GenerateAndroidBuildActions(ctx android.ModuleContext) {
filename := txt.Name()
diff --git a/rust/androidmk.go b/rust/androidmk.go
index 5e680b0..c684e81 100644
--- a/rust/androidmk.go
+++ b/rust/androidmk.go
@@ -61,7 +61,7 @@
entries.AddStrings("LOCAL_RLIB_LIBRARIES", mod.Properties.AndroidMkRlibs...)
entries.AddStrings("LOCAL_DYLIB_LIBRARIES", mod.Properties.AndroidMkDylibs...)
entries.AddStrings("LOCAL_PROC_MACRO_LIBRARIES", mod.Properties.AndroidMkProcMacroLibs...)
- entries.AddStrings("LOCAL_SHARED_LIBRARIES", mod.Properties.AndroidMkSharedLibs...)
+ entries.AddStrings("LOCAL_SHARED_LIBRARIES", mod.transitiveAndroidMkSharedLibs.ToList()...)
entries.AddStrings("LOCAL_STATIC_LIBRARIES", mod.Properties.AndroidMkStaticLibs...)
entries.AddStrings("LOCAL_SOONG_LINK_TYPE", mod.makeLinkType)
if mod.UseVndk() {
diff --git a/rust/binary_test.go b/rust/binary_test.go
index fc4c560..dff94ac 100644
--- a/rust/binary_test.go
+++ b/rust/binary_test.go
@@ -185,7 +185,7 @@
if !android.InList("libc", fizzMod.Properties.AndroidMkStaticLibs) {
t.Errorf("static binary not linking against libc as a static library")
}
- if len(fizzMod.Properties.AndroidMkSharedLibs) > 0 {
+ if len(fizzMod.transitiveAndroidMkSharedLibs.ToList()) > 0 {
t.Errorf("static binary incorrectly linking against shared libraries")
}
}
diff --git a/rust/rust.go b/rust/rust.go
index fc8db86..689ff38 100644
--- a/rust/rust.go
+++ b/rust/rust.go
@@ -66,7 +66,6 @@
AndroidMkRlibs []string `blueprint:"mutated"`
AndroidMkDylibs []string `blueprint:"mutated"`
AndroidMkProcMacroLibs []string `blueprint:"mutated"`
- AndroidMkSharedLibs []string `blueprint:"mutated"`
AndroidMkStaticLibs []string `blueprint:"mutated"`
ImageVariationPrefix string `blueprint:"mutated"`
@@ -168,6 +167,8 @@
// For apex variants, this is set as apex.min_sdk_version
apexSdkVersion android.ApiLevel
+
+ transitiveAndroidMkSharedLibs *android.DepSet[string]
}
func (mod *Module) Header() bool {
@@ -1218,6 +1219,9 @@
})
}
+ var transitiveAndroidMkSharedLibs []*android.DepSet[string]
+ var directAndroidMkSharedLibs []string
+
ctx.VisitDirectDeps(func(dep android.Module) {
depName := ctx.OtherModuleName(dep)
depTag := ctx.OtherModuleDependencyTag(dep)
@@ -1261,6 +1265,8 @@
mod.Properties.AndroidMkProcMacroLibs = append(mod.Properties.AndroidMkProcMacroLibs, makeLibName)
}
+ transitiveAndroidMkSharedLibs = append(transitiveAndroidMkSharedLibs, rustDep.transitiveAndroidMkSharedLibs)
+
if android.IsSourceDepTagWithOutputTag(depTag, "") {
// Since these deps are added in path_properties.go via AddDependencies, we need to ensure the correct
// OS/Arch variant is used.
@@ -1388,7 +1394,7 @@
// Record baseLibName for snapshots.
mod.Properties.SnapshotSharedLibs = append(mod.Properties.SnapshotSharedLibs, cc.BaseLibName(depName))
- mod.Properties.AndroidMkSharedLibs = append(mod.Properties.AndroidMkSharedLibs, makeLibName)
+ directAndroidMkSharedLibs = append(directAndroidMkSharedLibs, makeLibName)
exportDep = true
case cc.IsHeaderDepTag(depTag):
exportedInfo := ctx.OtherModuleProvider(dep, cc.FlagExporterInfoProvider).(cc.FlagExporterInfo)
@@ -1425,6 +1431,8 @@
}
})
+ mod.transitiveAndroidMkSharedLibs = android.NewDepSet[string](android.PREORDER, directAndroidMkSharedLibs, transitiveAndroidMkSharedLibs)
+
var rlibDepFiles RustLibraries
for _, dep := range directRlibDeps {
rlibDepFiles = append(rlibDepFiles, RustLibrary{Path: dep.UnstrippedOutputFile(), CrateName: dep.CrateName()})
diff --git a/rust/rust_test.go b/rust/rust_test.go
index 704bfe7..835114c 100644
--- a/rust/rust_test.go
+++ b/rust/rust_test.go
@@ -267,7 +267,7 @@
t.Errorf("Proc_macro dependency not detected (dependency missing from AndroidMkProcMacroLibs)")
}
- if !android.InList("libshared", module.Properties.AndroidMkSharedLibs) {
+ if !android.InList("libshared", module.transitiveAndroidMkSharedLibs.ToList()) {
t.Errorf("Shared library dependency not detected (dependency missing from AndroidMkSharedLibs)")
}
diff --git a/rust/vendor_snapshot_test.go b/rust/vendor_snapshot_test.go
index 387d170..1e7e7d3 100644
--- a/rust/vendor_snapshot_test.go
+++ b/rust/vendor_snapshot_test.go
@@ -1063,7 +1063,7 @@
}
}
- libclientAndroidMkSharedLibs := ctx.ModuleForTests("libclient", sharedVariant).Module().(*Module).Properties.AndroidMkSharedLibs
+ libclientAndroidMkSharedLibs := ctx.ModuleForTests("libclient", sharedVariant).Module().(*Module).transitiveAndroidMkSharedLibs.ToList()
if g, w := libclientAndroidMkSharedLibs, []string{"libvndk.vendor", "libvendor_available.vendor", "lib64", "liblog.vendor", "libc.vendor", "libm.vendor", "libdl.vendor"}; !reflect.DeepEqual(g, w) {
t.Errorf("wanted libclient AndroidMkSharedLibs %q, got %q", w, g)
}
@@ -1078,7 +1078,7 @@
t.Errorf("wanted libclient libclientAndroidMkDylibs %q, got %q", w, libclientAndroidMkDylibs)
}
- libclient32AndroidMkSharedLibs := ctx.ModuleForTests("libclient", shared32Variant).Module().(*Module).Properties.AndroidMkSharedLibs
+ libclient32AndroidMkSharedLibs := ctx.ModuleForTests("libclient", shared32Variant).Module().(*Module).transitiveAndroidMkSharedLibs.ToList()
if g, w := libclient32AndroidMkSharedLibs, []string{"libvndk.vendor", "libvendor_available.vendor", "lib32", "liblog.vendor", "libc.vendor", "libm.vendor", "libdl.vendor"}; !reflect.DeepEqual(g, w) {
t.Errorf("wanted libclient32 AndroidMkSharedLibs %q, got %q", w, g)
}