diff --git a/apex/apex_test.go b/apex/apex_test.go index fcf2343ca..e3b7f9541 100644 --- a/apex/apex_test.go +++ b/apex/apex_test.go @@ -240,7 +240,6 @@ func testApexContext(_ *testing.T, bp string, handlers ...testCustomizer) (*andr ctx.PreArchMutators(android.RegisterDefaultsPreArchMutators) ctx.PreArchMutators(android.RegisterComponentsMutator) - ctx.PostDepsMutators(android.RegisterOverridePostDepsMutators) android.RegisterPrebuiltMutators(ctx) @@ -249,6 +248,10 @@ func testApexContext(_ *testing.T, bp string, handlers ...testCustomizer) (*andr ctx.PreArchMutators(android.RegisterVisibilityRuleGatherer) ctx.PostDepsMutators(android.RegisterVisibilityRuleEnforcer) + // These must come after prebuilts and visibility rules to match runtime. + ctx.PostDepsMutators(android.RegisterOverridePostDepsMutators) + + // These must come after override rules to match the runtime. cc.RegisterRequiredBuildComponentsForTest(ctx) rust.RegisterRequiredBuildComponentsForTest(ctx) java.RegisterRequiredBuildComponentsForTest(ctx) @@ -5204,7 +5207,8 @@ func TestApexWithAppImportsPrefer(t *testing.T) { })) ensureExactContents(t, ctx, "myapex", "android_common_myapex_image", []string{ - "app/AppFoo/AppFooPrebuilt.apk", + // TODO(b/181974714) - this is wrong it should be "app/AppFoo/AppFooPrebuilt.apk" + "app/AppFoo/AppFoo.apk", }) } diff --git a/cc/testing.go b/cc/testing.go index 45e531208..6ae55afc4 100644 --- a/cc/testing.go +++ b/cc/testing.go @@ -20,12 +20,13 @@ import ( ) func RegisterRequiredBuildComponentsForTest(ctx android.RegistrationContext) { + // Genrule components must be registered before anything from cc to match runtime behavior. + genrule.RegisterGenruleBuildComponents(ctx) RegisterPrebuiltBuildComponents(ctx) RegisterCCBuildComponents(ctx) RegisterBinaryBuildComponents(ctx) RegisterLibraryBuildComponents(ctx) RegisterLibraryHeadersBuildComponents(ctx) - genrule.RegisterGenruleBuildComponents(ctx) ctx.RegisterModuleType("toolchain_library", ToolchainLibraryFactory) ctx.RegisterModuleType("llndk_library", LlndkLibraryFactory)