Move cc.imageMutator into the android package
Prepare for making the image mutator available to all modules and
moving it between the os and arch mutators by moving it into the
android package and using an interface implemented by the module
types to control it.
Bug: 142286466
Test: No unexpected changes to out/soong/build.ninja
Change-Id: I0dcc9c7b5ec80edffade340c367f6ae4da34151b
diff --git a/android/module.go b/android/module.go
index fa6388c..9e16e50 100644
--- a/android/module.go
+++ b/android/module.go
@@ -431,6 +431,9 @@
DebugName string `blueprint:"mutated"`
DebugMutators []string `blueprint:"mutated"`
DebugVariations []string `blueprint:"mutated"`
+
+ // set by ImageMutator
+ ImageVariation string `blueprint:"mutated"`
}
type hostAndDeviceProperties struct {
@@ -865,6 +868,21 @@
return m.noticeFile
}
+func (m *ModuleBase) setImageVariation(variant string) {
+ m.commonProperties.ImageVariation = variant
+}
+
+func (m *ModuleBase) ImageVariation() blueprint.Variation {
+ return blueprint.Variation{
+ Mutator: "image",
+ Variation: m.base().commonProperties.ImageVariation,
+ }
+}
+
+func (m *ModuleBase) InRecovery() bool {
+ return m.base().commonProperties.ImageVariation == RecoveryVariation
+}
+
func (m *ModuleBase) generateModuleTarget(ctx ModuleContext) {
allInstalledFiles := Paths{}
allCheckbuildFiles := Paths{}