soong: Squash of lineage-sdk bringup commits
Squash of:
Author: Rashed Abdel-Tawab <rashed@linux.com>
Date: Thu Aug 9 14:08:53 2018 -0700
soong: Special case Lineage SDK
* org.lineageos.platform-res.apk needs to be installed to /system/framework
* org.lineageos.platform-res needs to be a dependency for
org.lineageos.platform and org.lineageos.platform.internal
* Add other special exceptions for org.lineageos.platform-res
Change-Id: Ic617c07c086916005ea4b88f26d31c61691a45f8
Author: Sam Mortimer <sam@mortimer.me.uk>
Date: Thu Aug 30 15:33:16 2018 -0700
soong: make org.lineage.platform-res depend on framework-res
*) Allows us to build org.lineage.platform-res with no_framework_libs
true (as is done for framework-res).
*) Whilst we're here, undo a dependency loop prevention in aar.go
that we added during sdk bringup to allow our platform res to build
with no_framework_libs false.
Change-Id: Ib452a2e45112baf5d61b70b4be1ce0c01dfd84e5
Author: Luca Stefani <luca.stefani.ge1@gmail.com>
Date: Mon Feb 4 18:56:52 2019 +0100
Always link org.lineageos.platform-res for org.lineageos.platform.sdk
Test: m clean && m org.lineageos.platform.sdk
Change-Id: I58956855bd4d1157e2582103c4861e7b384b4f73
Author: Sam Mortimer <sam@mortimer.me.uk>
Date: Fri Aug 31 10:52:29 2018 -0700
soong: Allow framework to access lineage-sdk resources
*) Make framework depend on lineage-sdk resource package
*) Allows framework module to access lineage-sdk resources
via usual org.lineageos.platform.internal.R paths.
Change-Id: Ifd19d43d9308ac370ad40a499de16bf8ce204beb
Author: Luca Stefani <luca.stefani.ge1@gmail.com>
Date: Tue Oct 12 17:59:21 2021 +0200
Don't manually add lineage res to apps
Only exception left is the hard dep of framework-res
into org.lineage.platform-res
Change-Id: I02585a6581da75a442b2967c89a51929d4778ea4
Author: Luca Stefani <luca.stefani.ge1@gmail.com>
Date: Tue Oct 12 17:58:56 2021 +0200
Make lineage res module support variation deps
Change-Id: I823ccc87c3716bb3eb73948e228d90d45c1c29c9
Change-Id: Icc18de5dfaa83fc0a1eda6f3704f3a92e1de0764
diff --git a/java/aar.go b/java/aar.go
index 00ff7e7..4e31e68 100644
--- a/java/aar.go
+++ b/java/aar.go
@@ -233,7 +233,7 @@
if !hasVersionName {
var versionName string
- if ctx.ModuleName() == "framework-res" {
+ if ctx.ModuleName() == "framework-res" || ctx.ModuleName() == "org.lineageos.platform-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.
@@ -258,6 +258,9 @@
if sdkDep.frameworkResModule != "" {
ctx.AddVariationDependencies(nil, frameworkResTag, sdkDep.frameworkResModule)
}
+ if sdkDep.lineageResModule != "" {
+ ctx.AddVariationDependencies(nil, lineageResTag, sdkDep.lineageResModule)
+ }
}
var extractAssetsRule = pctx.AndroidStaticRule("extractAssets",
@@ -440,7 +443,7 @@
if exportPackage != nil {
sharedLibs = append(sharedLibs, exportPackage)
}
- case frameworkResTag:
+ case frameworkResTag, lineageResTag:
if exportPackage != nil {
sharedLibs = append(sharedLibs, exportPackage)
}
@@ -741,6 +744,9 @@
if sdkDep.useModule && sdkDep.frameworkResModule != "" {
ctx.AddVariationDependencies(nil, frameworkResTag, sdkDep.frameworkResModule)
}
+ if sdkDep.useModule && sdkDep.lineageResModule != "" {
+ ctx.AddVariationDependencies(nil, lineageResTag, sdkDep.lineageResModule)
+ }
}
ctx.AddVariationDependencies(nil, libTag, a.properties.Libs...)
diff --git a/java/android_manifest.go b/java/android_manifest.go
index 7772b70..fb6e984 100644
--- a/java/android_manifest.go
+++ b/java/android_manifest.go
@@ -126,7 +126,7 @@
targetSdkVersion := targetSdkVersionForManifestFixer(ctx, params.SdkContext)
args = append(args, "--targetSdkVersion ", targetSdkVersion)
- if UseApiFingerprint(ctx) && ctx.ModuleName() != "framework-res" {
+ if UseApiFingerprint(ctx) && ctx.ModuleName() != "framework-res" && ctx.ModuleName() != "org.lineageos.platform-res" {
targetSdkVersion = ctx.Config().PlatformSdkCodename() + fmt.Sprintf(".$$(cat %s)", ApiFingerprintPath(ctx).String())
deps = append(deps, ApiFingerprintPath(ctx))
}
@@ -136,7 +136,7 @@
ctx.ModuleErrorf("invalid minSdkVersion: %s", err)
}
- if UseApiFingerprint(ctx) && ctx.ModuleName() != "framework-res" {
+ if UseApiFingerprint(ctx) && ctx.ModuleName() != "framework-res" && ctx.ModuleName() != "org.lineageos.platform-res" {
minSdkVersion = ctx.Config().PlatformSdkCodename() + fmt.Sprintf(".$$(cat %s)", ApiFingerprintPath(ctx).String())
deps = append(deps, ApiFingerprintPath(ctx))
}
diff --git a/java/androidmk.go b/java/androidmk.go
index 7322637..49ca176 100644
--- a/java/androidmk.go
+++ b/java/androidmk.go
@@ -347,7 +347,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() == "org.lineageos.platform-res" {
entries.SetString("LOCAL_MODULE_PATH", "$(TARGET_OUT_JAVA_LIBRARIES)")
// Make base_rules.mk not put framework-res in a subdirectory called
// framework_res.
@@ -475,7 +475,7 @@
entries.SetPath("LOCAL_SOONG_AAR", a.aarFile)
}
- if a.Name() == "framework-res" {
+ if a.Name() == "framework-res" || a.Name() == "org.lineageos.platform-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 41419ba..b46f2b1 100755
--- a/java/app.go
+++ b/java/app.go
@@ -449,6 +449,9 @@
if ctx.ModuleName() == "framework-res" {
// framework-res.apk is installed as system/framework/framework-res.apk
installDir = "framework"
+ } else if ctx.ModuleName() == "org.lineageos.platform-res" {
+ // org.lineageos.platform-res.apk is installed as system/framework/org.lineageos.platform-res.apk
+ installDir = "framework"
} else if a.Privileged() {
installDir = filepath.Join("priv-app", a.installApkName)
} else {
@@ -471,7 +474,7 @@
a.dexpreopter.manifestFile = a.mergedManifestFile
a.dexpreopter.preventInstall = a.appProperties.PreventInstall
- if ctx.ModuleName() != "framework-res" {
+ if ctx.ModuleName() != "framework-res" && ctx.ModuleName() != "org.lineageos.platform-res" {
a.Module.compile(ctx, a.aaptSrcJar)
}
@@ -578,6 +581,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() == "org.lineageos.platform-res" {
+ // org.lineageos.platform-res.apk is installed as system/framework/org.lineageos.platform-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 8e331d4..239bd52 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")
+ lineageRes := result.ModuleForTests("org.lineageos.platform-res", "android_common")
expectedLinkImplicits = append(expectedLinkImplicits,
frameworkRes.Output("package-res.apk").Output.String())
+ expectedLinkImplicits = append(expectedLinkImplicits,
+ lineageRes.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 c8fb93c..0dcecb2 100644
--- a/java/java.go
+++ b/java/java.go
@@ -340,6 +340,7 @@
bootClasspathTag = dependencyTag{name: "bootclasspath", runtimeLinked: true}
systemModulesTag = dependencyTag{name: "system modules", runtimeLinked: true}
frameworkResTag = dependencyTag{name: "framework-res"}
+ lineageResTag = dependencyTag{name: "org.lineageos.platform-res"}
kotlinStdlibTag = dependencyTag{name: "kotlin-stdlib", runtimeLinked: true}
kotlinAnnotationsTag = dependencyTag{name: "kotlin-annotations", runtimeLinked: true}
kotlinPluginTag = dependencyTag{name: "kotlin-plugin", toolchain: true}
@@ -379,6 +380,7 @@
java9Classpath []string
frameworkResModule string
+ lineageResModule string
jars android.Paths
aidl android.OptionalPath
@@ -418,6 +420,10 @@
if sdkDep.systemModules != "" {
ctx.AddVariationDependencies(nil, systemModulesTag, sdkDep.systemModules)
}
+
+ if ctx.ModuleName() == "org.lineageos.platform-res" {
+ ctx.AddVariationDependencies(nil, frameworkResTag, "framework-res")
+ }
}
type deps struct {
diff --git a/java/sdk.go b/java/sdk.go
index 0dddd40..d0664ec 100644
--- a/java/sdk.go
+++ b/java/sdk.go
@@ -152,6 +152,7 @@
systemModules: fmt.Sprintf("core-%s-stubs-system-modules", systemModulesKind),
java9Classpath: []string{module},
frameworkResModule: "framework-res",
+ lineageResModule: "org.lineageos.platform-res",
aidl: android.OptionalPathForPath(aidl),
}
}
@@ -164,6 +165,7 @@
bootclasspath: corePlatformBootclasspathLibraries(ctx),
classpath: config.FrameworkLibraries,
frameworkResModule: "framework-res",
+ lineageResModule: "org.lineageos.platform-res",
}
case android.SdkNone:
systemModules := sdkContext.SystemModules()
diff --git a/java/testing.go b/java/testing.go
index 511cc5d..cfe1455 100644
--- a/java/testing.go
+++ b/java/testing.go
@@ -370,6 +370,11 @@
android_app {
name: "framework-res",
sdk_version: "core_platform",
+ }
+
+ android_app {
+ name: "org.lineageos.platform-res",
+ sdk_version: "core_platform",
}`
systemModules := []string{