Fix prebuilt mutator ordering in tests
Previously, the prebuilt mutators were added by the cc.RegisterRequiredBuildComponentsForTest() function as a convenience but unfortunately it lead to some of the mutators being in a different order in the tests than in the normal build. This change: * Extracts the RegisterPrebuiltMutators() call from cc.RegisterRequiredBuildComponentsForTest() * Makes sure that the prebuilt mutators are registered before the visibility gatherer and enforcer mutators. Bug: 162505935 Test: m nothing Change-Id: I7d959b558200b502f0a5e4653c41ea01414e142a
This commit is contained in:
parent
359d4f3374
commit
021f4e525f
|
@ -236,13 +236,15 @@ func testApexContext(_ *testing.T, bp string, handlers ...testCustomizer) (*andr
|
||||||
ctx.PreArchMutators(android.RegisterComponentsMutator)
|
ctx.PreArchMutators(android.RegisterComponentsMutator)
|
||||||
ctx.PostDepsMutators(android.RegisterOverridePostDepsMutators)
|
ctx.PostDepsMutators(android.RegisterOverridePostDepsMutators)
|
||||||
|
|
||||||
cc.RegisterRequiredBuildComponentsForTest(ctx)
|
android.RegisterPrebuiltMutators(ctx)
|
||||||
|
|
||||||
// Register this after the prebuilt mutators have been registered (in
|
// Register these after the prebuilt mutators have been registered to match what
|
||||||
// cc.RegisterRequiredBuildComponentsForTest) to match what happens at runtime.
|
// happens at runtime.
|
||||||
ctx.PreArchMutators(android.RegisterVisibilityRuleGatherer)
|
ctx.PreArchMutators(android.RegisterVisibilityRuleGatherer)
|
||||||
ctx.PostDepsMutators(android.RegisterVisibilityRuleEnforcer)
|
ctx.PostDepsMutators(android.RegisterVisibilityRuleEnforcer)
|
||||||
|
|
||||||
|
cc.RegisterRequiredBuildComponentsForTest(ctx)
|
||||||
|
|
||||||
ctx.RegisterModuleType("cc_test", cc.TestFactory)
|
ctx.RegisterModuleType("cc_test", cc.TestFactory)
|
||||||
ctx.RegisterModuleType("vndk_prebuilt_shared", cc.VndkPrebuiltSharedFactory)
|
ctx.RegisterModuleType("vndk_prebuilt_shared", cc.VndkPrebuiltSharedFactory)
|
||||||
ctx.RegisterModuleType("vndk_libraries_txt", cc.VndkLibrariesTxtFactory)
|
ctx.RegisterModuleType("vndk_libraries_txt", cc.VndkLibrariesTxtFactory)
|
||||||
|
@ -5542,6 +5544,7 @@ func testNoUpdatableJarsInBootImage(t *testing.T, errmsg string, transformDexpre
|
||||||
ctx.RegisterModuleType("apex_key", ApexKeyFactory)
|
ctx.RegisterModuleType("apex_key", ApexKeyFactory)
|
||||||
ctx.RegisterModuleType("filegroup", android.FileGroupFactory)
|
ctx.RegisterModuleType("filegroup", android.FileGroupFactory)
|
||||||
ctx.PreArchMutators(android.RegisterDefaultsPreArchMutators)
|
ctx.PreArchMutators(android.RegisterDefaultsPreArchMutators)
|
||||||
|
android.RegisterPrebuiltMutators(ctx)
|
||||||
cc.RegisterRequiredBuildComponentsForTest(ctx)
|
cc.RegisterRequiredBuildComponentsForTest(ctx)
|
||||||
java.RegisterJavaBuildComponents(ctx)
|
java.RegisterJavaBuildComponents(ctx)
|
||||||
java.RegisterSystemModulesBuildComponents(ctx)
|
java.RegisterSystemModulesBuildComponents(ctx)
|
||||||
|
|
|
@ -20,8 +20,6 @@ import (
|
||||||
|
|
||||||
func RegisterRequiredBuildComponentsForTest(ctx android.RegistrationContext) {
|
func RegisterRequiredBuildComponentsForTest(ctx android.RegistrationContext) {
|
||||||
RegisterPrebuiltBuildComponents(ctx)
|
RegisterPrebuiltBuildComponents(ctx)
|
||||||
android.RegisterPrebuiltMutators(ctx)
|
|
||||||
|
|
||||||
RegisterCCBuildComponents(ctx)
|
RegisterCCBuildComponents(ctx)
|
||||||
RegisterBinaryBuildComponents(ctx)
|
RegisterBinaryBuildComponents(ctx)
|
||||||
RegisterLibraryBuildComponents(ctx)
|
RegisterLibraryBuildComponents(ctx)
|
||||||
|
@ -570,6 +568,7 @@ func CreateTestContext() *android.TestContext {
|
||||||
ctx.RegisterModuleType("vndk_prebuilt_shared", VndkPrebuiltSharedFactory)
|
ctx.RegisterModuleType("vndk_prebuilt_shared", VndkPrebuiltSharedFactory)
|
||||||
ctx.RegisterModuleType("vndk_libraries_txt", VndkLibrariesTxtFactory)
|
ctx.RegisterModuleType("vndk_libraries_txt", VndkLibrariesTxtFactory)
|
||||||
ctx.PreArchMutators(android.RegisterDefaultsPreArchMutators)
|
ctx.PreArchMutators(android.RegisterDefaultsPreArchMutators)
|
||||||
|
android.RegisterPrebuiltMutators(ctx)
|
||||||
RegisterRequiredBuildComponentsForTest(ctx)
|
RegisterRequiredBuildComponentsForTest(ctx)
|
||||||
ctx.RegisterSingletonType("vndk-snapshot", VndkSnapshotSingleton)
|
ctx.RegisterSingletonType("vndk-snapshot", VndkSnapshotSingleton)
|
||||||
ctx.RegisterSingletonType("vendor-snapshot", VendorSnapshotSingleton)
|
ctx.RegisterSingletonType("vendor-snapshot", VendorSnapshotSingleton)
|
||||||
|
|
|
@ -96,6 +96,8 @@ func testContext() *android.TestContext {
|
||||||
ctx.RegisterPreSingletonType("overlay", android.SingletonFactoryAdaptor(OverlaySingletonFactory))
|
ctx.RegisterPreSingletonType("overlay", android.SingletonFactoryAdaptor(OverlaySingletonFactory))
|
||||||
ctx.RegisterPreSingletonType("sdk_versions", android.SingletonFactoryAdaptor(sdkPreSingletonFactory))
|
ctx.RegisterPreSingletonType("sdk_versions", android.SingletonFactoryAdaptor(sdkPreSingletonFactory))
|
||||||
|
|
||||||
|
android.RegisterPrebuiltMutators(ctx)
|
||||||
|
|
||||||
// Register module types and mutators from cc needed for JNI testing
|
// Register module types and mutators from cc needed for JNI testing
|
||||||
cc.RegisterRequiredBuildComponentsForTest(ctx)
|
cc.RegisterRequiredBuildComponentsForTest(ctx)
|
||||||
|
|
||||||
|
|
|
@ -77,6 +77,7 @@ func GatherRequiredDepsForTest() string {
|
||||||
|
|
||||||
func CreateTestContext() *android.TestContext {
|
func CreateTestContext() *android.TestContext {
|
||||||
ctx := android.NewTestArchContext()
|
ctx := android.NewTestArchContext()
|
||||||
|
android.RegisterPrebuiltMutators(ctx)
|
||||||
cc.RegisterRequiredBuildComponentsForTest(ctx)
|
cc.RegisterRequiredBuildComponentsForTest(ctx)
|
||||||
ctx.RegisterModuleType("genrule", genrule.GenRuleFactory)
|
ctx.RegisterModuleType("genrule", genrule.GenRuleFactory)
|
||||||
ctx.RegisterModuleType("rust_binary", RustBinaryFactory)
|
ctx.RegisterModuleType("rust_binary", RustBinaryFactory)
|
||||||
|
|
|
@ -97,6 +97,11 @@ func testSdkContext(bp string, fs map[string][]byte, extraOsTypes []android.OsTy
|
||||||
ctx.PreArchMutators(android.RegisterVisibilityRuleChecker)
|
ctx.PreArchMutators(android.RegisterVisibilityRuleChecker)
|
||||||
ctx.PreArchMutators(android.RegisterDefaultsPreArchMutators)
|
ctx.PreArchMutators(android.RegisterDefaultsPreArchMutators)
|
||||||
ctx.PreArchMutators(android.RegisterComponentsMutator)
|
ctx.PreArchMutators(android.RegisterComponentsMutator)
|
||||||
|
|
||||||
|
android.RegisterPrebuiltMutators(ctx)
|
||||||
|
|
||||||
|
// Register these after the prebuilt mutators have been registered to match what
|
||||||
|
// happens at runtime.
|
||||||
ctx.PreArchMutators(android.RegisterVisibilityRuleGatherer)
|
ctx.PreArchMutators(android.RegisterVisibilityRuleGatherer)
|
||||||
ctx.PostDepsMutators(android.RegisterVisibilityRuleEnforcer)
|
ctx.PostDepsMutators(android.RegisterVisibilityRuleEnforcer)
|
||||||
|
|
||||||
|
|
|
@ -67,6 +67,8 @@ func testContext(config android.Config) *android.TestContext {
|
||||||
ctx.BottomUp("sysprop_deps", syspropDepsMutator).Parallel()
|
ctx.BottomUp("sysprop_deps", syspropDepsMutator).Parallel()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
android.RegisterPrebuiltMutators(ctx)
|
||||||
|
|
||||||
cc.RegisterRequiredBuildComponentsForTest(ctx)
|
cc.RegisterRequiredBuildComponentsForTest(ctx)
|
||||||
ctx.PreDepsMutators(func(ctx android.RegisterMutatorsContext) {
|
ctx.PreDepsMutators(func(ctx android.RegisterMutatorsContext) {
|
||||||
ctx.BottomUp("sysprop_java", java.SyspropMutator).Parallel()
|
ctx.BottomUp("sysprop_java", java.SyspropMutator).Parallel()
|
||||||
|
|
Loading…
Reference in New Issue