From 8fe023c5518dd8329dede6902aa1baf6c9c384a0 Mon Sep 17 00:00:00 2001 From: Anton Hansson Date: Thu, 13 Aug 2020 19:37:22 +0100 Subject: [PATCH 1/2] Add a tagged output for app's exportPackage This allows the android stubs to depend on framework-res' exportPackage without special-casing inside the build system. Bug: 161214753 Test: depending on this output in a followup CL Merged-In: I8c5d17540d2624974983d73e56ba17898505dba8 Change-Id: I8c5d17540d2624974983d73e56ba17898505dba8 --- java/app.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/java/app.go b/java/app.go index e75d8749f..2ec27f3df 100755 --- a/java/app.go +++ b/java/app.go @@ -969,6 +969,8 @@ func (a *AndroidApp) OutputFiles(tag string) (android.Paths, error) { switch tag { case ".aapt.srcjar": return []android.Path{a.aaptSrcJar}, nil + case ".export-package.apk": + return []android.Path{a.exportPackage}, nil } return a.Library.OutputFiles(tag) } From c8861c6acbbf7e8a53a98b41042a7dd0f5e904e3 Mon Sep 17 00:00:00 2001 From: Anton Hansson Date: Fri, 14 Aug 2020 09:38:04 +0100 Subject: [PATCH 2/2] Remove special-cased stub deps on framework-res This dep is now possible to express in native Android.bp syntax, which makes the build easier to understand. Bug: 161214753 Test: build sdk, diff out/dist before and after Change-Id: I878eda49b5bf54aaf581fc52e0fe9719e4bcdfce Merged-In: I878eda49b5bf54aaf581fc52e0fe9719e4bcdfce --- java/java.go | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/java/java.go b/java/java.go index 4612b76fa..69826eec3 100644 --- a/java/java.go +++ b/java/java.go @@ -578,7 +578,6 @@ var ( bootClasspathTag = dependencyTag{name: "bootclasspath"} systemModulesTag = dependencyTag{name: "system modules"} frameworkResTag = dependencyTag{name: "framework-res"} - frameworkApkTag = dependencyTag{name: "framework-apk"} kotlinStdlibTag = dependencyTag{name: "kotlin-stdlib"} kotlinAnnotationsTag = dependencyTag{name: "kotlin-annotations"} proguardRaiseTag = dependencyTag{name: "proguard-raise"} @@ -703,12 +702,6 @@ func (j *Module) deps(ctx android.BottomUpMutatorContext) { if sdkDep.systemModules != "" { ctx.AddVariationDependencies(nil, systemModulesTag, sdkDep.systemModules) } - - if ctx.ModuleName() == "android_stubs_current" || - ctx.ModuleName() == "android_system_stubs_current" || - ctx.ModuleName() == "android_test_stubs_current" { - ctx.AddVariationDependencies(nil, frameworkApkTag, "framework-res") - } } syspropPublicStubs := syspropPublicStubs(ctx.Config()) @@ -1057,18 +1050,6 @@ func (j *Module) collectDeps(ctx android.ModuleContext) deps { } else { ctx.PropertyErrorf("exported_plugins", "%q is not a java_plugin module", otherName) } - case frameworkApkTag: - if ctx.ModuleName() == "android_stubs_current" || - ctx.ModuleName() == "android_system_stubs_current" || - ctx.ModuleName() == "android_test_stubs_current" { - // framework stubs.jar need to depend on framework-res.apk, in order to pull the - // resource files out of there for aapt. - // - // Normally the package rule runs aapt, which includes the resource, - // but we're not running that in our package rule so just copy in the - // resource files here. - deps.staticResourceJars = append(deps.staticResourceJars, dep.(*AndroidApp).exportPackage) - } case kotlinStdlibTag: deps.kotlinStdlib = append(deps.kotlinStdlib, dep.HeaderJars()...) case kotlinAnnotationsTag: