Merge "Disable Hidden API Checks for ENG Builds" into main
This commit is contained in:
@@ -170,6 +170,19 @@ func (c Config) RunningInsideUnitTest() bool {
|
|||||||
return c.config.TestProductVariables != nil
|
return c.config.TestProductVariables != nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DisableHiddenApiChecks returns true if hiddenapi checks have been disabled.
|
||||||
|
// For 'eng' target variant hiddenapi checks are disabled by default for performance optimisation,
|
||||||
|
// but can be enabled by setting environment variable ENABLE_HIDDENAPI_FLAGS=true.
|
||||||
|
// For other target variants hiddenapi check are enabled by default but can be disabled by
|
||||||
|
// setting environment variable UNSAFE_DISABLE_HIDDENAPI_FLAGS=true.
|
||||||
|
// If both ENABLE_HIDDENAPI_FLAGS=true and UNSAFE_DISABLE_HIDDENAPI_FLAGS=true, then
|
||||||
|
// ENABLE_HIDDENAPI_FLAGS=true will be triggered and hiddenapi checks will be considered enabled.
|
||||||
|
func (c Config) DisableHiddenApiChecks() bool {
|
||||||
|
return !c.IsEnvTrue("ENABLE_HIDDENAPI_FLAGS") &&
|
||||||
|
(c.IsEnvTrue("UNSAFE_DISABLE_HIDDENAPI_FLAGS") ||
|
||||||
|
Bool(c.productVariables.Eng))
|
||||||
|
}
|
||||||
|
|
||||||
// MaxPageSizeSupported returns the max page size supported by the device. This
|
// MaxPageSizeSupported returns the max page size supported by the device. This
|
||||||
// value will define the ELF segment alignment for binaries (executables and
|
// value will define the ELF segment alignment for binaries (executables and
|
||||||
// shared libraries).
|
// shared libraries).
|
||||||
|
@@ -106,7 +106,7 @@ func (h *hiddenAPI) initHiddenAPI(ctx android.ModuleContext, dexJar OptionalDexJ
|
|||||||
h.uncompressDexState = uncompressedDexState
|
h.uncompressDexState = uncompressedDexState
|
||||||
|
|
||||||
// If hiddenapi processing is disabled treat this as inactive.
|
// If hiddenapi processing is disabled treat this as inactive.
|
||||||
if ctx.Config().IsEnvTrue("UNSAFE_DISABLE_HIDDENAPI_FLAGS") {
|
if ctx.Config().DisableHiddenApiChecks() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -121,8 +121,8 @@ type hiddenAPISingleton struct {
|
|||||||
|
|
||||||
// hiddenAPI singleton rules
|
// hiddenAPI singleton rules
|
||||||
func (h *hiddenAPISingleton) GenerateBuildActions(ctx android.SingletonContext) {
|
func (h *hiddenAPISingleton) GenerateBuildActions(ctx android.SingletonContext) {
|
||||||
// Don't run any hiddenapi rules if UNSAFE_DISABLE_HIDDENAPI_FLAGS=true
|
// Don't run any hiddenapi rules if hiddenapi checks are disabled
|
||||||
if ctx.Config().IsEnvTrue("UNSAFE_DISABLE_HIDDENAPI_FLAGS") {
|
if ctx.Config().DisableHiddenApiChecks() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -113,7 +113,7 @@ func (b *platformBootclasspathModule) DepsMutator(ctx android.BottomUpMutatorCon
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (b *platformBootclasspathModule) hiddenAPIDepsMutator(ctx android.BottomUpMutatorContext) {
|
func (b *platformBootclasspathModule) hiddenAPIDepsMutator(ctx android.BottomUpMutatorContext) {
|
||||||
if ctx.Config().IsEnvTrue("UNSAFE_DISABLE_HIDDENAPI_FLAGS") {
|
if ctx.Config().DisableHiddenApiChecks() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -275,10 +275,10 @@ func (b *platformBootclasspathModule) generateHiddenAPIBuildActions(ctx android.
|
|||||||
|
|
||||||
bootDexJarByModule := extractBootDexJarsFromModules(ctx, modules)
|
bootDexJarByModule := extractBootDexJarsFromModules(ctx, modules)
|
||||||
|
|
||||||
// Don't run any hiddenapi rules if UNSAFE_DISABLE_HIDDENAPI_FLAGS=true. This is a performance
|
// Don't run any hiddenapi rules if hidden api checks are disabled. This is a performance
|
||||||
// optimization that can be used to reduce the incremental build time but as its name suggests it
|
// 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.
|
// 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") {
|
if ctx.Config().DisableHiddenApiChecks() {
|
||||||
paths := android.OutputPaths{b.hiddenAPIFlagsCSV, b.hiddenAPIIndexCSV, b.hiddenAPIMetadataCSV}
|
paths := android.OutputPaths{b.hiddenAPIFlagsCSV, b.hiddenAPIIndexCSV, b.hiddenAPIMetadataCSV}
|
||||||
for _, path := range paths {
|
for _, path := range paths {
|
||||||
ctx.Build(pctx, android.BuildParams{
|
ctx.Build(pctx, android.BuildParams{
|
||||||
|
Reference in New Issue
Block a user