Merge "Support UNSAFE_DISABLE_HIDDENAPI_FLAGS in platform_bootclasspath" am: 6050c3c31e am: 58a26e96b7

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1674036

Change-Id: Iffa71d25dea6845866854cbb2e72036a64c330e0
This commit is contained in:
Paul Duffin
2021-04-13 18:25:38 +00:00
committed by Automerger Merge Worker

View File

@@ -73,13 +73,13 @@ type platformBootclasspathModule struct {
fragments []android.Module fragments []android.Module
// Path to the monolithic hiddenapi-flags.csv file. // Path to the monolithic hiddenapi-flags.csv file.
hiddenAPIFlagsCSV android.Path hiddenAPIFlagsCSV android.OutputPath
// Path to the monolithic hiddenapi-index.csv file. // Path to the monolithic hiddenapi-index.csv file.
hiddenAPIIndexCSV android.Path hiddenAPIIndexCSV android.OutputPath
// Path to the monolithic hiddenapi-unsupported.csv file. // Path to the monolithic hiddenapi-unsupported.csv file.
hiddenAPIMetadataCSV android.Path hiddenAPIMetadataCSV android.OutputPath
} }
// ApexVariantReference specifies a particular apex variant of a module. // ApexVariantReference specifies a particular apex variant of a module.
@@ -266,6 +266,20 @@ func (b *platformBootclasspathModule) generateHiddenAPIBuildActions(ctx android.
b.hiddenAPIIndexCSV = hiddenAPISingletonPaths(ctx).index b.hiddenAPIIndexCSV = hiddenAPISingletonPaths(ctx).index
b.hiddenAPIMetadataCSV = hiddenAPISingletonPaths(ctx).metadata b.hiddenAPIMetadataCSV = hiddenAPISingletonPaths(ctx).metadata
// Don't run any hiddenapi rules if UNSAFE_DISABLE_HIDDENAPI_FLAGS=true. This is a performance
// optimization that can be used to reduce the incremental build time but as its name suggests it
// can be unsafe to use, e.g. when the changes affect anything that goes on the bootclasspath.
if ctx.Config().IsEnvTrue("UNSAFE_DISABLE_HIDDENAPI_FLAGS") {
paths := android.OutputPaths{b.hiddenAPIFlagsCSV, b.hiddenAPIIndexCSV, b.hiddenAPIMetadataCSV}
for _, path := range paths {
ctx.Build(pctx, android.BuildParams{
Rule: android.Touch,
Output: path,
})
}
return
}
moduleSpecificFlagsPaths := android.Paths{} moduleSpecificFlagsPaths := android.Paths{}
for _, module := range modules { for _, module := range modules {
if h, ok := module.(hiddenAPIIntf); ok { if h, ok := module.(hiddenAPIIntf); ok {