diff options
author | Sam Mortimer <sam@mortimer.me.uk> | 2019-10-07 11:41:14 -0700 |
---|---|---|
committer | Michael Bestas <mkbestas@lineageos.org> | 2019-12-11 19:03:43 +0200 |
commit | efa6a129b0954708e575069bef56fce1e234f0da (patch) | |
tree | b3d135cc5e3da7b5cc8f1886ce3765028367c796 /java | |
parent | 094c1b049a74506798c33d023a2a0df3506947c9 (diff) | |
download | build_soong-efa6a129b0954708e575069bef56fce1e234f0da.tar.gz build_soong-efa6a129b0954708e575069bef56fce1e234f0da.tar.bz2 build_soong-efa6a129b0954708e575069bef56fce1e234f0da.zip |
soong: Give priority to modules in exported namespaces for bootjars
* Looking for modules that provide a boot jar is currently
done by module name match only. This breaks when you
have multiple copies of the same module in your build
tree (eg in another device).
* Add a new mutator that marks the modules that should be used
for bootjar content.
* The logic is simple: give priority to modules that are in
exported soong namespace.
Change-Id: I2476174b892475c14a9f10b5e66b8496186f81c0
Diffstat (limited to 'java')
-rw-r--r-- | java/dexpreopt_bootjars.go | 4 | ||||
-rw-r--r-- | java/dexpreopt_bootjars_test.go | 2 | ||||
-rw-r--r-- | java/hiddenapi.go | 9 |
3 files changed, 14 insertions, 1 deletions
diff --git a/java/dexpreopt_bootjars.go b/java/dexpreopt_bootjars.go index 4d87b2f7..87d8428d 100644 --- a/java/dexpreopt_bootjars.go +++ b/java/dexpreopt_bootjars.go @@ -151,6 +151,10 @@ func buildBootImage(ctx android.SingletonContext, config bootImageConfig) *bootI bootDexJars := make(android.Paths, len(image.modules)) ctx.VisitAllModules(func(module android.Module) { + if m, ok := module.(interface{ BootJarProvider() bool }); !ok || + !m.BootJarProvider() { + return + } // Collect dex jar paths for the modules listed above. if j, ok := module.(interface{ DexJar() android.Path }); ok { name := ctx.ModuleName(module) diff --git a/java/dexpreopt_bootjars_test.go b/java/dexpreopt_bootjars_test.go index cbb52f15..d4f84914 100644 --- a/java/dexpreopt_bootjars_test.go +++ b/java/dexpreopt_bootjars_test.go @@ -53,6 +53,8 @@ func TestDexpreoptBootJars(t *testing.T) { ctx := testContext(config, bp, nil) + ctx.PreArchMutators(android.RegisterBootJarMutators) + ctx.RegisterSingletonType("dex_bootjars", android.SingletonFactoryAdaptor(dexpreoptBootJarsFactory)) run(t, ctx, config) diff --git a/java/hiddenapi.go b/java/hiddenapi.go index 6020aba6..28724f2a 100644 --- a/java/hiddenapi.go +++ b/java/hiddenapi.go @@ -73,7 +73,14 @@ func (h *hiddenAPI) hiddenAPI(ctx android.ModuleContext, dexJar android.ModuleOu // to the hidden API for the bootclassloader. If information is gathered for modules // not on the list then that will cause failures in the CtsHiddenApiBlacklist... // tests. - if inList(bootJarName, ctx.Config().BootJars()) { + isBootJarProvider := false + ctx.VisitAllModuleVariants(func(module android.Module) { + if m, ok := module.(interface{ BootJarProvider() bool }); ok && + m.BootJarProvider() { + isBootJarProvider = true + } + }) + if isBootJarProvider && inList(bootJarName, ctx.Config().BootJars()) { // Derive the greylist from classes jar. flagsCSV := android.PathForModuleOut(ctx, "hiddenapi", "flags.csv") metadataCSV := android.PathForModuleOut(ctx, "hiddenapi", "metadata.csv") |