Merge "Revert^2 "Remove `prebuilt_apex_module_creator` mutator"" into main
diff --git a/apex/apex.go b/apex/apex.go
index 9e9b9f2..0caf37c 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -2752,6 +2752,12 @@
return
}
+ // Temporarily bypass /product APEXes with a specific prefix.
+ // TODO: b/352818241 - Remove this after APEX availability is enforced for /product APEXes.
+ if a.ProductSpecific() && strings.HasPrefix(a.ApexVariationName(), "com.sdv.") {
+ return
+ }
+
// Coverage build adds additional dependencies for the coverage-only runtime libraries.
// Requiring them and their transitive depencies with apex_available is not right
// because they just add noise.
diff --git a/apex/apex_test.go b/apex/apex_test.go
index 1f4e5ea..ad0bb17 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -6013,6 +6013,87 @@
system_shared_libs: [],
apex_available: ["otherapex"],
}`)
+
+ // 'apex_available' check is bypassed for /product apex with a specific prefix.
+ // TODO: b/352818241 - Remove below two cases after APEX availability is enforced for /product APEXes.
+ testApex(t, `
+ apex {
+ name: "com.sdv.myapex",
+ key: "myapex.key",
+ native_shared_libs: ["libfoo"],
+ updatable: false,
+ product_specific: true,
+ }
+
+ apex_key {
+ name: "myapex.key",
+ public_key: "testkey.avbpubkey",
+ private_key: "testkey.pem",
+ }
+
+ apex {
+ name: "com.any.otherapex",
+ key: "otherapex.key",
+ native_shared_libs: ["libfoo"],
+ updatable: false,
+ }
+
+ apex_key {
+ name: "otherapex.key",
+ public_key: "testkey.avbpubkey",
+ private_key: "testkey.pem",
+ }
+
+ cc_library {
+ name: "libfoo",
+ stl: "none",
+ system_shared_libs: [],
+ apex_available: ["com.any.otherapex"],
+ product_specific: true,
+ }`,
+ android.FixtureMergeMockFs(android.MockFS{
+ "system/sepolicy/apex/com.sdv.myapex-file_contexts": nil,
+ "system/sepolicy/apex/com.any.otherapex-file_contexts": nil,
+ }))
+
+ // 'apex_available' check is not bypassed for non-product apex with a specific prefix.
+ testApexError(t, "requires \"libfoo\" that doesn't list the APEX under 'apex_available'.", `
+ apex {
+ name: "com.sdv.myapex",
+ key: "myapex.key",
+ native_shared_libs: ["libfoo"],
+ updatable: false,
+ }
+
+ apex_key {
+ name: "myapex.key",
+ public_key: "testkey.avbpubkey",
+ private_key: "testkey.pem",
+ }
+
+ apex {
+ name: "com.any.otherapex",
+ key: "otherapex.key",
+ native_shared_libs: ["libfoo"],
+ updatable: false,
+ }
+
+ apex_key {
+ name: "otherapex.key",
+ public_key: "testkey.avbpubkey",
+ private_key: "testkey.pem",
+ }
+
+ cc_library {
+ name: "libfoo",
+ stl: "none",
+ system_shared_libs: [],
+ apex_available: ["com.any.otherapex"],
+ }`,
+ android.FixtureMergeMockFs(android.MockFS{
+ "system/sepolicy/apex/com.sdv.myapex-file_contexts": nil,
+ "system/sepolicy/apex/com.any.otherapex-file_contexts": nil,
+ }))
}
func TestApexAvailable_IndirectDep(t *testing.T) {
@@ -6058,6 +6139,91 @@
stl: "none",
system_shared_libs: [],
}`)
+
+ // 'apex_available' check is bypassed for /product apex with a specific prefix.
+ // TODO: b/352818241 - Remove below two cases after APEX availability is enforced for /product APEXes.
+ testApex(t, `
+ apex {
+ name: "com.sdv.myapex",
+ key: "myapex.key",
+ native_shared_libs: ["libfoo"],
+ updatable: false,
+ product_specific: true,
+ }
+
+ apex_key {
+ name: "myapex.key",
+ public_key: "testkey.avbpubkey",
+ private_key: "testkey.pem",
+ }
+
+ cc_library {
+ name: "libfoo",
+ stl: "none",
+ shared_libs: ["libbar"],
+ system_shared_libs: [],
+ apex_available: ["com.sdv.myapex"],
+ product_specific: true,
+ }
+
+ cc_library {
+ name: "libbar",
+ stl: "none",
+ shared_libs: ["libbaz"],
+ system_shared_libs: [],
+ apex_available: ["com.sdv.myapex"],
+ product_specific: true,
+ }
+
+ cc_library {
+ name: "libbaz",
+ stl: "none",
+ system_shared_libs: [],
+ product_specific: true,
+ }`,
+ android.FixtureMergeMockFs(android.MockFS{
+ "system/sepolicy/apex/com.sdv.myapex-file_contexts": nil,
+ }))
+
+ // 'apex_available' check is not bypassed for non-product apex with a specific prefix.
+ testApexError(t, `requires "libbaz" that doesn't list the APEX under 'apex_available'.`, `
+ apex {
+ name: "com.sdv.myapex",
+ key: "myapex.key",
+ native_shared_libs: ["libfoo"],
+ updatable: false,
+ }
+
+ apex_key {
+ name: "myapex.key",
+ public_key: "testkey.avbpubkey",
+ private_key: "testkey.pem",
+ }
+
+ cc_library {
+ name: "libfoo",
+ stl: "none",
+ shared_libs: ["libbar"],
+ system_shared_libs: [],
+ apex_available: ["com.sdv.myapex"],
+ }
+
+ cc_library {
+ name: "libbar",
+ stl: "none",
+ shared_libs: ["libbaz"],
+ system_shared_libs: [],
+ apex_available: ["com.sdv.myapex"],
+ }
+
+ cc_library {
+ name: "libbaz",
+ stl: "none",
+ system_shared_libs: [],
+ }`,
+ android.FixtureMergeMockFs(android.MockFS{
+ "system/sepolicy/apex/com.sdv.myapex-file_contexts": nil,
+ }))
}
func TestApexAvailable_IndirectStaticDep(t *testing.T) {
@@ -10111,14 +10277,15 @@
mod := ctx.ModuleForTests("myapex", "android_common_myapex")
s := mod.Rule("apexRule").Args["copy_commands"]
copyCmds := regexp.MustCompile(" *&& *").Split(s, -1)
- if len(copyCmds) != 12 {
- t.Fatalf("Expected 12 commands, got %d in:\n%s", len(copyCmds), s)
+ if len(copyCmds) != 14 {
+ t.Fatalf("Expected 14 commands, got %d in:\n%s", len(copyCmds), s)
}
ensureListContainsMatch(t, copyCmds, "^cp -f .*/aconfig_flags.pb .*/image.apex/etc/aconfig_flags.pb")
ensureListContainsMatch(t, copyCmds, "^cp -f .*/package.map .*/image.apex/etc/package.map")
ensureListContainsMatch(t, copyCmds, "^cp -f .*/flag.map .*/image.apex/etc/flag.map")
ensureListContainsMatch(t, copyCmds, "^cp -f .*/flag.val .*/image.apex/etc/flag.val")
+ ensureListContainsMatch(t, copyCmds, "^cp -f .*/flag.info.*/image.apex/etc/flag.info")
inputs := []string{
"my_aconfig_declarations_foo/intermediate.pb",
@@ -10128,6 +10295,7 @@
VerifyAconfigRule(t, &mod, "create_aconfig_package_map_file", inputs, "android_common_myapex/package.map", "myapex", "package_map")
VerifyAconfigRule(t, &mod, "create_aconfig_flag_map_file", inputs, "android_common_myapex/flag.map", "myapex", "flag_map")
VerifyAconfigRule(t, &mod, "create_aconfig_flag_val_file", inputs, "android_common_myapex/flag.val", "myapex", "flag_val")
+ VerifyAconfigRule(t, &mod, "create_aconfig_flag_info_file", inputs, "android_common_myapex/flag.info", "myapex", "flag_info")
}
func TestAconfigFilesJavaAndCcDeps(t *testing.T) {
@@ -10246,14 +10414,15 @@
mod := ctx.ModuleForTests("myapex", "android_common_myapex")
s := mod.Rule("apexRule").Args["copy_commands"]
copyCmds := regexp.MustCompile(" *&& *").Split(s, -1)
- if len(copyCmds) != 16 {
- t.Fatalf("Expected 16 commands, got %d in:\n%s", len(copyCmds), s)
+ if len(copyCmds) != 18 {
+ t.Fatalf("Expected 18 commands, got %d in:\n%s", len(copyCmds), s)
}
ensureListContainsMatch(t, copyCmds, "^cp -f .*/aconfig_flags.pb .*/image.apex/etc/aconfig_flags.pb")
ensureListContainsMatch(t, copyCmds, "^cp -f .*/package.map .*/image.apex/etc/package.map")
ensureListContainsMatch(t, copyCmds, "^cp -f .*/flag.map .*/image.apex/etc/flag.map")
ensureListContainsMatch(t, copyCmds, "^cp -f .*/flag.val .*/image.apex/etc/flag.val")
+ ensureListContainsMatch(t, copyCmds, "^cp -f .*/flag.info .*/image.apex/etc/flag.info")
inputs := []string{
"my_aconfig_declarations_foo/intermediate.pb",
@@ -10264,6 +10433,7 @@
VerifyAconfigRule(t, &mod, "create_aconfig_package_map_file", inputs, "android_common_myapex/package.map", "myapex", "package_map")
VerifyAconfigRule(t, &mod, "create_aconfig_flag_map_file", inputs, "android_common_myapex/flag.map", "myapex", "flag_map")
VerifyAconfigRule(t, &mod, "create_aconfig_flag_val_file", inputs, "android_common_myapex/flag.val", "myapex", "flag_val")
+ VerifyAconfigRule(t, &mod, "create_aconfig_flag_info_file", inputs, "android_common_myapex/flag.info", "myapex", "flag_info")
}
func TestAconfigFilesRustDeps(t *testing.T) {
@@ -10414,14 +10584,15 @@
mod := ctx.ModuleForTests("myapex", "android_common_myapex")
s := mod.Rule("apexRule").Args["copy_commands"]
copyCmds := regexp.MustCompile(" *&& *").Split(s, -1)
- if len(copyCmds) != 36 {
- t.Fatalf("Expected 36 commands, got %d in:\n%s", len(copyCmds), s)
+ if len(copyCmds) != 38 {
+ t.Fatalf("Expected 38 commands, got %d in:\n%s", len(copyCmds), s)
}
ensureListContainsMatch(t, copyCmds, "^cp -f .*/aconfig_flags.pb .*/image.apex/etc/aconfig_flags.pb")
ensureListContainsMatch(t, copyCmds, "^cp -f .*/package.map .*/image.apex/etc/package.map")
ensureListContainsMatch(t, copyCmds, "^cp -f .*/flag.map .*/image.apex/etc/flag.map")
ensureListContainsMatch(t, copyCmds, "^cp -f .*/flag.val .*/image.apex/etc/flag.val")
+ ensureListContainsMatch(t, copyCmds, "^cp -f .*/flag.info .*/image.apex/etc/flag.info")
inputs := []string{
"my_aconfig_declarations_foo/intermediate.pb",
@@ -10433,6 +10604,7 @@
VerifyAconfigRule(t, &mod, "create_aconfig_package_map_file", inputs, "android_common_myapex/package.map", "myapex", "package_map")
VerifyAconfigRule(t, &mod, "create_aconfig_flag_map_file", inputs, "android_common_myapex/flag.map", "myapex", "flag_map")
VerifyAconfigRule(t, &mod, "create_aconfig_flag_val_file", inputs, "android_common_myapex/flag.val", "myapex", "flag_val")
+ VerifyAconfigRule(t, &mod, "create_aconfig_flag_info_file", inputs, "android_common_myapex/flag.info", "myapex", "flag_info")
}
func VerifyAconfigRule(t *testing.T, mod *android.TestingModule, desc string, inputs []string, output string, container string, file_type string) {
diff --git a/apex/builder.go b/apex/builder.go
index 437189f..19ec1bd 100644
--- a/apex/builder.go
+++ b/apex/builder.go
@@ -96,6 +96,7 @@
{"package.map", "create_aconfig_package_map_file", "package_map"},
{"flag.map", "create_aconfig_flag_map_file", "flag_map"},
{"flag.val", "create_aconfig_flag_val_file", "flag_val"},
+ {"flag.info", "create_aconfig_flag_info_file", "flag_info"},
}
var (
diff --git a/soong_ui.bash b/soong_ui.bash
index 7737880..2f688ef 100755
--- a/soong_ui.bash
+++ b/soong_ui.bash
@@ -26,6 +26,7 @@
source $(cd $(dirname $BASH_SOURCE) &> /dev/null && pwd)/../make/shell_utils.sh
require_top
+setup_cog_env_if_needed
# Save the current PWD for use in soong_ui
export ORIGINAL_PWD=${PWD}