Disable all-assigned check in hiddenapi on master-art
Master-art configurations do not have frameworks/base and therefore do not have hidden API flags. Pass --no-force-assign-all to `hiddenapi` when frameworks/base does not exist to disable the corresponding assertion. This enables us to enforce the assertion on non-master-art builds and also get rid of logspam about missing flags on ART buildbots. Test: art/tools/buildbot-build.sh on master-art Bug: 123143676 Change-Id: I074d9554fb11dab3eef904016375730520107ec2
This commit is contained in:
@@ -774,6 +774,10 @@ func (c *config) DexPreoptProfileDir() string {
|
|||||||
return String(c.productVariables.DexPreoptProfileDir)
|
return String(c.productVariables.DexPreoptProfileDir)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *config) FrameworksBaseDirExists(ctx PathContext) bool {
|
||||||
|
return ExistentPathForSource(ctx, "frameworks", "base").Valid()
|
||||||
|
}
|
||||||
|
|
||||||
func (c *deviceConfig) Arches() []Arch {
|
func (c *deviceConfig) Arches() []Arch {
|
||||||
var arches []Arch
|
var arches []Arch
|
||||||
for _, target := range c.config.Targets[Android] {
|
for _, target := range c.config.Targets[Android] {
|
||||||
|
@@ -118,7 +118,7 @@ func init() {
|
|||||||
// projects, and hence cannot built 'aapt2'. Use the SDK prebuilt instead.
|
// projects, and hence cannot built 'aapt2'. Use the SDK prebuilt instead.
|
||||||
hostBinToolVariableWithPrebuilt := func(name, prebuiltDir, tool string) {
|
hostBinToolVariableWithPrebuilt := func(name, prebuiltDir, tool string) {
|
||||||
pctx.VariableFunc(name, func(ctx android.PackageVarContext) 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)
|
return filepath.Join(prebuiltDir, runtime.GOOS, "bin", tool)
|
||||||
} else {
|
} else {
|
||||||
return pctx.HostBinToolPath(ctx, tool).String()
|
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 ` +
|
`for INPUT_DEX in $$(find $tmpDir/dex-input -maxdepth 1 -name 'classes*.dex' | sort); do ` +
|
||||||
` echo "--input-dex=$${INPUT_DEX}"; ` +
|
` echo "--input-dex=$${INPUT_DEX}"; ` +
|
||||||
` echo "--output-dex=$tmpDir/dex-output/$$(basename $${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.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`,
|
`${config.MergeZipsCmd} -D -zipToNotStrip $tmpDir/dex.jar -stripFile "classes*.dex" $out $tmpDir/dex.jar $in`,
|
||||||
CommandDeps: []string{
|
CommandDeps: []string{
|
||||||
@@ -75,16 +75,17 @@ var hiddenAPIEncodeDexRule = pctx.AndroidStaticRule("hiddenAPIEncodeDex", bluepr
|
|||||||
"${config.SoongZipCmd}",
|
"${config.SoongZipCmd}",
|
||||||
"${config.MergeZipsCmd}",
|
"${config.MergeZipsCmd}",
|
||||||
},
|
},
|
||||||
}, "flags", "tmpDir", "soongZipFlags")
|
}, "flagsCsv", "hiddenapiFlags", "tmpDir", "soongZipFlags")
|
||||||
|
|
||||||
func hiddenAPIEncodeDex(ctx android.ModuleContext, output android.WritablePath, dexInput android.WritablePath,
|
func hiddenAPIEncodeDex(ctx android.ModuleContext, output android.WritablePath, dexInput android.WritablePath,
|
||||||
uncompressDex bool) {
|
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
|
// 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.
|
// in the input it stays uncompressed in the output.
|
||||||
soongZipFlags := ""
|
soongZipFlags := ""
|
||||||
|
hiddenapiFlags := ""
|
||||||
tmpOutput := output
|
tmpOutput := output
|
||||||
tmpDir := android.PathForModuleOut(ctx, "hiddenapi", "dex")
|
tmpDir := android.PathForModuleOut(ctx, "hiddenapi", "dex")
|
||||||
if uncompressDex {
|
if uncompressDex {
|
||||||
@@ -92,17 +93,23 @@ func hiddenAPIEncodeDex(ctx android.ModuleContext, output android.WritablePath,
|
|||||||
tmpOutput = android.PathForModuleOut(ctx, "hiddenapi", "unaligned", "unaligned.jar")
|
tmpOutput = android.PathForModuleOut(ctx, "hiddenapi", "unaligned", "unaligned.jar")
|
||||||
tmpDir = android.PathForModuleOut(ctx, "hiddenapi", "unaligned")
|
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{
|
ctx.Build(pctx, android.BuildParams{
|
||||||
Rule: hiddenAPIEncodeDexRule,
|
Rule: hiddenAPIEncodeDexRule,
|
||||||
Description: "hiddenapi encode dex",
|
Description: "hiddenapi encode dex",
|
||||||
Input: dexInput,
|
Input: dexInput,
|
||||||
Output: tmpOutput,
|
Output: tmpOutput,
|
||||||
Implicit: flags,
|
Implicit: flagsCsv,
|
||||||
Args: map[string]string{
|
Args: map[string]string{
|
||||||
"flags": flags.String(),
|
"flagsCsv": flagsCsv.String(),
|
||||||
"tmpDir": tmpDir.String(),
|
"tmpDir": tmpDir.String(),
|
||||||
"soongZipFlags": soongZipFlags,
|
"soongZipFlags": soongZipFlags,
|
||||||
|
"hiddenapiFlags": hiddenapiFlags,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user