aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRashed Abdel-Tawab <rashed@linux.com>2018-08-09 14:08:53 -0700
committerBruno Martins <bgcngm@gmail.com>2018-08-30 11:47:10 +0200
commit835eac3a8cd5bd645f3c65e324c36322987a33af (patch)
treefeaa218998a21ac978149c339438d07763b9a99c
parente0c64637965b8923ed09f71e8b35ec39a39d7a75 (diff)
downloadbuild_soong-835eac3a8cd5bd645f3c65e324c36322987a33af.tar.gz
build_soong-835eac3a8cd5bd645f3c65e324c36322987a33af.tar.bz2
build_soong-835eac3a8cd5bd645f3c65e324c36322987a33af.zip
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
-rw-r--r--java/aar.go10
-rw-r--r--java/androidmk.go4
-rw-r--r--java/app.go5
-rw-r--r--java/app_test.go3
-rw-r--r--java/java.go13
-rw-r--r--java/java_test.go4
6 files changed, 34 insertions, 5 deletions
diff --git a/java/aar.go b/java/aar.go
index 66f1cab6..5876076d 100644
--- a/java/aar.go
+++ b/java/aar.go
@@ -147,7 +147,7 @@ func (a *aapt) aapt2Flags(ctx android.ModuleContext, sdkVersion string) (flags [
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.
@@ -168,6 +168,9 @@ func (a *aapt) deps(ctx android.BottomUpMutatorContext, sdkVersion string) {
if sdkDep.frameworkResModule != "" {
ctx.AddDependency(ctx.Module(), frameworkResTag, sdkDep.frameworkResModule)
}
+ if sdkDep.lineageResModule != "" && ctx.ModuleName() != "org.lineageos.platform-res" {
+ ctx.AddDependency(ctx.Module(), lineageResTag, sdkDep.lineageResModule)
+ }
}
}
@@ -224,7 +227,7 @@ func aaptLibs(ctx android.ModuleContext, sdkVersion string) (transitiveStaticLib
}
switch ctx.OtherModuleDependencyTag(module) {
- case libTag, frameworkResTag:
+ case libTag, frameworkResTag, lineageResTag:
if exportPackage != nil {
sharedLibs = append(sharedLibs, exportPackage)
}
@@ -386,6 +389,9 @@ func (a *AARImport) DepsMutator(ctx android.BottomUpMutatorContext) {
if sdkDep.useModule && sdkDep.frameworkResModule != "" {
ctx.AddDependency(ctx.Module(), frameworkResTag, sdkDep.frameworkResModule)
}
+ if sdkDep.useModule && sdkDep.lineageResModule != "" {
+ ctx.AddDependency(ctx.Module(), lineageResTag, sdkDep.lineageResModule)
+ }
}
ctx.AddDependency(ctx.Module(), libTag, a.properties.Libs...)
diff --git a/java/androidmk.go b/java/androidmk.go
index b85ecb40..c78e8e3c 100644
--- a/java/androidmk.go
+++ b/java/androidmk.go
@@ -188,7 +188,7 @@ func (app *AndroidApp) AndroidMk() android.AndroidMkData {
fmt.Fprintln(w, "LOCAL_SOONG_PROGUARD_DICT :=", app.proguardDictionary.String())
}
- if app.Name() == "framework-res" {
+ if app.Name() == "framework-res" || app.Name() == "org.lineageos.platform-res" {
fmt.Fprintln(w, "LOCAL_MODULE_PATH := $(TARGET_OUT_JAVA_LIBRARIES)")
// Make base_rules.mk not put framework-res in a subdirectory called
// framework_res.
@@ -225,7 +225,7 @@ func (a *AndroidLibrary) AndroidMk() android.AndroidMkData {
fmt.Fprintln(w, "LOCAL_SOONG_PROGUARD_DICT :=", a.proguardDictionary.String())
}
- if a.Name() == "framework-res" {
+ if a.Name() == "framework-res" || a.Name() == "org.lineageos.platform-res" {
fmt.Fprintln(w, "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 ae0592a6..d7d93717 100644
--- a/java/app.go
+++ b/java/app.go
@@ -136,7 +136,7 @@ func (a *AndroidApp) GenerateAndroidBuildActions(ctx android.ModuleContext) {
a.Module.extraProguardFlagFiles = append(a.Module.extraProguardFlagFiles, staticLibProguardFlagFiles...)
a.Module.extraProguardFlagFiles = append(a.Module.extraProguardFlagFiles, a.proguardOptionsFile)
- if ctx.ModuleName() != "framework-res" {
+ if ctx.ModuleName() != "framework-res" && ctx.ModuleName() != "org.lineageos.platform-res" {
a.Module.compile(ctx, a.aaptSrcJar)
}
@@ -175,6 +175,9 @@ func (a *AndroidApp) GenerateAndroidBuildActions(ctx android.ModuleContext) {
if ctx.ModuleName() == "framework-res" {
// framework-res.apk is installed as system/framework/framework-res.apk
ctx.InstallFile(android.PathForModuleInstall(ctx, "framework"), ctx.ModuleName()+".apk", a.outputFile)
+ } else if ctx.ModuleName() == "org.lineageos.platform-res" {
+ // org.lineageos.platform-res.apk is installed as system/framework/org.lineageos.platform-res.apk
+ ctx.InstallFile(android.PathForModuleInstall(ctx, "framework"), ctx.ModuleName()+".apk", a.outputFile)
} else if Bool(a.appProperties.Privileged) {
ctx.InstallFile(android.PathForModuleInstall(ctx, "priv-app"), ctx.ModuleName()+".apk", a.outputFile)
} else {
diff --git a/java/app_test.go b/java/app_test.go
index 6770119e..c1f2114b 100644
--- a/java/app_test.go
+++ b/java/app_test.go
@@ -74,8 +74,11 @@ func TestApp(t *testing.T) {
expectedLinkImplicits := []string{"AndroidManifest.xml"}
frameworkRes := ctx.ModuleForTests("framework-res", "android_common")
+ lineageRes := ctx.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 ddfb09a4..efa6a7af 100644
--- a/java/java.go
+++ b/java/java.go
@@ -302,6 +302,7 @@ var (
bootClasspathTag = dependencyTag{name: "bootclasspath"}
systemModulesTag = dependencyTag{name: "system modules"}
frameworkResTag = dependencyTag{name: "framework-res"}
+ lineageResTag = dependencyTag{name: "org.lineageos.platform-res"}
kotlinStdlibTag = dependencyTag{name: "kotlin-stdlib"}
proguardRaiseTag = dependencyTag{name: "proguard-raise"}
)
@@ -313,6 +314,7 @@ type sdkDep struct {
systemModules string
frameworkResModule string
+ lineageResModule string
jar android.Path
aidl android.Path
@@ -421,6 +423,7 @@ func decodeSdkDep(ctx android.BaseContext, v string) sdkDep {
return sdkDep{
useDefaultLibs: true,
frameworkResModule: "framework-res",
+ lineageResModule: "org.lineageos.platform-res",
}
// TODO(ccross): re-enable these once we generate stubs, until then
// use the stubs in prebuilts/sdk/*current
@@ -466,6 +469,9 @@ func (j *Module) deps(ctx android.BottomUpMutatorContext) {
if ctx.ModuleName() == "framework" {
ctx.AddDependency(ctx.Module(), frameworkResTag, "framework-res")
}
+ if ctx.ModuleName() == "org.lineageos.platform" || ctx.ModuleName() == "org.lineageos.platform.internal" {
+ ctx.AddDependency(ctx.Module(), lineageResTag, "org.lineageos.platform-res")
+ }
}
ctx.AddDependency(ctx.Module(), libTag, j.properties.Libs...)
@@ -618,6 +624,13 @@ func (j *Module) collectDeps(ctx android.ModuleContext) deps {
// generated by framework-res.apk
deps.srcJars = append(deps.srcJars, dep.(*AndroidApp).aaptSrcJar)
}
+ case lineageResTag:
+ if ctx.ModuleName() == "org.lineageos.platform" ||
+ ctx.ModuleName() == "org.lineageos.platform.internal" {
+ // org.lineageos.platform.jar has a one-off dependency on the R.java and Manifest.java files
+ // generated by org.lineageos.platform-res.apk
+ deps.srcJars = append(deps.srcJars, dep.(*AndroidApp).aaptSrcJar)
+ }
case kotlinStdlibTag:
deps.kotlinStdlib = dep.HeaderJars()
default:
diff --git a/java/java_test.go b/java/java_test.go
index fb8cc949..bc16d889 100644
--- a/java/java_test.go
+++ b/java/java_test.go
@@ -117,6 +117,10 @@ func testContext(config android.Config, bp string,
name: "framework-res",
no_framework_libs: true,
}
+ android_app {
+ name: "org.lineageos.platform-res",
+ no_framework_libs: true,
+ }
`
systemModules := []string{