Merge "Update the minimum macos deployment version to 10.14" into main
diff --git a/android/config.go b/android/config.go
index 213fa2f..4c31bb0 100644
--- a/android/config.go
+++ b/android/config.go
@@ -2124,3 +2124,8 @@
func (c *deviceConfig) HideFlaggedApis() bool {
return c.NextReleaseHideFlaggedApi() && !c.ReleaseExposeFlaggedApi()
}
+
+func (c *config) GetBuildFlag(name string) (string, bool) {
+ val, ok := c.productVariables.BuildFlags[name]
+ return val, ok
+}
diff --git a/android/util.go b/android/util.go
index 5375373..f687bca 100644
--- a/android/util.go
+++ b/android/util.go
@@ -61,17 +61,39 @@
// JoinWithPrefixAndSeparator prepends the prefix to each string in the list and
// returns them joined together with the given separator.
func JoinWithPrefixAndSeparator(strs []string, prefix string, sep string) string {
+ return JoinWithPrefixSuffixAndSeparator(strs, prefix, "", sep)
+}
+
+// JoinWithSuffixAndSeparator appends the suffix to each string in the list and
+// returns them joined together with the given separator.
+func JoinWithSuffixAndSeparator(strs []string, suffix string, sep string) string {
+ return JoinWithPrefixSuffixAndSeparator(strs, "", suffix, sep)
+}
+
+// JoinWithPrefixSuffixAndSeparator appends the prefix/suffix to each string in the list and
+// returns them joined together with the given separator.
+func JoinWithPrefixSuffixAndSeparator(strs []string, prefix, suffix, sep string) string {
if len(strs) == 0 {
return ""
}
+ // Pre-calculate the length of the result
+ length := 0
+ for _, s := range strs {
+ length += len(s)
+ }
+ length += (len(prefix)+len(suffix))*len(strs) + len(sep)*(len(strs)-1)
+
var buf strings.Builder
+ buf.Grow(length)
buf.WriteString(prefix)
buf.WriteString(strs[0])
+ buf.WriteString(suffix)
for i := 1; i < len(strs); i++ {
buf.WriteString(sep)
buf.WriteString(prefix)
buf.WriteString(strs[i])
+ buf.WriteString(suffix)
}
return buf.String()
}
diff --git a/android/variable.go b/android/variable.go
index 9896f20..648e4cf 100644
--- a/android/variable.go
+++ b/android/variable.go
@@ -492,6 +492,8 @@
NextReleaseHideFlaggedApi *bool `json:",omitempty"`
Release_expose_flagged_api *bool `json:",omitempty"`
+
+ BuildFlags map[string]string `json:",omitempty"`
}
type PartitionQualifiedVariablesType struct {
diff --git a/apex/apex_test.go b/apex/apex_test.go
index e6581cf..ddb9a40 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -5459,7 +5459,7 @@
checkBootDexJarPath := func(t *testing.T, ctx *android.TestContext, stem string, bootDexJarPath string) {
t.Helper()
- s := ctx.ModuleForTests("platform-bootclasspath", "android_common")
+ s := ctx.ModuleForTests("dex_bootjars", "android_common")
foundLibfooJar := false
base := stem + ".jar"
for _, output := range s.AllOutputs() {
@@ -5909,8 +5909,8 @@
`
ctx := testDexpreoptWithApexes(t, bp, "", preparer, fragment)
- checkBootDexJarPath(t, ctx, "libfoo", "out/soong/.intermediates/libfoo/android_common_apex10000/hiddenapi/libfoo.jar")
- checkBootDexJarPath(t, ctx, "libbar", "out/soong/.intermediates/libbar/android_common_myapex/hiddenapi/libbar.jar")
+ checkBootDexJarPath(t, ctx, "libfoo", "out/soong/.intermediates/my-bootclasspath-fragment/android_common_myapex/hiddenapi-modular/encoded/libfoo.jar")
+ checkBootDexJarPath(t, ctx, "libbar", "out/soong/.intermediates/my-bootclasspath-fragment/android_common_myapex/hiddenapi-modular/encoded/libbar.jar")
// Verify the correct module jars contribute to the hiddenapi index file.
checkHiddenAPIIndexFromClassesInputs(t, ctx, ``)
diff --git a/apex/builder.go b/apex/builder.go
index d75cc1d..afbfa1c 100644
--- a/apex/builder.go
+++ b/apex/builder.go
@@ -75,9 +75,11 @@
pctx.HostBinToolVariable("apex_sepolicy_tests", "apex_sepolicy_tests")
pctx.HostBinToolVariable("deapexer", "deapexer")
pctx.HostBinToolVariable("debugfs_static", "debugfs_static")
+ pctx.HostBinToolVariable("fsck_erofs", "fsck.erofs")
pctx.SourcePathVariable("genNdkUsedbyApexPath", "build/soong/scripts/gen_ndk_usedby_apex.sh")
pctx.HostBinToolVariable("conv_linker_config", "conv_linker_config")
pctx.HostBinToolVariable("assemble_vintf", "assemble_vintf")
+ pctx.HostBinToolVariable("apex_elf_checker", "apex_elf_checker")
}
var (
@@ -237,6 +239,12 @@
CommandDeps: []string{"${assemble_vintf}"},
Description: "run assemble_vintf",
})
+
+ apexElfCheckerUnwantedRule = pctx.StaticRule("apexElfCheckerUnwantedRule", blueprint.RuleParams{
+ Command: `${apex_elf_checker} --tool_path ${tool_path} --unwanted ${unwanted} ${in} && touch ${out}`,
+ CommandDeps: []string{"${apex_elf_checker}", "${deapexer}", "${debugfs_static}", "${fsck_erofs}", "${config.ClangBin}/llvm-readelf"},
+ Description: "run apex_elf_checker --unwanted",
+ }, "tool_path", "unwanted")
)
// buildManifest creates buile rules to modify the input apex_manifest.json to add information
@@ -886,6 +894,10 @@
if suffix == imageApexSuffix && ext4 == a.payloadFsType {
validations = append(validations, runApexSepolicyTests(ctx, unsignedOutputFile.OutputPath))
}
+ if !a.testApex && len(a.properties.Unwanted_transitive_deps) > 0 {
+ validations = append(validations,
+ runApexElfCheckerUnwanted(ctx, unsignedOutputFile.OutputPath, a.properties.Unwanted_transitive_deps))
+ }
ctx.Build(pctx, android.BuildParams{
Rule: rule,
Description: "signapk",
@@ -1164,3 +1176,17 @@
})
return timestamp
}
+
+func runApexElfCheckerUnwanted(ctx android.ModuleContext, apexFile android.OutputPath, unwanted []string) android.Path {
+ timestamp := android.PathForModuleOut(ctx, "apex_elf_unwanted.timestamp")
+ ctx.Build(pctx, android.BuildParams{
+ Rule: apexElfCheckerUnwantedRule,
+ Input: apexFile,
+ Output: timestamp,
+ Args: map[string]string{
+ "unwanted": android.JoinWithSuffixAndSeparator(unwanted, ".so", ":"),
+ "tool_path": ctx.Config().HostToolPath(ctx, "").String() + ":${config.ClangBin}",
+ },
+ })
+ return timestamp
+}
diff --git a/cc/config/global.go b/cc/config/global.go
index 892a86c..2ca9df9 100644
--- a/cc/config/global.go
+++ b/cc/config/global.go
@@ -174,9 +174,6 @@
"-Werror=format-security",
"-nostdlibinc",
- // Enable MLGO for register allocation.
- "-mllvm -regalloc-enable-advisor=release",
-
// Emit additional debug info for AutoFDO
"-fdebug-info-for-profiling",
}
@@ -205,8 +202,6 @@
"-Wl,--exclude-libs,libgcc_stripped.a",
"-Wl,--exclude-libs,libunwind_llvm.a",
"-Wl,--exclude-libs,libunwind.a",
- // Enable MLGO for register allocation.
- "-Wl,-mllvm,-regalloc-enable-advisor=release",
}
deviceGlobalLldflags = append(append(deviceGlobalLdflags, commonGlobalLldflags...),
diff --git a/cc/lto.go b/cc/lto.go
index 20e4f24..fb3b485 100644
--- a/cc/lto.go
+++ b/cc/lto.go
@@ -147,10 +147,15 @@
}
}
- // For ML training
- if ctx.Config().IsEnvTrue("THINLTO_EMIT_INDEXES_AND_IMPORTS") {
- ltoLdFlags = append(ltoLdFlags, "-Wl,--save-temps=import")
- ltoLdFlags = append(ltoLdFlags, "-Wl,--thinlto-emit-index-files")
+ // Register allocation MLGO flags for ARM64.
+ if ctx.Arch().ArchType == android.Arm64 {
+ ltoCFlags = append(ltoCFlags, "-mllvm -regalloc-enable-advisor=release")
+ ltoLdFlags = append(ltoLdFlags, "-Wl,-mllvm,-regalloc-enable-advisor=release")
+ // Flags for training MLGO model.
+ if ctx.Config().IsEnvTrue("THINLTO_EMIT_INDEXES_AND_IMPORTS") {
+ ltoLdFlags = append(ltoLdFlags, "-Wl,--save-temps=import")
+ ltoLdFlags = append(ltoLdFlags, "-Wl,--thinlto-emit-index-files")
+ }
}
flags.Local.CFlags = append(flags.Local.CFlags, ltoCFlags...)
diff --git a/java/config/droidstubs.go b/java/config/droidstubs.go
index 59cee1d..b7aab5a 100644
--- a/java/config/droidstubs.go
+++ b/java/config/droidstubs.go
@@ -24,8 +24,6 @@
"--repeat-errors-max 10",
"--hide UnresolvedImport",
"--hide InvalidNullabilityOverride",
- // b/223382732
- "--hide ChangedDefault",
// Force metalava to ignore classes on the classpath when an API file contains missing classes.
// See b/285140653 for more information.
@@ -54,8 +52,6 @@
"--hide AnnotationExtraction",
// b/222738070
"--hide BannedThrow",
- // b/223382732
- "--hide ChangedDefault",
}
MetalavaAnnotationsWarningsFlags = strings.Join(metalavaAnnotationsWarningsFlags, " ")
diff --git a/java/dexpreopt_config.go b/java/dexpreopt_config.go
index 29551ef..2bd696c 100644
--- a/java/dexpreopt_config.go
+++ b/java/dexpreopt_config.go
@@ -210,57 +210,18 @@
return false
}
-// Apex boot config allows to access build/install paths of apex boot jars without going
-// through the usual trouble of registering dependencies on those modules and extracting build paths
-// from those dependencies.
-type apexBootConfig struct {
- // A list of apex boot jars.
- modules android.ConfiguredJarList
-
- // A list of predefined build paths to apex boot jars. They are configured very early,
- // before the modules for these jars are processed and the actual paths are generated, and
- // later on a singleton adds commands to copy actual jars to the predefined paths.
- dexPaths android.WritablePaths
-
- // Map from module name (without prebuilt_ prefix) to the predefined build path.
- dexPathsByModule map[string]android.WritablePath
-
- // A list of dex locations (a.k.a. on-device paths) to the boot jars.
- dexLocations []string
-}
-
-var updatableBootConfigKey = android.NewOnceKey("apexBootConfig")
-
-// Returns apex boot config.
-func GetApexBootConfig(ctx android.PathContext) apexBootConfig {
- return ctx.Config().Once(updatableBootConfigKey, func() interface{} {
- apexBootJars := dexpreopt.GetGlobalConfig(ctx).ApexBootJars
- dir := android.PathForOutput(ctx, getDexpreoptDirName(ctx), "apex_bootjars")
- dexPaths := apexBootJars.BuildPaths(ctx, dir)
- dexPathsByModuleName := apexBootJars.BuildPathsByModule(ctx, dir)
-
- dexLocations := apexBootJars.DevicePaths(ctx.Config(), android.Android)
-
- return apexBootConfig{apexBootJars, dexPaths, dexPathsByModuleName, dexLocations}
- }).(apexBootConfig)
-}
-
// Returns a list of paths and a list of locations for the boot jars used in dexpreopt (to be
// passed in -Xbootclasspath and -Xbootclasspath-locations arguments for dex2oat).
func bcpForDexpreopt(ctx android.PathContext, withUpdatable bool) (android.WritablePaths, []string) {
- // Non-updatable boot jars (they are used both in the boot image and in dexpreopt).
bootImage := defaultBootImageConfig(ctx)
+ if withUpdatable {
+ bootImage = mainlineBootImageConfig(ctx)
+ }
+
dexPaths := bootImage.dexPathsDeps
// The dex locations for all Android variants are identical.
dexLocations := bootImage.getAnyAndroidVariant().dexLocationsDeps
- if withUpdatable {
- // Apex boot jars (they are used only in dexpreopt, but not in the boot image).
- apexBootConfig := GetApexBootConfig(ctx)
- dexPaths = append(dexPaths, apexBootConfig.dexPaths...)
- dexLocations = append(dexLocations, apexBootConfig.dexLocations...)
- }
-
return dexPaths, dexLocations
}
diff --git a/java/platform_bootclasspath.go b/java/platform_bootclasspath.go
index 02a2298..0d52614 100644
--- a/java/platform_bootclasspath.go
+++ b/java/platform_bootclasspath.go
@@ -202,8 +202,6 @@
bootDexJarByModule := b.generateHiddenAPIBuildActions(ctx, b.configuredModules, b.fragments)
buildRuleForBootJarsPackageCheck(ctx, bootDexJarByModule)
-
- b.copyApexBootJarsForAppsDexpreopt(ctx, apexModules)
}
// Generate classpaths.proto config
@@ -415,10 +413,3 @@
// INTERNAL_PLATFORM_HIDDENAPI_FLAGS is used by Make rules in art/ and cts/.
ctx.Strict("INTERNAL_PLATFORM_HIDDENAPI_FLAGS", b.hiddenAPIFlagsCSV.String())
}
-
-// Copy apex module dex jars to their predefined locations. They will be used for dexpreopt for apps.
-func (b *platformBootclasspathModule) copyApexBootJarsForAppsDexpreopt(ctx android.ModuleContext, apexModules []android.Module) {
- config := GetApexBootConfig(ctx)
- apexBootDexJarsByModule := extractEncodedDexJarsFromModules(ctx, apexModules)
- copyBootJarsToPredefinedLocations(ctx, apexBootDexJarsByModule, config.dexPathsByModule)
-}