diff options
author | Colin Cross <ccross@android.com> | 2019-01-16 15:15:52 -0800 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2019-01-17 22:19:28 +0000 |
commit | 8faf8fc06076cda933232204f643c35e244b0938 (patch) | |
tree | 199593571daaac5634dbbdba4aeaf738df2fad05 /java/java.go | |
parent | 56abb83628f5164f925bd0faf51bca3ef8a597fc (diff) |
Move hiddenapi to Soong
Perform hiddenapi CSV generation and dex encoding for Soong modules
in Soong. This fixes an issue where dexpreopting was happening on
a different jar than was being installed.
Bug: 122856783
Test: m checkbuild
Test: no change out/target/common/obj/PACKAGING/hiddenapi-flags.csv
Test: only ordering change to out/target/common/obj/PACKAGING/hiddenapi-greylist.csv
Test: cts/tests/signature/runSignatureTests.sh
Change-Id: I4fc481efc29e73cb2bdaacf672e86d5f6f0075ae
Diffstat (limited to 'java/java.go')
-rw-r--r-- | java/java.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/java/java.go b/java/java.go index 2ac5a5b46..49095ca36 100644 --- a/java/java.go +++ b/java/java.go @@ -1172,12 +1172,25 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars ...android.Path j.implementationAndResourcesJar = implementationAndResourcesJar if ctx.Device() && (Bool(j.properties.Installable) || Bool(j.deviceProperties.Compile_dex)) { + // Dex compilation var dexOutputFile android.ModuleOutPath dexOutputFile = j.compileDex(ctx, flags, outputFile, jarName) if ctx.Failed() { return } + // Hidden API CSV generation and dex encoding + isBootJar := inList(ctx.ModuleName(), ctx.Config().BootJars()) + if isBootJar || inList(ctx.ModuleName(), ctx.Config().HiddenAPIExtraAppUsageJars()) { + // Derive the greylist from classes jar. + hiddenAPIGenerateCSV(ctx, j.implementationJarFile) + } + if isBootJar { + hiddenAPIJar := android.PathForModuleOut(ctx, "hiddenapi", jarName) + hiddenAPIEncodeDex(ctx, hiddenAPIJar, dexOutputFile) + dexOutputFile = hiddenAPIJar + } + // merge dex jar with resources if necessary if j.resourceJar != nil { jars := android.Paths{dexOutputFile, j.resourceJar} @@ -1189,6 +1202,7 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars ...android.Path j.dexJarFile = dexOutputFile + // Dexpreopting j.dexpreopter.isInstallable = Bool(j.properties.Installable) j.dexpreopter.uncompressedDex = j.deviceProperties.UncompressDex dexOutputFile = j.dexpreopt(ctx, dexOutputFile) |