Merge "Disable all-assigned check in hiddenapi on master-art"
This commit is contained in:
commit
9d085dea9e
|
@ -774,6 +774,10 @@ func (c *config) DexPreoptProfileDir() string {
|
|||
return String(c.productVariables.DexPreoptProfileDir)
|
||||
}
|
||||
|
||||
func (c *config) FrameworksBaseDirExists(ctx PathContext) bool {
|
||||
return ExistentPathForSource(ctx, "frameworks", "base").Valid()
|
||||
}
|
||||
|
||||
func (c *deviceConfig) Arches() []Arch {
|
||||
var arches []Arch
|
||||
for _, target := range c.config.Targets[Android] {
|
||||
|
|
|
@ -118,7 +118,7 @@ func init() {
|
|||
// projects, and hence cannot built 'aapt2'. Use the SDK prebuilt instead.
|
||||
hostBinToolVariableWithPrebuilt := func(name, prebuiltDir, tool string) {
|
||||
pctx.VariableFunc(name, func(ctx android.PackageVarContext) string {
|
||||
if !android.ExistentPathForSource(ctx, "frameworks/base").Valid() {
|
||||
if !ctx.Config().FrameworksBaseDirExists(ctx) {
|
||||
return filepath.Join(prebuiltDir, runtime.GOOS, "bin", tool)
|
||||
} else {
|
||||
return pctx.HostBinToolPath(ctx, tool).String()
|
||||
|
|
|
@ -67,7 +67,7 @@ var hiddenAPIEncodeDexRule = pctx.AndroidStaticRule("hiddenAPIEncodeDex", bluepr
|
|||
`for INPUT_DEX in $$(find $tmpDir/dex-input -maxdepth 1 -name 'classes*.dex' | sort); do ` +
|
||||
` echo "--input-dex=$${INPUT_DEX}"; ` +
|
||||
` echo "--output-dex=$tmpDir/dex-output/$$(basename $${INPUT_DEX})"; ` +
|
||||
`done | xargs ${config.HiddenAPI} encode --api-flags=$flags && ` +
|
||||
`done | xargs ${config.HiddenAPI} encode --api-flags=$flagsCsv $hiddenapiFlags && ` +
|
||||
`${config.SoongZipCmd} $soongZipFlags -o $tmpDir/dex.jar -C $tmpDir/dex-output -f "$tmpDir/dex-output/classes*.dex" && ` +
|
||||
`${config.MergeZipsCmd} -D -zipToNotStrip $tmpDir/dex.jar -stripFile "classes*.dex" $out $tmpDir/dex.jar $in`,
|
||||
CommandDeps: []string{
|
||||
|
@ -75,16 +75,17 @@ var hiddenAPIEncodeDexRule = pctx.AndroidStaticRule("hiddenAPIEncodeDex", bluepr
|
|||
"${config.SoongZipCmd}",
|
||||
"${config.MergeZipsCmd}",
|
||||
},
|
||||
}, "flags", "tmpDir", "soongZipFlags")
|
||||
}, "flagsCsv", "hiddenapiFlags", "tmpDir", "soongZipFlags")
|
||||
|
||||
func hiddenAPIEncodeDex(ctx android.ModuleContext, output android.WritablePath, dexInput android.WritablePath,
|
||||
uncompressDex bool) {
|
||||
|
||||
flags := &bootImagePath{ctx.Config().HiddenAPIFlags()}
|
||||
flagsCsv := &bootImagePath{ctx.Config().HiddenAPIFlags()}
|
||||
|
||||
// The encode dex rule requires unzipping and rezipping the classes.dex files, ensure that if it was uncompressed
|
||||
// in the input it stays uncompressed in the output.
|
||||
soongZipFlags := ""
|
||||
hiddenapiFlags := ""
|
||||
tmpOutput := output
|
||||
tmpDir := android.PathForModuleOut(ctx, "hiddenapi", "dex")
|
||||
if uncompressDex {
|
||||
|
@ -92,17 +93,23 @@ func hiddenAPIEncodeDex(ctx android.ModuleContext, output android.WritablePath,
|
|||
tmpOutput = android.PathForModuleOut(ctx, "hiddenapi", "unaligned", "unaligned.jar")
|
||||
tmpDir = android.PathForModuleOut(ctx, "hiddenapi", "unaligned")
|
||||
}
|
||||
// If frameworks/base doesn't exist we must be building with the 'master-art' manifest.
|
||||
// Disable assertion that all methods/fields have hidden API flags assigned.
|
||||
if !ctx.Config().FrameworksBaseDirExists(ctx) {
|
||||
hiddenapiFlags = "--no-force-assign-all"
|
||||
}
|
||||
|
||||
ctx.Build(pctx, android.BuildParams{
|
||||
Rule: hiddenAPIEncodeDexRule,
|
||||
Description: "hiddenapi encode dex",
|
||||
Input: dexInput,
|
||||
Output: tmpOutput,
|
||||
Implicit: flags,
|
||||
Implicit: flagsCsv,
|
||||
Args: map[string]string{
|
||||
"flags": flags.String(),
|
||||
"tmpDir": tmpDir.String(),
|
||||
"soongZipFlags": soongZipFlags,
|
||||
"flagsCsv": flagsCsv.String(),
|
||||
"tmpDir": tmpDir.String(),
|
||||
"soongZipFlags": soongZipFlags,
|
||||
"hiddenapiFlags": hiddenapiFlags,
|
||||
},
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in New Issue