Move prebuilts mutators after defaults have been applied

A follow up change will add a mechanism for a module to register a hook
that is called after any defaults have been applied. That is intended
for use by modules like java_sdk_library that create child modules that
are dependent upon properties that could be supplied by defaults.

Creating those child modules after prebuilts mutators are run will
cause problems if those child modules clash with prebuilts modules.
Moving the prebuilts mutators after the defaults mutators will fix
that.

Tests are currently being run with the mutators in different orders so
this change also cleans that up so they are consistent with the actual
code that is being run.

Bug: 155295806
Test: m checkbuild
Change-Id: I825c6df09058fb3a45db196661959eb332aca2f3
This commit is contained in:
Paul Duffin 2020-04-29 18:27:14 +01:00
parent 00789cc58b
commit c988c8e202
3 changed files with 6 additions and 6 deletions

View File

@ -82,10 +82,6 @@ type RegisterMutatorFunc func(RegisterMutatorsContext)
var preArch = []RegisterMutatorFunc{ var preArch = []RegisterMutatorFunc{
RegisterNamespaceMutator, RegisterNamespaceMutator,
// Create an association between prebuilt modules and their corresponding source
// modules (if any).
RegisterPrebuiltsPreArchMutators,
// Check the visibility rules are valid. // Check the visibility rules are valid.
// //
// This must run after the package renamer mutators so that any issues found during // This must run after the package renamer mutators so that any issues found during
@ -116,6 +112,10 @@ var preArch = []RegisterMutatorFunc{
// Apply properties from defaults modules to the referencing modules. // Apply properties from defaults modules to the referencing modules.
RegisterDefaultsPreArchMutators, RegisterDefaultsPreArchMutators,
// Create an association between prebuilt modules and their corresponding source
// modules (if any).
RegisterPrebuiltsPreArchMutators,
// Gather the visibility rules for all modules for us during visibility enforcement. // Gather the visibility rules for all modules for us during visibility enforcement.
// //
// This must come after the defaults mutators to ensure that any visibility supplied // This must come after the defaults mutators to ensure that any visibility supplied

View File

@ -4530,12 +4530,12 @@ func testNoUpdatableJarsInBootImage(t *testing.T, errmsg, bp string, transformDe
ctx.RegisterModuleType("apex", BundleFactory) ctx.RegisterModuleType("apex", BundleFactory)
ctx.RegisterModuleType("apex_key", ApexKeyFactory) ctx.RegisterModuleType("apex_key", ApexKeyFactory)
ctx.RegisterModuleType("filegroup", android.FileGroupFactory) ctx.RegisterModuleType("filegroup", android.FileGroupFactory)
ctx.PreArchMutators(android.RegisterDefaultsPreArchMutators)
cc.RegisterRequiredBuildComponentsForTest(ctx) cc.RegisterRequiredBuildComponentsForTest(ctx)
java.RegisterJavaBuildComponents(ctx) java.RegisterJavaBuildComponents(ctx)
java.RegisterSystemModulesBuildComponents(ctx) java.RegisterSystemModulesBuildComponents(ctx)
java.RegisterAppBuildComponents(ctx) java.RegisterAppBuildComponents(ctx)
java.RegisterDexpreoptBootJarsComponents(ctx) java.RegisterDexpreoptBootJarsComponents(ctx)
ctx.PreArchMutators(android.RegisterDefaultsPreArchMutators)
ctx.PostDepsMutators(android.RegisterOverridePostDepsMutators) ctx.PostDepsMutators(android.RegisterOverridePostDepsMutators)
ctx.PreDepsMutators(RegisterPreDepsMutators) ctx.PreDepsMutators(RegisterPreDepsMutators)
ctx.PostDepsMutators(RegisterPostDepsMutators) ctx.PostDepsMutators(RegisterPostDepsMutators)

View File

@ -485,8 +485,8 @@ func CreateTestContext() *android.TestContext {
ctx.RegisterModuleType("filegroup", android.FileGroupFactory) ctx.RegisterModuleType("filegroup", android.FileGroupFactory)
ctx.RegisterModuleType("vndk_prebuilt_shared", VndkPrebuiltSharedFactory) ctx.RegisterModuleType("vndk_prebuilt_shared", VndkPrebuiltSharedFactory)
ctx.RegisterModuleType("vndk_libraries_txt", VndkLibrariesTxtFactory) ctx.RegisterModuleType("vndk_libraries_txt", VndkLibrariesTxtFactory)
RegisterRequiredBuildComponentsForTest(ctx)
ctx.PreArchMutators(android.RegisterDefaultsPreArchMutators) ctx.PreArchMutators(android.RegisterDefaultsPreArchMutators)
RegisterRequiredBuildComponentsForTest(ctx)
ctx.RegisterSingletonType("vndk-snapshot", VndkSnapshotSingleton) ctx.RegisterSingletonType("vndk-snapshot", VndkSnapshotSingleton)
ctx.RegisterSingletonType("vendor-snapshot", VendorSnapshotSingleton) ctx.RegisterSingletonType("vendor-snapshot", VendorSnapshotSingleton)