From dd7063ba08ec776995d0b652ae3d21284ae7d8ec Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Wed, 2 May 2018 12:58:28 -0700 Subject: Regenerate R.java files from LOCAL_STATIC_ANDROID_LIBRARIES If a static android library lib1 has static_libs: ["lib2"] then the R.class files for packages in lib2 will be merged into the jar for lib1. If an app has lib1 in its static_libs it will get the R.class files from lib2 through lib1, instead of regenerating the R.java files with numbering that matches the resource table of the app. Pass transtive static android library dependencies on the aapt2 command line so that aapt2 will always regenerate the R.java constants for those packages. Also extract the packages that have R.java files after each aapt2 invocation. This is not necessary for Soong, but is passed to make to let it force regenerating the packages using --extra-packages. Bug: 78300023 Test: m checkbuild Change-Id: I0f3444af44d2a9f370d1f156c908972f8cc3a1ee Merged-In: I0f3444af44d2a9f370d1f156c908972f8cc3a1ee (cherry picked from commit 66f78820e12138dcc9acf1b3c6bd6d26f3340f93) --- java/androidmk.go | 2 ++ 1 file changed, 2 insertions(+) (limited to 'java/androidmk.go') diff --git a/java/androidmk.go b/java/androidmk.go index 92b9457e..b85ecb40 100644 --- a/java/androidmk.go +++ b/java/androidmk.go @@ -124,6 +124,7 @@ func (prebuilt *AARImport) AndroidMk() android.AndroidMkData { fmt.Fprintln(w, "LOCAL_SOONG_HEADER_JAR :=", prebuilt.classpathFile.String()) fmt.Fprintln(w, "LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE :=", prebuilt.exportPackage.String()) fmt.Fprintln(w, "LOCAL_SOONG_EXPORT_PROGUARD_FLAGS :=", prebuilt.proguardFlags.String()) + fmt.Fprintln(w, "LOCAL_SOONG_STATIC_LIBRARY_EXTRA_PACKAGES :=", prebuilt.extraAaptPackagesFile.String()) fmt.Fprintln(w, "LOCAL_SDK_VERSION :=", String(prebuilt.properties.Sdk_version)) }, }, @@ -232,6 +233,7 @@ func (a *AndroidLibrary) AndroidMk() android.AndroidMkData { } fmt.Fprintln(w, "LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE :=", a.exportPackage.String()) + fmt.Fprintln(w, "LOCAL_SOONG_STATIC_LIBRARY_EXTRA_PACKAGES :=", a.extraAaptPackagesFile.String()) fmt.Fprintln(w, "LOCAL_FULL_MANIFEST_FILE :=", a.manifestPath.String()) fmt.Fprintln(w, "LOCAL_SOONG_EXPORT_PROGUARD_FLAGS :=", strings.Join(a.exportedProguardFlagFiles.Strings(), " ")) -- cgit v1.2.3