Separate device and product overlays
This change adds book-keeping of whether an overlay came from
DEVICE_PACKAGE_OVERLAYS or PRODUCT_PACKAGE_OVERLAYS. This is
later used when writing the output to soong_app_prebuilt.mk, to
use either LOCAL_SOONG_[DEVICE|PRODUCT]_RRO_PACKAGES depending
on the original source.
This change is intended to be a noop on its own, but allows a
follow-up make change to customize the location of the auto-generated
RRO packages.
Bug: 127758779
Test: verify noop on presubmit targets
Change-Id: Ib24fe1d05be132c360dd6966f7c83968c9939f77
diff --git a/java/aar.go b/java/aar.go
index 1a5ea4d..ba9e187 100644
--- a/java/aar.go
+++ b/java/aar.go
@@ -27,7 +27,7 @@
Dependency
ExportPackage() android.Path
ExportedProguardFlagFiles() android.Paths
- ExportedRRODirs() android.Paths
+ ExportedRRODirs() []rroDir
ExportedStaticPackages() android.Paths
ExportedManifest() android.Path
}
@@ -75,7 +75,7 @@
exportPackage android.Path
manifestPath android.Path
proguardOptionsFile android.Path
- rroDirs android.Paths
+ rroDirs []rroDir
rTxt android.Path
extraAaptPackagesFile android.Path
isLibrary bool
@@ -99,7 +99,7 @@
return a.exportPackage
}
-func (a *aapt) ExportedRRODirs() android.Paths {
+func (a *aapt) ExportedRRODirs() []rroDir {
return a.rroDirs
}
@@ -108,7 +108,7 @@
}
func (a *aapt) aapt2Flags(ctx android.ModuleContext, sdkContext sdkContext, manifestPath android.Path) (flags []string,
- deps android.Paths, resDirs, overlayDirs []globbedResourceDir, rroDirs, resZips android.Paths) {
+ deps android.Paths, resDirs, overlayDirs []globbedResourceDir, rroDirs []rroDir, resZips android.Paths) {
hasVersionCode := false
hasVersionName := false
@@ -286,8 +286,8 @@
}
// aaptLibs collects libraries from dependencies and sdk_version and converts them into paths
-func aaptLibs(ctx android.ModuleContext, sdkContext sdkContext) (transitiveStaticLibs, staticLibManifests,
- staticRRODirs, deps android.Paths, flags []string) {
+func aaptLibs(ctx android.ModuleContext, sdkContext sdkContext) (transitiveStaticLibs, staticLibManifests android.Paths,
+ staticRRODirs []rroDir, deps android.Paths, flags []string) {
var sharedLibs android.Paths
@@ -315,7 +315,16 @@
transitiveStaticLibs = append(transitiveStaticLibs, aarDep.ExportedStaticPackages()...)
transitiveStaticLibs = append(transitiveStaticLibs, exportPackage)
staticLibManifests = append(staticLibManifests, aarDep.ExportedManifest())
- staticRRODirs = append(staticRRODirs, aarDep.ExportedRRODirs()...)
+
+ outer:
+ for _, d := range aarDep.ExportedRRODirs() {
+ for _, e := range staticRRODirs {
+ if d.path == e.path {
+ continue outer
+ }
+ }
+ staticRRODirs = append(staticRRODirs, d)
+ }
}
}
})
@@ -332,7 +341,6 @@
}
transitiveStaticLibs = android.FirstUniquePaths(transitiveStaticLibs)
- staticRRODirs = android.FirstUniquePaths(staticRRODirs)
return transitiveStaticLibs, staticLibManifests, staticRRODirs, deps, flags
}
@@ -482,7 +490,7 @@
return android.Paths{a.proguardFlags}
}
-func (a *AARImport) ExportedRRODirs() android.Paths {
+func (a *AARImport) ExportedRRODirs() []rroDir {
return nil
}