Move hiddenapi singleton rules to Soong

Move the rules that build hiddenapi-stubs-flags.txt,
hiddenapi-flags.csv and hiddenapi-greylist.csv into Soong.

Bug: 123645297
Test: m checkbuild
Test: m UNSAFE_DISABLE_HIDDEN_API_FLAGS=true
Change-Id: I90bf58710f6153ee8565994f799d3ec5699bc7fa
This commit is contained in:
Colin Cross
2019-01-31 14:12:44 -08:00
parent 0d2f40ae6c
commit f24a22a98a
8 changed files with 382 additions and 85 deletions

View File

@@ -313,6 +313,7 @@ type Module struct {
// expanded Jarjar_rules
expandJarjarRules android.Path
hiddenAPI
dexpreopter
}
@@ -331,6 +332,7 @@ type Dependency interface {
ImplementationJars() android.Paths
ResourceJars() android.Paths
ImplementationAndResourcesJars() android.Paths
DexJar() android.Path
AidlIncludeDirs() android.Paths
ExportedSdkLibs() []string
}
@@ -1216,18 +1218,8 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars ...android.Path
}
// Hidden API CSV generation and dex encoding
if !ctx.Config().IsEnvTrue("UNSAFE_DISABLE_HIDDENAPI_FLAGS") {
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, j.deviceProperties.UncompressDex)
dexOutputFile = hiddenAPIJar
}
}
dexOutputFile = j.hiddenAPI.hiddenAPI(ctx, dexOutputFile, j.implementationJarFile,
j.deviceProperties.UncompressDex)
// merge dex jar with resources if necessary
if j.resourceJar != nil {
@@ -1365,6 +1357,10 @@ func (j *Module) ImplementationJars() android.Paths {
return android.Paths{j.implementationJarFile}
}
func (j *Module) DexJar() android.Path {
return j.dexJarFile
}
func (j *Module) ResourceJars() android.Paths {
if j.resourceJar == nil {
return nil
@@ -1775,6 +1771,10 @@ func (j *Import) ImplementationAndResourcesJars() android.Paths {
return android.Paths{j.combinedClasspathFile}
}
func (j *Import) DexJar() android.Path {
return nil
}
func (j *Import) AidlIncludeDirs() android.Paths {
return nil
}