Merge "Disable verify_overlaps test instead of hiddenapi check." into main

This commit is contained in:
Alyssa Ketpreechasawat
2023-11-06 10:53:31 +00:00
committed by Gerrit Code Review
2 changed files with 13 additions and 6 deletions

View File

@@ -167,8 +167,7 @@ func (c Config) RunningInsideUnitTest() bool {
} }
// DisableHiddenApiChecks returns true if hiddenapi checks have been disabled. // DisableHiddenApiChecks returns true if hiddenapi checks have been disabled.
// For 'eng' target variant hiddenapi checks are disabled by default for performance optimisation // For 'eng' target variant hiddenapi checks are disabled by default for performance optimisation,
// Hiddenapi checks are also disabled when RELEASE_DEFAULT_MODULE_BUILD_FROM_SOURCE is set to false
// but can be enabled by setting environment variable ENABLE_HIDDENAPI_FLAGS=true. // 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 // For other target variants hiddenapi check are enabled by default but can be disabled by
// setting environment variable UNSAFE_DISABLE_HIDDENAPI_FLAGS=true. // setting environment variable UNSAFE_DISABLE_HIDDENAPI_FLAGS=true.
@@ -177,8 +176,16 @@ func (c Config) RunningInsideUnitTest() bool {
func (c Config) DisableHiddenApiChecks() bool { func (c Config) DisableHiddenApiChecks() bool {
return !c.IsEnvTrue("ENABLE_HIDDENAPI_FLAGS") && return !c.IsEnvTrue("ENABLE_HIDDENAPI_FLAGS") &&
(c.IsEnvTrue("UNSAFE_DISABLE_HIDDENAPI_FLAGS") || (c.IsEnvTrue("UNSAFE_DISABLE_HIDDENAPI_FLAGS") ||
Bool(c.productVariables.Eng) || Bool(c.productVariables.Eng))
!c.ReleaseDefaultModuleBuildFromSource()) }
// DisableVerifyOverlaps returns true if verify_overlaps is skipped.
// Mismatch in version of apexes and module SDK is required for mainline prebuilts to work in
// trunk stable.
// Thus, verify_overlaps is disabled when RELEASE_DEFAULT_MODULE_BUILD_FROM_SOURCE is set to false.
// TODO(b/308174018): Re-enable verify_overlaps for both builr from source/mainline prebuilts.
func (c Config) DisableVerifyOverlaps() bool {
return c.IsEnvTrue("DISABLE_VERIFY_OVERLAPS") || !c.ReleaseDefaultModuleBuildFromSource()
} }
// MaxPageSizeSupported returns the max page size supported by the device. This // MaxPageSizeSupported returns the max page size supported by the device. This

View File

@@ -358,7 +358,7 @@ func buildRuleToGenerateHiddenAPIStubFlagsFile(ctx android.BuilderContext, name,
// If there are stub flag files that have been generated by fragments on which this depends then // If there are stub flag files that have been generated by fragments on which this depends then
// use them to validate the stub flag file generated by the rules created by this method. // use them to validate the stub flag file generated by the rules created by this method.
if len(stubFlagSubsets) > 0 { if !ctx.Config().DisableVerifyOverlaps() && len(stubFlagSubsets) > 0 {
validFile := buildRuleValidateOverlappingCsvFiles(ctx, name, desc, outputPath, stubFlagSubsets, validFile := buildRuleValidateOverlappingCsvFiles(ctx, name, desc, outputPath, stubFlagSubsets,
HIDDENAPI_STUB_FLAGS_IMPL_FLAGS) HIDDENAPI_STUB_FLAGS_IMPL_FLAGS)
@@ -1006,7 +1006,7 @@ func buildRuleToGenerateHiddenApiFlags(ctx android.BuilderContext, name, desc st
// If there are flag files that have been generated by fragments on which this depends then use // If there are flag files that have been generated by fragments on which this depends then use
// them to validate the flag file generated by the rules created by this method. // them to validate the flag file generated by the rules created by this method.
if len(flagSubsets) > 0 { if !ctx.Config().DisableVerifyOverlaps() && len(flagSubsets) > 0 {
validFile := buildRuleValidateOverlappingCsvFiles(ctx, name, desc, outputPath, flagSubsets, validFile := buildRuleValidateOverlappingCsvFiles(ctx, name, desc, outputPath, flagSubsets,
HIDDENAPI_FLAGS_CSV_IMPL_FLAGS) HIDDENAPI_FLAGS_CSV_IMPL_FLAGS)