Merge "Make sanitizer markapexes mutators parallel" into main am: b9b3915d7d am: 3fddcd9c8f
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3294658
Change-Id: Ibf92068878187a7a52863cd07f6fe60f8bc31a0d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/android/config.go b/android/config.go
index e519760..ba80796 100644
--- a/android/config.go
+++ b/android/config.go
@@ -2086,6 +2086,10 @@
return PathsForSource(ctx, c.productVariables.OdmPropFiles)
}
+func (c *config) ExtraAllowedDepsTxt() string {
+ return String(c.productVariables.ExtraAllowedDepsTxt)
+}
+
func (c *config) EnableUffdGc() string {
return String(c.productVariables.EnableUffdGc)
}
diff --git a/android/container_violations.go b/android/container_violations.go
index 4251484..efbc8da 100644
--- a/android/container_violations.go
+++ b/android/container_violations.go
@@ -15,6 +15,10 @@
package android
var ContainerDependencyViolationAllowlist = map[string][]string{
+ "adservices-service-core": {
+ "gson", // apex [com.android.adservices, com.android.extservices] -> apex [com.android.virt]
+ },
+
"android.car-module.impl": {
"modules-utils-preconditions", // apex [com.android.car.framework] -> apex [com.android.adservices, com.android.appsearch, com.android.cellbroadcast, com.android.extservices, com.android.ondevicepersonalization, com.android.tethering, com.android.uwb, com.android.wifi, test_com.android.cellbroadcast, test_com.android.wifi]
},
@@ -46,6 +50,11 @@
"modules-utils-shell-command-handler", // apex [com.android.car.framework] -> apex [com.android.adservices, com.android.art, com.android.art.debug, com.android.art.testing, com.android.btservices, com.android.configinfrastructure, com.android.mediaprovider, com.android.nfcservices, com.android.permission, com.android.scheduling, com.android.tethering, com.android.uwb, com.android.wifi, test_com.android.mediaprovider, test_com.android.permission, test_com.android.wifi, test_imgdiag_com.android.art, test_jitzygote_com.android.art]
},
+ "cellbroadcastreceiver_aconfig_flags_lib": {
+ "ext", // apex [com.android.cellbroadcast, test_com.android.cellbroadcast] -> system
+ "framework", // apex [com.android.cellbroadcast, test_com.android.cellbroadcast] -> system
+ },
+
"connectivity-net-module-utils-bpf": {
"net-utils-device-common-struct-base", // apex [com.android.tethering] -> system
},
@@ -161,6 +170,10 @@
"framework", // cts -> unstable
},
+ "CtsAppFunctionTestCases": {
+ "framework", // cts -> unstable
+ },
+
"CtsAppOpsTestCases": {
"framework", // cts -> unstable
},
@@ -701,6 +714,10 @@
"framework", // cts -> unstable
},
+ "CtsTvInputTestCases": {
+ "framework", // cts -> unstable
+ },
+
"CtsTvTunerTestCases": {
"framework", // cts -> unstable
},
@@ -822,6 +839,10 @@
"app-compat-annotations", // apex [com.android.btservices] -> system
},
+ "framework-configinfrastructure.impl": {
+ "configinfra_framework_flags_java_lib", // apex [com.android.configinfrastructure] -> system
+ },
+
"framework-connectivity-t.impl": {
"app-compat-annotations", // apex [com.android.tethering] -> system
"framework-connectivity-pre-jarjar", // apex [com.android.tethering] -> system
@@ -832,6 +853,7 @@
},
"framework-ondevicepersonalization.impl": {
+ "app-compat-annotations", // apex [com.android.ondevicepersonalization] -> system
"ondevicepersonalization_flags_lib", // apex [com.android.ondevicepersonalization] -> system
},
diff --git a/android/variable.go b/android/variable.go
index 1aaa70a..fbab93b 100644
--- a/android/variable.go
+++ b/android/variable.go
@@ -212,6 +212,7 @@
Platform_display_version_name *string `json:",omitempty"`
Platform_version_name *string `json:",omitempty"`
Platform_sdk_version *int `json:",omitempty"`
+ Platform_sdk_minor_version *int `json:",omitempty"`
Platform_sdk_codename *string `json:",omitempty"`
Platform_sdk_version_or_codename *string `json:",omitempty"`
Platform_sdk_final *bool `json:",omitempty"`
@@ -522,6 +523,8 @@
DeviceProductCompatibilityMatrixFile []string `json:",omitempty"`
PartitionVarsForSoongMigrationOnlyDoNotUse PartitionVariables
+
+ ExtraAllowedDepsTxt *string `json:",omitempty"`
}
type PartitionQualifiedVariablesType struct {
diff --git a/apex/apex.go b/apex/apex.go
index d7dc6d7..e2afdef 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -149,9 +149,6 @@
// Default: true.
Installable *bool
- // Deprecated. Do not use. TODO(b/350644693) remove this after removing all usage
- Use_vndk_as_stable *bool
-
// The type of filesystem to use. Either 'ext4', 'f2fs' or 'erofs'. Default 'ext4'.
Payload_fs_type *string
@@ -159,10 +156,6 @@
// Default is false.
Ignore_system_library_special_case *bool
- // Whenever apex_payload.img of the APEX should include dm-verity hashtree.
- // Default value is true.
- Generate_hashtree *bool
-
// Whenever apex_payload.img of the APEX should not be dm-verity signed. Should be only
// used in tests.
Test_only_unsigned_payload *bool
@@ -1415,11 +1408,6 @@
return !a.properties.PreventInstall && (a.properties.Installable == nil || proptools.Bool(a.properties.Installable))
}
-// See the generate_hashtree property
-func (a *apexBundle) shouldGenerateHashtree() bool {
- return proptools.BoolDefault(a.properties.Generate_hashtree, true)
-}
-
// See the test_only_unsigned_payload property
func (a *apexBundle) testOnlyShouldSkipPayloadSign() bool {
return proptools.Bool(a.properties.Test_only_unsigned_payload)
diff --git a/apex/apex_singleton.go b/apex/apex_singleton.go
index f405cb2..00dd446 100644
--- a/apex/apex_singleton.go
+++ b/apex/apex_singleton.go
@@ -18,6 +18,7 @@
import (
"encoding/json"
+ "strings"
"github.com/google/blueprint"
@@ -58,9 +59,9 @@
// Diff two given lists while ignoring comments in the allowed deps file.
diffAllowedApexDepsInfoRule = pctx.AndroidStaticRule("diffAllowedApexDepsInfoRule", blueprint.RuleParams{
- Description: "Diff ${allowed_deps} and ${new_allowed_deps}",
+ Description: "Diff ${allowed_deps_list} and ${new_allowed_deps}",
Command: `
- if grep -v '^#' ${allowed_deps} | diff -B - ${new_allowed_deps}; then
+ if grep -v -h '^#' ${allowed_deps_list} | sort -u -f| diff -B -u - ${new_allowed_deps}; then
touch ${out};
else
echo -e "\n******************************";
@@ -81,10 +82,15 @@
exit 1;
fi;
`,
- }, "allowed_deps", "new_allowed_deps")
+ }, "allowed_deps_list", "new_allowed_deps")
)
func (s *apexDepsInfoSingleton) GenerateBuildActions(ctx android.SingletonContext) {
+ allowedDepsSources := []android.OptionalPath{android.ExistentPathForSource(ctx, "packages/modules/common/build/allowed_deps.txt")}
+ extraAllowedDepsPath := ctx.Config().ExtraAllowedDepsTxt()
+ if extraAllowedDepsPath != "" {
+ allowedDepsSources = append(allowedDepsSources, android.ExistentPathForSource(ctx, extraAllowedDepsPath))
+ }
updatableFlatLists := android.Paths{}
ctx.VisitAllModules(func(module android.Module) {
if binaryInfo, ok := module.(android.ApexBundleDepsInfoIntf); ok {
@@ -96,37 +102,42 @@
}
}
})
-
- allowedDepsSource := android.ExistentPathForSource(ctx, "packages/modules/common/build/allowed_deps.txt")
newAllowedDeps := android.PathForOutput(ctx, "apex", "depsinfo", "new-allowed-deps.txt")
s.allowedApexDepsInfoCheckResult = android.PathForOutput(ctx, newAllowedDeps.Rel()+".check")
-
- if !allowedDepsSource.Valid() {
+ hasOneValidDepsPath := false
+ for _, allowedDepsSource := range allowedDepsSources {
+ if allowedDepsSource.Valid() {
+ hasOneValidDepsPath = true
+ updatableFlatLists = append(updatableFlatLists, allowedDepsSource.Path())
+ }
+ }
+ allowedDepsStrList := make([]string, len(allowedDepsSources))
+ for _, value := range allowedDepsSources {
+ allowedDepsStrList = append(allowedDepsStrList, value.String())
+ }
+ allowedDepsListString := strings.Join(allowedDepsStrList, " ")
+ if !hasOneValidDepsPath {
// Unbundled projects may not have packages/modules/common/ checked out; ignore those.
ctx.Build(pctx, android.BuildParams{
Rule: android.Touch,
Output: s.allowedApexDepsInfoCheckResult,
})
} else {
- allowedDeps := allowedDepsSource.Path()
-
ctx.Build(pctx, android.BuildParams{
Rule: generateApexDepsInfoFilesRule,
- Inputs: append(updatableFlatLists, allowedDeps),
+ Inputs: updatableFlatLists,
Output: newAllowedDeps,
})
-
ctx.Build(pctx, android.BuildParams{
Rule: diffAllowedApexDepsInfoRule,
Input: newAllowedDeps,
Output: s.allowedApexDepsInfoCheckResult,
Args: map[string]string{
- "allowed_deps": allowedDeps.String(),
- "new_allowed_deps": newAllowedDeps.String(),
+ "allowed_deps_list": allowedDepsListString,
+ "new_allowed_deps": newAllowedDeps.String(),
},
})
}
-
ctx.Phony("apex-allowed-deps-check", s.allowedApexDepsInfoCheckResult)
}
diff --git a/apex/apex_test.go b/apex/apex_test.go
index da6214d..964eb99 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -2185,6 +2185,151 @@
flatlist, "yourlib(minSdkVersion:29)")
}
+func TestTrackCustomAllowedDepsInvalidDefaultTxt(t *testing.T) {
+ ctx := testApex(t, `
+ apex {
+ name: "myapex",
+ key: "myapex.key",
+ updatable: true,
+ native_shared_libs: [
+ "mylib",
+ "yourlib",
+ ],
+ min_sdk_version: "29",
+ }
+
+ apex {
+ name: "myapex2",
+ key: "myapex.key",
+ updatable: false,
+ native_shared_libs: ["yourlib"],
+ }
+
+ apex_key {
+ name: "myapex.key",
+ public_key: "testkey.avbpubkey",
+ private_key: "testkey.pem",
+ }
+
+ cc_library {
+ name: "mylib",
+ srcs: ["mylib.cpp"],
+ shared_libs: ["libbar"],
+ min_sdk_version: "29",
+ apex_available: ["myapex"],
+ }
+
+ cc_library {
+ name: "libbar",
+ stubs: { versions: ["29", "30"] },
+ }
+
+ cc_library {
+ name: "yourlib",
+ srcs: ["mylib.cpp"],
+ min_sdk_version: "29",
+ apex_available: ["myapex", "myapex2", "//apex_available:platform"],
+ }
+ `, withFiles(android.MockFS{
+ "packages/modules/common/build/custom_allowed_deps.txt": nil,
+ }),
+ android.FixtureModifyProductVariables(
+ func(variables android.FixtureProductVariables) {
+ variables.ExtraAllowedDepsTxt = proptools.StringPtr("packages/modules/common/build/custom_allowed_deps.txt")
+ },
+ ))
+
+ depsinfo := ctx.SingletonForTests("apex_depsinfo_singleton")
+ inputs := depsinfo.Rule("generateApexDepsInfoFilesRule").BuildParams.Inputs.Strings()
+ android.AssertStringListContains(t, "updatable myapex should generate depsinfo file", inputs,
+ "out/soong/.intermediates/myapex/android_common_myapex/depsinfo/flatlist.txt")
+ android.AssertStringListDoesNotContain(t, "non-updatable myapex2 should not generate depsinfo file", inputs,
+ "out/soong/.intermediates/myapex2/android_common_myapex2/depsinfo/flatlist.txt")
+
+ myapex := ctx.ModuleForTests("myapex", "android_common_myapex")
+ flatlist := strings.Split(android.ContentFromFileRuleForTests(t, ctx,
+ myapex.Output("depsinfo/flatlist.txt")), "\n")
+ android.AssertStringListContains(t, "deps with stubs should be tracked in depsinfo as external dep",
+ flatlist, "libbar(minSdkVersion:(no version)) (external)")
+ android.AssertStringListDoesNotContain(t, "do not track if not available for platform",
+ flatlist, "mylib:(minSdkVersion:29)")
+ android.AssertStringListContains(t, "track platform-available lib",
+ flatlist, "yourlib(minSdkVersion:29)")
+}
+
+func TestTrackCustomAllowedDepsWithDefaultTxt(t *testing.T) {
+ ctx := testApex(t, `
+ apex {
+ name: "myapex",
+ key: "myapex.key",
+ updatable: true,
+ native_shared_libs: [
+ "mylib",
+ "yourlib",
+ ],
+ min_sdk_version: "29",
+ }
+
+ apex {
+ name: "myapex2",
+ key: "myapex.key",
+ updatable: false,
+ native_shared_libs: ["yourlib"],
+ }
+
+ apex_key {
+ name: "myapex.key",
+ public_key: "testkey.avbpubkey",
+ private_key: "testkey.pem",
+ }
+
+ cc_library {
+ name: "mylib",
+ srcs: ["mylib.cpp"],
+ shared_libs: ["libbar"],
+ min_sdk_version: "29",
+ apex_available: ["myapex"],
+ }
+
+ cc_library {
+ name: "libbar",
+ stubs: { versions: ["29", "30"] },
+ }
+
+ cc_library {
+ name: "yourlib",
+ srcs: ["mylib.cpp"],
+ min_sdk_version: "29",
+ apex_available: ["myapex", "myapex2", "//apex_available:platform"],
+ }
+ `, withFiles(android.MockFS{
+ "packages/modules/common/build/custom_allowed_deps.txt": nil,
+ "packages/modules/common/build/allowed_deps.txt": nil,
+ }),
+ android.FixtureModifyProductVariables(
+ func(variables android.FixtureProductVariables) {
+ variables.ExtraAllowedDepsTxt = proptools.StringPtr("packages/modules/common/build/custom_allowed_deps.txt")
+ },
+ ))
+
+ depsinfo := ctx.SingletonForTests("apex_depsinfo_singleton")
+ inputs := depsinfo.Rule("generateApexDepsInfoFilesRule").BuildParams.Inputs.Strings()
+ android.AssertStringListContains(t, "updatable myapex should generate depsinfo file", inputs,
+ "out/soong/.intermediates/myapex/android_common_myapex/depsinfo/flatlist.txt")
+ android.AssertStringListDoesNotContain(t, "non-updatable myapex2 should not generate depsinfo file", inputs,
+ "out/soong/.intermediates/myapex2/android_common_myapex2/depsinfo/flatlist.txt")
+
+ myapex := ctx.ModuleForTests("myapex", "android_common_myapex")
+ flatlist := strings.Split(android.ContentFromFileRuleForTests(t, ctx,
+ myapex.Output("depsinfo/flatlist.txt")), "\n")
+ android.AssertStringListContains(t, "deps with stubs should be tracked in depsinfo as external dep",
+ flatlist, "libbar(minSdkVersion:(no version)) (external)")
+ android.AssertStringListDoesNotContain(t, "do not track if not available for platform",
+ flatlist, "mylib:(minSdkVersion:29)")
+ android.AssertStringListContains(t, "track platform-available lib",
+ flatlist, "yourlib(minSdkVersion:29)")
+}
+
func TestTrackAllowedDeps_SkipWithoutAllowedDepsTxt(t *testing.T) {
ctx := testApex(t, `
apex {
@@ -7110,7 +7255,6 @@
module := ctx.ModuleForTests("myapex", "android_common_myapex")
args := module.Rule("apexRule").Args
ensureContains(t, args["opt_flags"], "--manifest_json "+module.Output("apex_manifest.json").Output.String())
- ensureNotContains(t, args["opt_flags"], "--no_hashtree")
// The copies of the libraries in the apex should have one more dependency than
// the ones outside the apex, namely the unwinder. Ideally we should check
diff --git a/apex/builder.go b/apex/builder.go
index 371d7d5..576f84f 100644
--- a/apex/builder.go
+++ b/apex/builder.go
@@ -790,18 +790,6 @@
implicitInputs = append(implicitInputs, noticeAssetPath)
optFlags = append(optFlags, "--assets_dir "+filepath.Dir(noticeAssetPath.String()))
- // Apexes which are supposed to be installed in builtin dirs(/system, etc)
- // don't need hashtree for activation. Therefore, by removing hashtree from
- // apex bundle (filesystem image in it, to be specific), we can save storage.
- needHashTree := moduleMinSdkVersion.LessThanOrEqualTo(android.SdkVersion_Android10) ||
- a.shouldGenerateHashtree()
- if ctx.Config().ApexCompressionEnabled() && a.isCompressable() {
- needHashTree = true
- }
- if !needHashTree {
- optFlags = append(optFlags, "--no_hashtree")
- }
-
if a.testOnlyShouldSkipPayloadSign() {
optFlags = append(optFlags, "--unsigned_payload")
}
diff --git a/java/testing.go b/java/testing.go
index 988514d..4615487 100644
--- a/java/testing.go
+++ b/java/testing.go
@@ -425,7 +425,6 @@
"kotlin-stdlib-jdk8",
"kotlin-annotations",
"stub-annotations",
-
"aconfig-annotations-lib",
"aconfig_storage_reader_java",
"unsupportedappusage",
diff --git a/scripts/gen_build_prop.py b/scripts/gen_build_prop.py
index c08a3fd..89e6f8d 100644
--- a/scripts/gen_build_prop.py
+++ b/scripts/gen_build_prop.py
@@ -196,6 +196,7 @@
print(f"ro.build.display.id?={config['BuildDesc']}")
print(f"ro.build.version.incremental={config['BuildNumber']}")
print(f"ro.build.version.sdk={config['Platform_sdk_version']}")
+ print(f"ro.build.version.sdk_minor={build_flags['RELEASE_PLATFORM_SDK_MINOR_VERSION']}")
print(f"ro.build.version.preview_sdk={config['Platform_preview_sdk_version']}")
print(f"ro.build.version.preview_sdk_fingerprint={config['PlatformPreviewSdkFingerprint']}")
print(f"ro.build.version.codename={config['Platform_sdk_codename']}")