Merge tag 'android-15.0.0_r5' of https://android.googlesource.com/platform/build/soong into HEAD
Android 15.0.0 release 5
Change-Id: I4fc9c5bff6036c2fa93cbd34754fa556e631ee7a
# -----BEGIN PGP SIGNATURE-----
#
# iF0EABECAB0WIQRDQNE1cO+UXoOBCWTorT+BmrEOeAUCZyvedAAKCRDorT+BmrEO
# eGCNAJ9S1zMW7cyYopsFM6XYz7cibgGdQgCfXEBNcr4Yo3B85gPVH6HSYe0xRR8=
# =ZTj6
# -----END PGP SIGNATURE-----
# gpg: Signature faite le mer 06 nov 2024 16:24:04 EST
# gpg: avec la clef DSA 4340D13570EF945E83810964E8AD3F819AB10E78
# gpg: Impossible de vérifier la signature : Pas de clef publique
diff --git a/android/namespace.go b/android/namespace.go
index ebf85a1..3b9ae3a 100644
--- a/android/namespace.go
+++ b/android/namespace.go
@@ -156,6 +156,9 @@
return fmt.Errorf("a namespace must be the first module in the file")
}
}
+ if (namespace.exportToKati) {
+ r.rootNamespace.visibleNamespaces = append(r.rootNamespace.visibleNamespaces, namespace)
+ }
r.sortedNamespaces.add(namespace)
r.namespacesByDir.Store(namespace.Path, namespace)
diff --git a/android/paths.go b/android/paths.go
index edc0700..1da9888 100644
--- a/android/paths.go
+++ b/android/paths.go
@@ -1145,6 +1145,31 @@
return ret, nil
}
+// pathForSourceRelaxed creates a SourcePath from pathComponents, but does not check that it exists.
+// It differs from pathForSource in that the path is allowed to exist outside of the PathContext.
+func pathForSourceRelaxed(ctx PathContext, pathComponents ...string) (SourcePath, error) {
+ p := filepath.Join(pathComponents...)
+ ret := SourcePath{basePath{p, ""}}
+
+ abs, err := filepath.Abs(ret.String())
+ if err != nil {
+ return ret, err
+ }
+ buildroot, err := filepath.Abs(ctx.Config().outDir)
+ if err != nil {
+ return ret, err
+ }
+ if strings.HasPrefix(abs, buildroot) {
+ return ret, fmt.Errorf("source path %s is in output", abs)
+ }
+
+ if pathtools.IsGlob(ret.String()) {
+ return ret, fmt.Errorf("path may not contain a glob: %s", ret.String())
+ }
+
+ return ret, nil
+}
+
// existsWithDependencies returns true if the path exists, and adds appropriate dependencies to rerun if the
// path does not exist.
func existsWithDependencies(ctx PathGlobContext, path SourcePath) (exists bool, err error) {
@@ -1215,6 +1240,31 @@
return path
}
+// PathForSourceRelaxed joins the provided path components. Unlike PathForSource,
+// the result is allowed to exist outside of the source dir.
+// On error, it will return a usable, but invalid SourcePath, and report a ModuleError.
+func PathForSourceRelaxed(ctx PathContext, pathComponents ...string) SourcePath {
+ path, err := pathForSourceRelaxed(ctx, pathComponents...)
+ if err != nil {
+ reportPathError(ctx, err)
+ }
+
+ if modCtx, ok := ctx.(ModuleMissingDepsPathContext); ok && ctx.Config().AllowMissingDependencies() {
+ exists, err := existsWithDependencies(modCtx, path)
+ if err != nil {
+ reportPathError(ctx, err)
+ }
+ if !exists {
+ modCtx.AddMissingDependencies([]string{path.String()})
+ }
+ } else if exists, _, err := ctx.Config().fs.Exists(path.String()); err != nil {
+ ReportPathErrorf(ctx, "%s: %s", path, err.Error())
+ } else if !exists {
+ ReportPathErrorf(ctx, "source path %s does not exist", path)
+ }
+ return path
+}
+
// ExistentPathForSource returns an OptionalPath with the SourcePath, rooted from SrcDir, *not*
// rooted from the module's local source directory, if the path exists, or an empty OptionalPath if
// it doesn't exist. Dependencies are added so that the ninja file will be regenerated if the state
@@ -1970,7 +2020,7 @@
}
path := filepath.Clean(path)
- if path == ".." || strings.HasPrefix(path, "../") || strings.HasPrefix(path, "/") {
+ if path == ".." || strings.HasPrefix(path, "../") || i != initialEmpty && strings.HasPrefix(path, "/") {
return "", fmt.Errorf("Path is outside directory: %s", path)
}
diff --git a/androidmk/androidmk/android.go b/androidmk/androidmk/android.go
index 8a8bb2e..304a37f 100644
--- a/androidmk/androidmk/android.go
+++ b/androidmk/androidmk/android.go
@@ -783,6 +783,13 @@
return fmt.Errorf("Currently LOCAL_PROTOC_FLAGS only support with value '--proto_path=$(LOCAL_PATH)/...'")
}
+func exportCflags(ctx variableAssignmentContext) error {
+ // The Soong replacement for EXPORT_CFLAGS doesn't need the same extra escaped quotes that were present in Make
+ ctx.mkvalue = ctx.mkvalue.Clone()
+ ctx.mkvalue.ReplaceLiteral(`\"`, `"`)
+ return includeVariableNow(bpVariable{"export_cflags", bpparser.ListType}, ctx)
+}
+
func proguardEnabled(ctx variableAssignmentContext) error {
val, err := makeVariableToBlueprint(ctx.file, ctx.mkvalue, bpparser.ListType)
if err != nil {
diff --git a/cc/cc.go b/cc/cc.go
index df0aa6d..7ea726e 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -2468,6 +2468,23 @@
variantNdkLibs := []string{}
variantLateNdkLibs := []string{}
if ctx.Os() == android.Android {
+ rewriteHeaderLibs := func(list []string) (newHeaderLibs []string) {
+ newHeaderLibs = []string{}
+ for _, entry := range list {
+ // Replace device_kernel_headers with generated_kernel_headers
+ // for inline kernel building
+ if entry == "device_kernel_headers" || entry == "qti_kernel_headers" {
+ if (ctx.Config().Getenv("INLINE_KERNEL_BUILDING") == "true") {
+ newHeaderLibs = append(newHeaderLibs, "generated_kernel_headers")
+ continue
+ }
+ }
+ newHeaderLibs = append(newHeaderLibs, entry)
+ }
+ return newHeaderLibs
+ }
+ deps.HeaderLibs = rewriteHeaderLibs(deps.HeaderLibs)
+
deps.SharedLibs, variantNdkLibs = FilterNdkLibs(c, ctx.Config(), deps.SharedLibs)
deps.LateSharedLibs, variantLateNdkLibs = FilterNdkLibs(c, ctx.Config(), deps.LateSharedLibs)
deps.ReexportSharedLibHeaders, _ = FilterNdkLibs(c, ctx.Config(), deps.ReexportSharedLibHeaders)
diff --git a/cc/library.go b/cc/library.go
index e49f50c..2aea33c 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -196,6 +196,9 @@
// using -isystem for this module and any module that links against this module.
Export_system_include_dirs []string `android:"arch_variant,variant_prepend"`
+ // list of plain cc flags to be used for any module that links against this module.
+ Export_cflags []string `android:"arch_variant"`
+
Target struct {
Vendor, Product struct {
// list of exported include directories, like
@@ -306,6 +309,10 @@
f.systemDirs = append(f.systemDirs, android.PathsForModuleSrc(ctx, f.Properties.Export_system_include_dirs)...)
}
+func (f *flagExporter) exportExtraFlags(ctx ModuleContext) {
+ f.flags = append(f.flags, f.Properties.Export_cflags...)
+}
+
// exportIncludesAsSystem registers the include directories and system include directories to be
// exported transitively both as system include directories to modules depending on this module.
func (f *flagExporter) exportIncludesAsSystem(ctx ModuleContext) {
@@ -1630,6 +1637,7 @@
// Export include paths and flags to be propagated up the tree.
library.exportIncludes(ctx)
+ library.exportExtraFlags(ctx)
library.reexportDirs(deps.ReexportedDirs...)
library.reexportSystemDirs(deps.ReexportedSystemDirs...)
library.reexportFlags(deps.ReexportedFlags...)
diff --git a/java/aar.go b/java/aar.go
index 07392f6..4691d70 100644
--- a/java/aar.go
+++ b/java/aar.go
@@ -315,7 +315,7 @@
if !hasVersionName {
var versionName string
- if ctx.ModuleName() == "framework-res" {
+ if ctx.ModuleName() == "framework-res" || ctx.ModuleName() == "omnirom-res" {
// Some builds set AppsDefaultVersionName() to include the build number ("O-123456"). aapt2 copies the
// version name of framework-res into app manifests as compileSdkVersionCodename, which confuses things
// if it contains the build number. Use the PlatformVersionName instead.
@@ -340,6 +340,9 @@
if sdkDep.frameworkResModule != "" {
ctx.AddVariationDependencies(nil, frameworkResTag, sdkDep.frameworkResModule)
}
+ if sdkDep.omniromResModule != "" {
+ ctx.AddVariationDependencies(nil, omniromResTag, sdkDep.omniromResModule)
+ }
}
var extractAssetsRule = pctx.AndroidStaticRule("extractAssets",
@@ -745,7 +748,7 @@
sharedResourcesNodeDepSets = append(sharedResourcesNodeDepSets, aarDep.ResourcesNodeDepSet())
sharedLibs = append(sharedLibs, exportPackage)
}
- case frameworkResTag:
+ case frameworkResTag, omniromResTag:
if exportPackage != nil {
sharedLibs = append(sharedLibs, exportPackage)
}
@@ -1103,6 +1106,9 @@
if sdkDep.useModule && sdkDep.frameworkResModule != "" {
ctx.AddVariationDependencies(nil, frameworkResTag, sdkDep.frameworkResModule)
}
+ if sdkDep.useModule && sdkDep.omniromResModule != "" {
+ ctx.AddVariationDependencies(nil, omniromResTag, sdkDep.omniromResModule)
+ }
}
ctx.AddVariationDependencies(nil, libTag, a.properties.Libs...)
diff --git a/java/android_manifest.go b/java/android_manifest.go
index 8599003..fdbe43b 100644
--- a/java/android_manifest.go
+++ b/java/android_manifest.go
@@ -153,7 +153,7 @@
targetSdkVersion := targetSdkVersionForManifestFixer(ctx, params)
if useApiFingerprint, fingerprintTargetSdkVersion, fingerprintDeps :=
- UseApiFingerprint(ctx); useApiFingerprint && ctx.ModuleName() != "framework-res" {
+ UseApiFingerprint(ctx); useApiFingerprint && ctx.ModuleName() != "framework-res" && ctx.ModuleName() != "omnirom-res" {
targetSdkVersion = fingerprintTargetSdkVersion
deps = append(deps, fingerprintDeps)
}
@@ -171,7 +171,7 @@
}
if useApiFingerprint, fingerprintMinSdkVersion, fingerprintDeps :=
- UseApiFingerprint(ctx); useApiFingerprint && ctx.ModuleName() != "framework-res" {
+ UseApiFingerprint(ctx); useApiFingerprint && ctx.ModuleName() != "framework-res" && ctx.ModuleName() != "omnirom-res" {
minSdkVersion = fingerprintMinSdkVersion
deps = append(deps, fingerprintDeps)
}
diff --git a/java/androidmk.go b/java/androidmk.go
index a1bc904..b050445 100644
--- a/java/androidmk.go
+++ b/java/androidmk.go
@@ -368,7 +368,7 @@
entries.SetOptionalPath("LOCAL_SOONG_PROGUARD_DICT", app.dexer.proguardDictionary)
entries.SetOptionalPath("LOCAL_SOONG_PROGUARD_USAGE_ZIP", app.dexer.proguardUsageZip)
- if app.Name() == "framework-res" {
+ if app.Name() == "framework-res" || app.Name() == "omnirom-res" {
entries.SetString("LOCAL_MODULE_PATH", "$(TARGET_OUT_JAVA_LIBRARIES)")
// Make base_rules.mk not put framework-res in a subdirectory called
// framework_res.
@@ -500,7 +500,7 @@
entries.SetPath("LOCAL_SOONG_AAR", a.aarFile)
}
- if a.Name() == "framework-res" {
+ if a.Name() == "framework-res" || a.Name() == "omnirom-res" {
entries.SetString("LOCAL_MODULE_PATH", "$(TARGET_OUT_JAVA_LIBRARIES)")
// Make base_rules.mk not put framework-res in a subdirectory called
// framework_res.
diff --git a/java/app.go b/java/app.go
index 8a466e9..fe98a7f 100644
--- a/java/app.go
+++ b/java/app.go
@@ -592,6 +592,9 @@
if ctx.ModuleName() == "framework-res" {
// framework-res.apk is installed as system/framework/framework-res.apk
installDir = "framework"
+ } else if ctx.ModuleName() == "omnirom-res" {
+ // omnirom-res.apk is installed as system/framework/omnirom-res.apk
+ installDir = "framework"
} else if a.Privileged() {
installDir = filepath.Join("priv-app", a.installApkName)
} else {
@@ -616,7 +619,7 @@
var packageResources = a.exportPackage
- if ctx.ModuleName() != "framework-res" {
+ if ctx.ModuleName() != "framework-res" && ctx.ModuleName() != "omnirom-res" {
if a.dexProperties.resourceShrinkingEnabled(ctx) {
protoFile := android.PathForModuleOut(ctx, packageResources.Base()+".proto.apk")
aapt2Convert(ctx, protoFile, packageResources, "proto")
@@ -805,6 +808,9 @@
if ctx.ModuleName() == "framework-res" {
// framework-res.apk is installed as system/framework/framework-res.apk
a.installDir = android.PathForModuleInstall(ctx, "framework")
+ } else if ctx.ModuleName() == "omnirom-res" {
+ // omnirom-res.apk is installed as system/framework/omnirom-res.apk
+ a.installDir = android.PathForModuleInstall(ctx, "framework")
} else if a.Privileged() {
a.installDir = android.PathForModuleInstall(ctx, "priv-app", a.installApkName)
} else if ctx.InstallInTestcases() {
diff --git a/java/app_test.go b/java/app_test.go
index e5c318e..c15980e 100644
--- a/java/app_test.go
+++ b/java/app_test.go
@@ -77,8 +77,11 @@
expectedLinkImplicits = append(expectedLinkImplicits, manifestFixer.Output.String())
frameworkRes := result.ModuleForTests("framework-res", "android_common")
+ omniromRes := result.ModuleForTests("omnirom-res", "android_common")
expectedLinkImplicits = append(expectedLinkImplicits,
frameworkRes.Output("package-res.apk").Output.String())
+ expectedLinkImplicits = append(expectedLinkImplicits,
+ omniromRes.Output("package-res.apk").Output.String())
// Test the mapping from input files to compiled output file names
compile := foo.Output(compiledResourceFiles[0])
diff --git a/java/java.go b/java/java.go
index 08fb678..8899ba4 100644
--- a/java/java.go
+++ b/java/java.go
@@ -421,6 +421,7 @@
bootClasspathTag = dependencyTag{name: "bootclasspath", runtimeLinked: true}
systemModulesTag = dependencyTag{name: "system modules", runtimeLinked: true}
frameworkResTag = dependencyTag{name: "framework-res"}
+ omniromResTag = dependencyTag{name: "omnirom-res"}
kotlinStdlibTag = dependencyTag{name: "kotlin-stdlib", runtimeLinked: true}
kotlinAnnotationsTag = dependencyTag{name: "kotlin-annotations", runtimeLinked: true}
kotlinPluginTag = dependencyTag{name: "kotlin-plugin", toolchain: true}
@@ -469,6 +470,7 @@
java9Classpath []string
frameworkResModule string
+ omniromResModule string
jars android.Paths
aidl android.OptionalPath
@@ -512,6 +514,10 @@
if sdkDep.systemModules != "" {
ctx.AddVariationDependencies(nil, systemModulesTag, sdkDep.systemModules)
}
+
+ if ctx.ModuleName() == "omnirom-res" {
+ ctx.AddVariationDependencies(nil, frameworkResTag, "framework-res")
+ }
}
type deps struct {
diff --git a/java/sdk.go b/java/sdk.go
index 4ef4ee2..72184cf 100644
--- a/java/sdk.go
+++ b/java/sdk.go
@@ -168,6 +168,7 @@
systemModules: systemModules,
java9Classpath: []string{module},
frameworkResModule: "framework-res",
+ omniromResModule: "omnirom-res",
aidl: android.OptionalPathForPath(aidl),
}
}
@@ -180,6 +181,7 @@
bootclasspath: corePlatformBootclasspathLibraries(ctx),
classpath: config.FrameworkLibraries,
frameworkResModule: "framework-res",
+ omniromResModule: "omnirom-res",
}
case android.SdkNone:
systemModules := sdkContext.SystemModules()
diff --git a/java/testing.go b/java/testing.go
index 5ae326d..20152fd 100644
--- a/java/testing.go
+++ b/java/testing.go
@@ -546,6 +546,11 @@
android_app {
name: "framework-res",
sdk_version: "core_platform",
+ }
+
+ android_app {
+ name: "omnirom-res",
+ sdk_version: "core_platform",
}`
systemModules := []string{
diff --git a/scripts/check_boot_jars/package_allowed_list.txt b/scripts/check_boot_jars/package_allowed_list.txt
index 47eae07..6dae3ff 100644
--- a/scripts/check_boot_jars/package_allowed_list.txt
+++ b/scripts/check_boot_jars/package_allowed_list.txt
@@ -258,3 +258,8 @@
# Packages used for Android in Chrome OS
org\.chromium\.arc
org\.chromium\.arc\..*
+
+# OmniROM adds
+omnirom\.platform
+org\.omnirom\.omnilib
+org\.omnirom\.omnilib\..*
diff --git a/ui/build/cleanbuild.go b/ui/build/cleanbuild.go
index 41cb5ab..46e38c9 100644
--- a/ui/build/cleanbuild.go
+++ b/ui/build/cleanbuild.go
@@ -125,6 +125,7 @@
hostCommonOut("obj/PACKAGING"),
productOut("*.img"),
productOut("*.zip"),
+ productOut("*.zip.md5sum"),
productOut("android-info.txt"),
productOut("misc_info.txt"),
productOut("apex"),
diff --git a/ui/build/dumpvars.go b/ui/build/dumpvars.go
index eba86a0..3d43786 100644
--- a/ui/build/dumpvars.go
+++ b/ui/build/dumpvars.go
@@ -164,6 +164,7 @@
"BUILD_ID",
"OUT_DIR",
"SOONG_SDK_SNAPSHOT_TARGET_BUILD_RELEASE",
+ "ROM_BUILDTYPE",
}
func Banner(make_vars map[string]string) string {
diff --git a/ui/build/paths/config.go b/ui/build/paths/config.go
index 81c678d..6c25680 100644
--- a/ui/build/paths/config.go
+++ b/ui/build/paths/config.go
@@ -108,6 +108,8 @@
"tr": Allowed,
"unzip": Allowed,
"zip": Allowed,
+ "nproc": Allowed,
+ "perl": Allowed,
// Host toolchain is removed. In-tree toolchain should be used instead.
// GCC also can't find cc1 with this implementation.
diff --git a/ui/build/sandbox_linux.go b/ui/build/sandbox_linux.go
index edb3b66..386dc55 100644
--- a/ui/build/sandbox_linux.go
+++ b/ui/build/sandbox_linux.go
@@ -228,6 +228,10 @@
sandboxArgs = append(sandboxArgs, "-N")
}
+ if ccacheDir := os.Getenv("CCACHE_DIR"); ccacheDir != "" {
+ sandboxArgs = append(sandboxArgs, "-B", ccacheDir)
+ }
+
// Stop nsjail from parsing arguments
sandboxArgs = append(sandboxArgs, "--")