Prepare to be able to put framework-res in srcs
This change introduces two changes required to put
framework-res explicitly in srcs property, without relying on the build
system to specially add framework-res as a dependency to
framework-minus-apex, etc.
1) R.java and Manifest.java generated from aapt were packaged to the file
R.jar directly under the gen directory. With this change, the file
becomes android/R.srcjar under the gen directory.
2) android_app module now overrides OutputFileProducer interface so that
it can recognize "{.aapt.srcjar}" tag to reference the generated srcjar file.
Being able to put framework-res in srcs allows us to pass all the source
files (both in the source tree and the ones generates) via a filegroup.
Previously, the source files could only be passed via the java_library
module type. This caused a circular dependency problem when the java
library was used as an input (src_libs) of the droiddoc module. Using
filegroup eliminates the circular dependency.
Bug: 70046217
Test: m
Merged-In: I9ab6116bcc6fa3da60933d427575463b05ae69b4
(cherry picked from commit 94f37f33ed
)
Change-Id: I9ab6116bcc6fa3da60933d427575463b05ae69b4
This commit is contained in:
@@ -249,7 +249,8 @@ func (a *aapt) buildActions(ctx android.ModuleContext, sdkContext sdkContext, ex
|
|||||||
}
|
}
|
||||||
|
|
||||||
packageRes := android.PathForModuleOut(ctx, "package-res.apk")
|
packageRes := android.PathForModuleOut(ctx, "package-res.apk")
|
||||||
srcJar := android.PathForModuleGen(ctx, "R.jar")
|
// the subdir "android" is required to be filtered by package names
|
||||||
|
srcJar := android.PathForModuleGen(ctx, "android", "R.srcjar")
|
||||||
proguardOptionsFile := android.PathForModuleGen(ctx, "proguard.options")
|
proguardOptionsFile := android.PathForModuleGen(ctx, "proguard.options")
|
||||||
rTxt := android.PathForModuleOut(ctx, "R.txt")
|
rTxt := android.PathForModuleOut(ctx, "R.txt")
|
||||||
// This file isn't used by Soong, but is generated for exporting
|
// This file isn't used by Soong, but is generated for exporting
|
||||||
@@ -620,7 +621,8 @@ func (a *AARImport) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
aapt2CompileZip(ctx, flata, aar, "res", compileFlags)
|
aapt2CompileZip(ctx, flata, aar, "res", compileFlags)
|
||||||
|
|
||||||
a.exportPackage = android.PathForModuleOut(ctx, "package-res.apk")
|
a.exportPackage = android.PathForModuleOut(ctx, "package-res.apk")
|
||||||
srcJar := android.PathForModuleGen(ctx, "R.jar")
|
// the subdir "android" is required to be filtered by package names
|
||||||
|
srcJar := android.PathForModuleGen(ctx, "android", "R.srcjar")
|
||||||
proguardOptionsFile := android.PathForModuleGen(ctx, "proguard.options")
|
proguardOptionsFile := android.PathForModuleGen(ctx, "proguard.options")
|
||||||
rTxt := android.PathForModuleOut(ctx, "R.txt")
|
rTxt := android.PathForModuleOut(ctx, "R.txt")
|
||||||
a.extraAaptPackagesFile = android.PathForModuleOut(ctx, "extra_packages")
|
a.extraAaptPackagesFile = android.PathForModuleOut(ctx, "extra_packages")
|
||||||
|
@@ -539,6 +539,15 @@ func (a *AndroidApp) getCertString(ctx android.BaseModuleContext) string {
|
|||||||
return String(a.overridableAppProperties.Certificate)
|
return String(a.overridableAppProperties.Certificate)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// For OutputFileProducer interface
|
||||||
|
func (a *AndroidApp) OutputFiles(tag string) (android.Paths, error) {
|
||||||
|
switch tag {
|
||||||
|
case ".aapt.srcjar":
|
||||||
|
return []android.Path{a.aaptSrcJar}, nil
|
||||||
|
}
|
||||||
|
return a.Library.OutputFiles(tag)
|
||||||
|
}
|
||||||
|
|
||||||
// android_app compiles sources and Android resources into an Android application package `.apk` file.
|
// android_app compiles sources and Android resources into an Android application package `.apk` file.
|
||||||
func AndroidAppFactory() android.Module {
|
func AndroidAppFactory() android.Module {
|
||||||
module := &AndroidApp{}
|
module := &AndroidApp{}
|
||||||
|
Reference in New Issue
Block a user