Move ImageMutator after archMutator
Move the ImageMutator to be registered just after the archMutator in preparation for moving it between osMutator and archMutator. Requries updating variants in a few tests that now run the ImageMutator. Bug: 142286466 Test: no change to build.ninja Test: all soong tests Change-Id: Ia9d2a7bc0e225bedec3c9a83ea04f471a931bf47
This commit is contained in:
parent
f3c24c12ef
commit
ae6c5207cc
|
@ -14,7 +14,7 @@
|
|||
|
||||
package android
|
||||
|
||||
// ImageInterface is implemented by modules that need to be split by the ImageMutator.
|
||||
// ImageInterface is implemented by modules that need to be split by the imageMutator.
|
||||
type ImageInterface interface {
|
||||
// ImageMutatorBegin is called before any other method in the ImageInterface.
|
||||
ImageMutatorBegin(ctx BaseModuleContext)
|
||||
|
@ -48,9 +48,9 @@ const (
|
|||
RecoveryVariation string = "recovery"
|
||||
)
|
||||
|
||||
// ImageMutator creates variants for modules that implement the ImageInterface that
|
||||
// imageMutator creates variants for modules that implement the ImageInterface that
|
||||
// allow them to build differently for each partition (recovery, core, vendor, etc.).
|
||||
func ImageMutator(ctx BottomUpMutatorContext) {
|
||||
func imageMutator(ctx BottomUpMutatorContext) {
|
||||
if ctx.Os() != Android {
|
||||
return
|
||||
}
|
||||
|
|
|
@ -89,6 +89,7 @@ func registerArchMutator(ctx RegisterMutatorsContext) {
|
|||
ctx.BottomUp("os", osMutator).Parallel()
|
||||
ctx.BottomUp("arch", archMutator).Parallel()
|
||||
ctx.TopDown("arch_hooks", archHookMutator).Parallel()
|
||||
ctx.BottomUp("image", imageMutator).Parallel()
|
||||
}
|
||||
|
||||
var preDeps = []RegisterMutatorFunc{
|
||||
|
|
|
@ -29,9 +29,6 @@ func testPrebuiltEtc(t *testing.T, bp string) (*TestContext, Config) {
|
|||
ctx.RegisterModuleType("prebuilt_usr_share_host", PrebuiltUserShareHostFactory)
|
||||
ctx.RegisterModuleType("prebuilt_font", PrebuiltFontFactory)
|
||||
ctx.RegisterModuleType("prebuilt_firmware", PrebuiltFirmwareFactory)
|
||||
ctx.PreDepsMutators(func(ctx RegisterMutatorsContext) {
|
||||
ctx.BottomUp("prebuilt_etc", ImageMutator).Parallel()
|
||||
})
|
||||
ctx.Register()
|
||||
mockFiles := map[string][]byte{
|
||||
"Android.bp": []byte(bp),
|
||||
|
|
|
@ -140,7 +140,6 @@ func testApexContext(t *testing.T, bp string, handlers ...testCustomizer) (*andr
|
|||
ctx.BottomUp("prebuilts", android.PrebuiltMutator).Parallel()
|
||||
})
|
||||
ctx.PreDepsMutators(func(ctx android.RegisterMutatorsContext) {
|
||||
ctx.BottomUp("image", android.ImageMutator).Parallel()
|
||||
ctx.BottomUp("link", cc.LinkageMutator).Parallel()
|
||||
ctx.BottomUp("vndk", cc.VndkMutator).Parallel()
|
||||
ctx.BottomUp("test_per_src", cc.TestPerSrcMutator).Parallel()
|
||||
|
|
3
cc/cc.go
3
cc/cc.go
|
@ -37,7 +37,6 @@ func init() {
|
|||
|
||||
android.PreDepsMutators(func(ctx android.RegisterMutatorsContext) {
|
||||
ctx.BottomUp("vndk", VndkMutator).Parallel()
|
||||
ctx.BottomUp("image", android.ImageMutator).Parallel()
|
||||
ctx.BottomUp("link", LinkageMutator).Parallel()
|
||||
ctx.BottomUp("ndk_api", ndkApiMutator).Parallel()
|
||||
ctx.BottomUp("test_per_src", TestPerSrcMutator).Parallel()
|
||||
|
@ -218,7 +217,7 @@ type BaseProperties struct {
|
|||
// Make this module available when building for recovery
|
||||
Recovery_available *bool
|
||||
|
||||
// Set by ImageMutator
|
||||
// Set by imageMutator
|
||||
CoreVariantNeeded bool `blueprint:"mutated"`
|
||||
RecoveryVariantNeeded bool `blueprint:"mutated"`
|
||||
VendorVariants []string `blueprint:"mutated"`
|
||||
|
|
|
@ -74,13 +74,13 @@ func TestArchGenruleCmd(t *testing.T) {
|
|||
t.Fatal(errs)
|
||||
}
|
||||
|
||||
gen := ctx.ModuleForTests("gen", "android_arm_armv7-a-neon").Output("out_arm")
|
||||
gen := ctx.ModuleForTests("gen", "android_arm_armv7-a-neon_core").Output("out_arm")
|
||||
expected := []string{"foo"}
|
||||
if !reflect.DeepEqual(expected, gen.Inputs.Strings()) {
|
||||
t.Errorf(`want arm inputs %v, got %v`, expected, gen.Inputs.Strings())
|
||||
}
|
||||
|
||||
gen = ctx.ModuleForTests("gen", "android_arm64_armv8-a").Output("out_arm64")
|
||||
gen = ctx.ModuleForTests("gen", "android_arm64_armv8-a_core").Output("out_arm64")
|
||||
expected = []string{"bar"}
|
||||
if !reflect.DeepEqual(expected, gen.Inputs.Strings()) {
|
||||
t.Errorf(`want arm64 inputs %v, got %v`, expected, gen.Inputs.Strings())
|
||||
|
|
|
@ -271,7 +271,6 @@ func CreateTestContext(bp string, fs map[string][]byte,
|
|||
ctx.RegisterModuleType("vndk_prebuilt_shared", VndkPrebuiltSharedFactory)
|
||||
ctx.RegisterModuleType("vndk_libraries_txt", VndkLibrariesTxtFactory)
|
||||
ctx.PreDepsMutators(func(ctx android.RegisterMutatorsContext) {
|
||||
ctx.BottomUp("image", android.ImageMutator).Parallel()
|
||||
ctx.BottomUp("link", LinkageMutator).Parallel()
|
||||
ctx.BottomUp("vndk", VndkMutator).Parallel()
|
||||
ctx.BottomUp("version", VersionMutator).Parallel()
|
||||
|
|
|
@ -1177,7 +1177,7 @@ func TestJavaSdkLibrary(t *testing.T) {
|
|||
ctx.ModuleForTests("foo"+sdkDocsSuffix, "android_common")
|
||||
ctx.ModuleForTests("foo"+sdkDocsSuffix+sdkSystemApiSuffix, "android_common")
|
||||
ctx.ModuleForTests("foo"+sdkDocsSuffix+sdkTestApiSuffix, "android_common")
|
||||
ctx.ModuleForTests("foo"+sdkXmlFileSuffix, "android_arm64_armv8-a")
|
||||
ctx.ModuleForTests("foo"+sdkXmlFileSuffix, "android_arm64_armv8-a_core")
|
||||
ctx.ModuleForTests("foo.api.public.28", "")
|
||||
ctx.ModuleForTests("foo.api.system.28", "")
|
||||
ctx.ModuleForTests("foo.api.test.28", "")
|
||||
|
|
|
@ -185,7 +185,6 @@ func CreateTestContext(bp string) *android.TestContext {
|
|||
ctx.RegisterModuleType("toolchain_library", cc.ToolchainLibraryFactory)
|
||||
ctx.PreDepsMutators(func(ctx android.RegisterMutatorsContext) {
|
||||
// cc mutators
|
||||
ctx.BottomUp("image", android.ImageMutator).Parallel()
|
||||
ctx.BottomUp("link", cc.LinkageMutator).Parallel()
|
||||
ctx.BottomUp("version", cc.VersionMutator).Parallel()
|
||||
ctx.BottomUp("begin", cc.BeginMutator).Parallel()
|
||||
|
|
|
@ -58,7 +58,6 @@ func testSdkContext(bp string, fs map[string][]byte) (*android.TestContext, andr
|
|||
ctx.RegisterModuleType("llndk_library", cc.LlndkLibraryFactory)
|
||||
ctx.RegisterModuleType("toolchain_library", cc.ToolchainLibraryFactory)
|
||||
ctx.PreDepsMutators(func(ctx android.RegisterMutatorsContext) {
|
||||
ctx.BottomUp("image", android.ImageMutator).Parallel()
|
||||
ctx.BottomUp("link", cc.LinkageMutator).Parallel()
|
||||
ctx.BottomUp("vndk", cc.VndkMutator).Parallel()
|
||||
ctx.BottomUp("test_per_src", cc.TestPerSrcMutator).Parallel()
|
||||
|
|
|
@ -73,7 +73,6 @@ func testContext(config android.Config, bp string,
|
|||
ctx.RegisterModuleType("llndk_library", cc.LlndkLibraryFactory)
|
||||
ctx.RegisterModuleType("toolchain_library", cc.ToolchainLibraryFactory)
|
||||
ctx.PreDepsMutators(func(ctx android.RegisterMutatorsContext) {
|
||||
ctx.BottomUp("image", android.ImageMutator).Parallel()
|
||||
ctx.BottomUp("link", cc.LinkageMutator).Parallel()
|
||||
ctx.BottomUp("vndk", cc.VndkMutator).Parallel()
|
||||
ctx.BottomUp("version", cc.VersionMutator).Parallel()
|
||||
|
|
|
@ -104,7 +104,7 @@ func TestPrebuiltEtcXml(t *testing.T) {
|
|||
{rule: "xmllint-minimal", input: "baz.xml"},
|
||||
} {
|
||||
t.Run(tc.schemaType, func(t *testing.T) {
|
||||
rule := ctx.ModuleForTests(tc.input, "android_arm64_armv8-a").Rule(tc.rule)
|
||||
rule := ctx.ModuleForTests(tc.input, "android_arm64_armv8-a_core").Rule(tc.rule)
|
||||
assertEqual(t, "input", tc.input, rule.Input.String())
|
||||
if tc.schemaType != "" {
|
||||
assertEqual(t, "schema", tc.schema, rule.Args[tc.schemaType])
|
||||
|
@ -112,6 +112,6 @@ func TestPrebuiltEtcXml(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
m := ctx.ModuleForTests("foo.xml", "android_arm64_armv8-a").Module().(*prebuiltEtcXml)
|
||||
m := ctx.ModuleForTests("foo.xml", "android_arm64_armv8-a_core").Module().(*prebuiltEtcXml)
|
||||
assertEqual(t, "installDir", buildDir+"/target/product/test_device/system/etc", m.InstallDirPath().String())
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue