summaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
Diffstat (limited to 'android')
-rw-r--r--android/arch.go34
-rw-r--r--android/defaults.go2
-rw-r--r--android/early_module_context.go2
-rw-r--r--android/module.go7
-rw-r--r--android/mutator.go148
-rw-r--r--android/mutator_test.go40
-rw-r--r--android/namespace.go2
-rw-r--r--android/namespace_test.go5
-rw-r--r--android/override_module.go10
-rw-r--r--android/packaging.go43
-rw-r--r--android/paths.go12
-rw-r--r--android/prebuilt.go10
-rw-r--r--android/register.go9
-rw-r--r--android/variable.go2
14 files changed, 179 insertions, 147 deletions
diff --git a/android/arch.go b/android/arch.go
index 1ec971d15..3cd6e4b7a 100644
--- a/android/arch.go
+++ b/android/arch.go
@@ -567,10 +567,6 @@ var DarwinUniversalVariantTag = archDepTag{name: "darwin universal binary"}
// "32": compile for only a single 32-bit Target supported by the OsClass.
// "64": compile for only a single 64-bit Target supported by the OsClass.
// "common": compile a for a single Target that will work on all Targets supported by the OsClass (for example Java).
-// "common_first": compile a for a Target that will work on all Targets supported by the OsClass
-// (same as "common"), plus a second Target for the preferred Target supported by the OsClass
-// (same as "first"). This is used for java_binary that produces a common .jar and a wrapper
-// executable script.
//
// Once the list of Targets is determined, the module is split into a variant for each Target.
//
@@ -702,11 +698,9 @@ func (a *archTransitionMutator) IncomingTransition(ctx IncomingTransitionContext
return ""
}
- if incomingVariation == "" {
- multilib, _ := decodeMultilib(ctx, base)
- if multilib == "common" {
- return "common"
- }
+ multilib, _ := decodeMultilib(ctx, base)
+ if multilib == "common" {
+ return "common"
}
return incomingVariation
}
@@ -756,8 +750,7 @@ func (a *archTransitionMutator) Mutate(ctx BottomUpMutatorContext, variation str
// Create a dependency for Darwin Universal binaries from the primary to secondary
// architecture. The module itself will be responsible for calling lipo to merge the outputs.
if os == Darwin {
- isUniversalBinary := (allArchInfo.Multilib == "darwin_universal" && len(allArchInfo.Targets) == 2) ||
- allArchInfo.Multilib == "darwin_universal_common_first" && len(allArchInfo.Targets) == 3
+ isUniversalBinary := allArchInfo.Multilib == "darwin_universal" && len(allArchInfo.Targets) == 2
isPrimary := variation == ctx.Config().BuildArch.String()
hasSecondaryConfigured := len(ctx.Config().Targets[Darwin]) > 1
if isUniversalBinary && isPrimary && hasSecondaryConfigured {
@@ -825,11 +818,7 @@ func decodeMultilib(ctx ConfigContext, base *ModuleBase) (multilib, extraMultili
// !UseTargetVariants, as the module has opted into handling the arch-specific logic on
// its own.
if os == Darwin && multilib != "common" && multilib != "32" {
- if multilib == "common_first" {
- multilib = "darwin_universal_common_first"
- } else {
- multilib = "darwin_universal"
- }
+ multilib = "darwin_universal"
}
return multilib, ""
@@ -1369,7 +1358,7 @@ func GetCompoundTargetField(os OsType, arch ArchType) string {
// Returns the structs corresponding to the properties specific to the given
// architecture and OS in archProperties.
-func getArchProperties(ctx BaseMutatorContext, archProperties interface{}, arch Arch, os OsType, nativeBridgeEnabled bool) []reflect.Value {
+func getArchProperties(ctx BaseModuleContext, archProperties interface{}, arch Arch, os OsType, nativeBridgeEnabled bool) []reflect.Value {
result := make([]reflect.Value, 0)
archPropValues := reflect.ValueOf(archProperties).Elem()
@@ -1941,13 +1930,6 @@ func decodeMultilibTargets(multilib string, targets []Target, prefer32 bool) ([]
switch multilib {
case "common":
buildTargets = getCommonTargets(targets)
- case "common_first":
- buildTargets = getCommonTargets(targets)
- if prefer32 {
- buildTargets = append(buildTargets, FirstTarget(targets, "lib32", "lib64")...)
- } else {
- buildTargets = append(buildTargets, FirstTarget(targets, "lib64", "lib32")...)
- }
case "both":
if prefer32 {
buildTargets = append(buildTargets, filterMultilibTargets(targets, "lib32")...)
@@ -1978,10 +1960,6 @@ func decodeMultilibTargets(multilib string, targets []Target, prefer32 bool) ([]
// Reverse the targets so that the first architecture can depend on the second
// architecture module in order to merge the outputs.
ReverseSliceInPlace(buildTargets)
- case "darwin_universal_common_first":
- archTargets := filterMultilibTargets(targets, "lib64")
- ReverseSliceInPlace(archTargets)
- buildTargets = append(getCommonTargets(targets), archTargets...)
default:
return nil, fmt.Errorf(`compile_multilib must be "both", "first", "32", "64", "prefer32" or "first_prefer32" found %q`,
multilib)
diff --git a/android/defaults.go b/android/defaults.go
index 3d06c69c9..8fe28796e 100644
--- a/android/defaults.go
+++ b/android/defaults.go
@@ -274,7 +274,7 @@ func (defaultable *DefaultableModuleBase) applyDefaultProperties(ctx BottomUpMut
func RegisterDefaultsPreArchMutators(ctx RegisterMutatorsContext) {
ctx.BottomUp("defaults_deps", defaultsDepsMutator).Parallel()
- ctx.BottomUp("defaults", defaultsMutator).Parallel()
+ ctx.BottomUp("defaults", defaultsMutator).Parallel().UsesCreateModule()
}
func defaultsDepsMutator(ctx BottomUpMutatorContext) {
diff --git a/android/early_module_context.go b/android/early_module_context.go
index 11de77146..9b1a9ea7e 100644
--- a/android/early_module_context.go
+++ b/android/early_module_context.go
@@ -29,7 +29,7 @@ type EarlyModuleContext interface {
Module() Module
// ModuleName returns the name of the module. This is generally the value that was returned by Module.Name() when
- // the module was created, but may have been modified by calls to BaseMutatorContext.Rename.
+ // the module was created, but may have been modified by calls to BottomUpMutatorContext.Rename.
ModuleName() string
// ModuleDir returns the path to the directory that contains the definition of the module.
diff --git a/android/module.go b/android/module.go
index 142cffa99..8415118cb 100644
--- a/android/module.go
+++ b/android/module.go
@@ -605,10 +605,9 @@ type hostCrossProperties struct {
type Multilib string
const (
- MultilibBoth Multilib = "both"
- MultilibFirst Multilib = "first"
- MultilibCommon Multilib = "common"
- MultilibCommonFirst Multilib = "common_first"
+ MultilibBoth Multilib = "both"
+ MultilibFirst Multilib = "first"
+ MultilibCommon Multilib = "common"
)
type HostOrDeviceSupported int
diff --git a/android/mutator.go b/android/mutator.go
index 8265458ba..0da3ec7d0 100644
--- a/android/mutator.go
+++ b/android/mutator.go
@@ -192,25 +192,10 @@ func FinalDepsMutators(f RegisterMutatorFunc) {
finalDeps = append(finalDeps, f)
}
-type BaseMutatorContext interface {
- BaseModuleContext
-
- // MutatorName returns the name that this mutator was registered with.
- MutatorName() string
-
- // Rename all variants of a module. The new name is not visible to calls to ModuleName,
- // AddDependency or OtherModuleName until after this mutator pass is complete.
- Rename(name string)
-
- // CreateModule creates a new module by calling the factory method for the specified moduleType, and applies
- // the specified property structs to it as if the properties were set in a blueprint file.
- CreateModule(ModuleFactory, ...interface{}) Module
-}
-
type TopDownMutator func(TopDownMutatorContext)
type TopDownMutatorContext interface {
- BaseMutatorContext
+ BaseModuleContext
}
type topDownMutatorContext struct {
@@ -221,7 +206,7 @@ type topDownMutatorContext struct {
type BottomUpMutator func(BottomUpMutatorContext)
type BottomUpMutatorContext interface {
- BaseMutatorContext
+ BaseModuleContext
// AddDependency adds a dependency to the given module. It returns a slice of modules for each
// dependency (some entries may be nil).
@@ -236,7 +221,8 @@ type BottomUpMutatorContext interface {
// Does not affect the ordering of the current mutator pass, but will be ordered
// correctly for all future mutator passes. All reverse dependencies for a destination module are
// collected until the end of the mutator pass, sorted by name, and then appended to the destination
- // module's dependency list.
+ // module's dependency list. May only be called by mutators that were marked with
+ // UsesReverseDependencies during registration.
AddReverseDependency(module blueprint.Module, tag blueprint.DependencyTag, name string)
// AddVariationDependencies adds deps as dependencies of the current module, but uses the variations
@@ -250,14 +236,15 @@ type BottomUpMutatorContext interface {
// be ordered correctly for all future mutator passes.
AddVariationDependencies(variations []blueprint.Variation, tag blueprint.DependencyTag, names ...string) []blueprint.Module
- // AddReverseVariationDependencies adds a dependency from the named module to the current
+ // AddReverseVariationDependency adds a dependency from the named module to the current
// module. The given variations will be added to the current module's varations, and then the
// result will be used to find the correct variation of the depending module, which must exist.
//
// Does not affect the ordering of the current mutator pass, but will be ordered
// correctly for all future mutator passes. All reverse dependencies for a destination module are
// collected until the end of the mutator pass, sorted by name, and then appended to the destination
- // module's dependency list.
+ // module's dependency list. May only be called by mutators that were marked with
+ // UsesReverseDependencies during registration.
AddReverseVariationDependency([]blueprint.Variation, blueprint.DependencyTag, string)
// AddFarVariationDependencies adds deps as dependencies of the current module, but uses the
@@ -277,14 +264,26 @@ type BottomUpMutatorContext interface {
// ReplaceDependencies finds all the variants of the module with the specified name, then
// replaces all dependencies onto those variants with the current variant of this module.
- // Replacements don't take effect until after the mutator pass is finished.
+ // Replacements don't take effect until after the mutator pass is finished. May only
+ // be called by mutators that were marked with UsesReplaceDependencies during registration.
ReplaceDependencies(string)
// ReplaceDependenciesIf finds all the variants of the module with the specified name, then
// replaces all dependencies onto those variants with the current variant of this module
// as long as the supplied predicate returns true.
- // Replacements don't take effect until after the mutator pass is finished.
+ // Replacements don't take effect until after the mutator pass is finished. May only
+ // be called by mutators that were marked with UsesReplaceDependencies during registration.
ReplaceDependenciesIf(string, blueprint.ReplaceDependencyPredicate)
+
+ // Rename all variants of a module. The new name is not visible to calls to ModuleName,
+ // AddDependency or OtherModuleName until after this mutator pass is complete. May only be called
+ // by mutators that were marked with UsesRename during registration.
+ Rename(name string)
+
+ // CreateModule creates a new module by calling the factory method for the specified moduleType, and applies
+ // the specified property structs to it as if the properties were set in a blueprint file. May only
+ // be called by mutators that were marked with UsesCreateModule during registration.
+ CreateModule(ModuleFactory, ...interface{}) Module
}
// An outgoingTransitionContextImpl and incomingTransitionContextImpl is created for every dependency of every module
@@ -627,13 +626,60 @@ func (mutator *mutator) register(ctx *Context) {
} else if mutator.transitionMutator != nil {
blueprintCtx.RegisterTransitionMutator(mutator.name, mutator.transitionMutator)
}
+
+ // Forward booleans set on the MutatorHandle to the blueprint.MutatorHandle.
if mutator.parallel {
handle.Parallel()
}
+ if mutator.usesRename {
+ handle.UsesRename()
+ }
+ if mutator.usesReverseDependencies {
+ handle.UsesReverseDependencies()
+ }
+ if mutator.usesReplaceDependencies {
+ handle.UsesReplaceDependencies()
+ }
+ if mutator.usesCreateModule {
+ handle.UsesCreateModule()
+ }
+ if mutator.mutatesDependencies {
+ handle.MutatesDependencies()
+ }
+ if mutator.mutatesGlobalState {
+ handle.MutatesGlobalState()
+ }
}
type MutatorHandle interface {
+ // Parallel sets the mutator to visit modules in parallel while maintaining ordering. Calling any
+ // method on the mutator context is thread-safe, but the mutator must handle synchronization
+ // for any modifications to global state or any modules outside the one it was invoked on.
Parallel() MutatorHandle
+
+ // UsesRename marks the mutator as using the BottomUpMutatorContext.Rename method, which prevents
+ // coalescing adjacent mutators into a single mutator pass.
+ UsesRename() MutatorHandle
+
+ // UsesReverseDependencies marks the mutator as using the BottomUpMutatorContext.AddReverseDependency
+ // method, which prevents coalescing adjacent mutators into a single mutator pass.
+ UsesReverseDependencies() MutatorHandle
+
+ // UsesReplaceDependencies marks the mutator as using the BottomUpMutatorContext.ReplaceDependencies
+ // method, which prevents coalescing adjacent mutators into a single mutator pass.
+ UsesReplaceDependencies() MutatorHandle
+
+ // UsesCreateModule marks the mutator as using the BottomUpMutatorContext.CreateModule method,
+ // which prevents coalescing adjacent mutators into a single mutator pass.
+ UsesCreateModule() MutatorHandle
+
+ // MutatesDependencies marks the mutator as modifying properties in dependencies, which prevents
+ // coalescing adjacent mutators into a single mutator pass.
+ MutatesDependencies() MutatorHandle
+
+ // MutatesGlobalState marks the mutator as modifying global state, which prevents coalescing
+ // adjacent mutators into a single mutator pass.
+ MutatesGlobalState() MutatorHandle
}
func (mutator *mutator) Parallel() MutatorHandle {
@@ -641,6 +687,36 @@ func (mutator *mutator) Parallel() MutatorHandle {
return mutator
}
+func (mutator *mutator) UsesRename() MutatorHandle {
+ mutator.usesRename = true
+ return mutator
+}
+
+func (mutator *mutator) UsesReverseDependencies() MutatorHandle {
+ mutator.usesReverseDependencies = true
+ return mutator
+}
+
+func (mutator *mutator) UsesReplaceDependencies() MutatorHandle {
+ mutator.usesReplaceDependencies = true
+ return mutator
+}
+
+func (mutator *mutator) UsesCreateModule() MutatorHandle {
+ mutator.usesCreateModule = true
+ return mutator
+}
+
+func (mutator *mutator) MutatesDependencies() MutatorHandle {
+ mutator.mutatesDependencies = true
+ return mutator
+}
+
+func (mutator *mutator) MutatesGlobalState() MutatorHandle {
+ mutator.mutatesGlobalState = true
+ return mutator
+}
+
func RegisterComponentsMutator(ctx RegisterMutatorsContext) {
ctx.BottomUp("component-deps", componentDepsMutator).Parallel()
}
@@ -660,7 +736,7 @@ func depsMutator(ctx BottomUpMutatorContext) {
}
func registerDepsMutator(ctx RegisterMutatorsContext) {
- ctx.BottomUp("deps", depsMutator).Parallel()
+ ctx.BottomUp("deps", depsMutator).Parallel().UsesReverseDependencies()
}
// android.topDownMutatorContext either has to embed blueprint.TopDownMutatorContext, in which case every method that
@@ -669,32 +745,6 @@ func registerDepsMutator(ctx RegisterMutatorsContext) {
// non-overridden method has to be forwarded. There are fewer non-overridden methods, so use the latter. The following
// methods forward to the identical blueprint versions for topDownMutatorContext and bottomUpMutatorContext.
-func (t *topDownMutatorContext) MutatorName() string {
- return t.bp.MutatorName()
-}
-
-func (t *topDownMutatorContext) Rename(name string) {
- t.bp.Rename(name)
- t.Module().base().commonProperties.DebugName = name
-}
-
-func (t *topDownMutatorContext) createModule(factory blueprint.ModuleFactory, name string, props ...interface{}) blueprint.Module {
- return t.bp.CreateModule(factory, name, props...)
-}
-
-func (t *topDownMutatorContext) CreateModule(factory ModuleFactory, props ...interface{}) Module {
- return createModule(t, factory, "_topDownMutatorModule", props...)
-}
-
-func (t *topDownMutatorContext) createModuleWithoutInheritance(factory ModuleFactory, props ...interface{}) Module {
- module := t.bp.CreateModule(ModuleFactoryAdaptor(factory), "", props...).(Module)
- return module
-}
-
-func (b *bottomUpMutatorContext) MutatorName() string {
- return b.bp.MutatorName()
-}
-
func (b *bottomUpMutatorContext) Rename(name string) {
b.bp.Rename(name)
b.Module().base().commonProperties.DebugName = name
diff --git a/android/mutator_test.go b/android/mutator_test.go
index 5d4074a54..33fca9e8b 100644
--- a/android/mutator_test.go
+++ b/android/mutator_test.go
@@ -134,10 +134,6 @@ func TestModuleString(t *testing.T) {
return []string{"a", "b"}
},
})
- ctx.TopDown("rename_top_down", func(ctx TopDownMutatorContext) {
- moduleStrings = append(moduleStrings, ctx.Module().String())
- ctx.Rename(ctx.Module().base().Name() + "_renamed1")
- })
})
ctx.PreDepsMutators(func(ctx RegisterMutatorsContext) {
@@ -161,8 +157,8 @@ func TestModuleString(t *testing.T) {
})
ctx.BottomUp("rename_bottom_up", func(ctx BottomUpMutatorContext) {
moduleStrings = append(moduleStrings, ctx.Module().String())
- ctx.Rename(ctx.Module().base().Name() + "_renamed2")
- })
+ ctx.Rename(ctx.Module().base().Name() + "_renamed1")
+ }).UsesRename()
ctx.BottomUp("final", func(ctx BottomUpMutatorContext) {
moduleStrings = append(moduleStrings, ctx.Module().String())
})
@@ -181,17 +177,23 @@ func TestModuleString(t *testing.T) {
"foo{pre_arch:b}",
"foo{pre_arch:a}",
- // After rename_top_down (reversed because pre_deps TransitionMutator.Split is TopDown).
- "foo_renamed1{pre_arch:b}",
- "foo_renamed1{pre_arch:a}",
-
// After pre_deps (reversed because post_deps TransitionMutator.Split is TopDown).
- "foo_renamed1{pre_arch:b,pre_deps:d}",
- "foo_renamed1{pre_arch:b,pre_deps:c}",
- "foo_renamed1{pre_arch:a,pre_deps:d}",
- "foo_renamed1{pre_arch:a,pre_deps:c}",
+ "foo{pre_arch:b,pre_deps:d}",
+ "foo{pre_arch:b,pre_deps:c}",
+ "foo{pre_arch:a,pre_deps:d}",
+ "foo{pre_arch:a,pre_deps:c}",
// After post_deps.
+ "foo{pre_arch:a,pre_deps:c,post_deps:e}",
+ "foo{pre_arch:a,pre_deps:c,post_deps:f}",
+ "foo{pre_arch:a,pre_deps:d,post_deps:e}",
+ "foo{pre_arch:a,pre_deps:d,post_deps:f}",
+ "foo{pre_arch:b,pre_deps:c,post_deps:e}",
+ "foo{pre_arch:b,pre_deps:c,post_deps:f}",
+ "foo{pre_arch:b,pre_deps:d,post_deps:e}",
+ "foo{pre_arch:b,pre_deps:d,post_deps:f}",
+
+ // After rename_bottom_up.
"foo_renamed1{pre_arch:a,pre_deps:c,post_deps:e}",
"foo_renamed1{pre_arch:a,pre_deps:c,post_deps:f}",
"foo_renamed1{pre_arch:a,pre_deps:d,post_deps:e}",
@@ -200,16 +202,6 @@ func TestModuleString(t *testing.T) {
"foo_renamed1{pre_arch:b,pre_deps:c,post_deps:f}",
"foo_renamed1{pre_arch:b,pre_deps:d,post_deps:e}",
"foo_renamed1{pre_arch:b,pre_deps:d,post_deps:f}",
-
- // After rename_bottom_up.
- "foo_renamed2{pre_arch:a,pre_deps:c,post_deps:e}",
- "foo_renamed2{pre_arch:a,pre_deps:c,post_deps:f}",
- "foo_renamed2{pre_arch:a,pre_deps:d,post_deps:e}",
- "foo_renamed2{pre_arch:a,pre_deps:d,post_deps:f}",
- "foo_renamed2{pre_arch:b,pre_deps:c,post_deps:e}",
- "foo_renamed2{pre_arch:b,pre_deps:c,post_deps:f}",
- "foo_renamed2{pre_arch:b,pre_deps:d,post_deps:e}",
- "foo_renamed2{pre_arch:b,pre_deps:d,post_deps:f}",
}
AssertDeepEquals(t, "module String() values", want, moduleStrings)
diff --git a/android/namespace.go b/android/namespace.go
index ebf85a1fd..866d12594 100644
--- a/android/namespace.go
+++ b/android/namespace.go
@@ -457,7 +457,7 @@ func NamespaceFactory() Module {
}
func RegisterNamespaceMutator(ctx RegisterMutatorsContext) {
- ctx.BottomUp("namespace_deps", namespaceMutator).Parallel()
+ ctx.BottomUp("namespace_deps", namespaceMutator).Parallel().MutatesGlobalState()
}
func namespaceMutator(ctx BottomUpMutatorContext) {
diff --git a/android/namespace_test.go b/android/namespace_test.go
index ea51c6eae..0327e7824 100644
--- a/android/namespace_test.go
+++ b/android/namespace_test.go
@@ -646,7 +646,7 @@ var prepareForTestWithNamespace = GroupFixturePreparers(
ctx.RegisterModuleType("test_module", newTestModule)
ctx.Context.RegisterModuleType("blueprint_test_module", newBlueprintTestModule)
ctx.PreDepsMutators(func(ctx RegisterMutatorsContext) {
- ctx.BottomUp("rename", renameMutator)
+ ctx.BottomUp("rename", renameMutator).UsesRename()
})
}),
)
@@ -709,9 +709,6 @@ type testModule struct {
}
func (m *testModule) DepsMutator(ctx BottomUpMutatorContext) {
- if m.properties.Rename != "" {
- ctx.Rename(m.properties.Rename)
- }
for _, d := range m.properties.Deps {
ctx.AddDependency(ctx.Module(), nil, d)
}
diff --git a/android/override_module.go b/android/override_module.go
index f69f96309..d844da616 100644
--- a/android/override_module.go
+++ b/android/override_module.go
@@ -234,8 +234,9 @@ func (b *OverridableModuleBase) OverridablePropertiesDepsMutator(ctx BottomUpMut
// Mutators for override/overridable modules. All the fun happens in these functions. It is critical
// to keep them in this order and not put any order mutators between them.
func RegisterOverridePostDepsMutators(ctx RegisterMutatorsContext) {
- ctx.BottomUp("override_deps", overrideModuleDepsMutator).Parallel()
+ ctx.BottomUp("override_deps", overrideModuleDepsMutator).Parallel().MutatesDependencies() // modifies deps via addOverride
ctx.Transition("override", &overrideTransitionMutator{})
+ ctx.BottomUp("override_apply", overrideApplyMutator).Parallel().MutatesDependencies()
// overridableModuleDepsMutator calls OverridablePropertiesDepsMutator so that overridable modules can
// add deps from overridable properties.
ctx.BottomUp("overridable_deps", overridableModuleDepsMutator).Parallel()
@@ -243,8 +244,8 @@ func RegisterOverridePostDepsMutators(ctx RegisterMutatorsContext) {
// prebuilt's ReplaceDependencies doesn't affect to those deps added by overridable properties.
// By running PrebuiltPostDepsMutator again after overridableModuleDepsMutator, deps via overridable properties
// can be replaced with prebuilts.
- ctx.BottomUp("replace_deps_on_prebuilts_for_overridable_deps_again", PrebuiltPostDepsMutator).Parallel()
- ctx.BottomUp("replace_deps_on_override", replaceDepsOnOverridingModuleMutator).Parallel()
+ ctx.BottomUp("replace_deps_on_prebuilts_for_overridable_deps_again", PrebuiltPostDepsMutator).Parallel().UsesReplaceDependencies()
+ ctx.BottomUp("replace_deps_on_override", replaceDepsOnOverridingModuleMutator).Parallel().UsesReplaceDependencies()
}
type overrideBaseDependencyTag struct {
@@ -330,6 +331,9 @@ func (overrideTransitionMutator) IncomingTransition(ctx IncomingTransitionContex
}
func (overrideTransitionMutator) Mutate(ctx BottomUpMutatorContext, variation string) {
+}
+
+func overrideApplyMutator(ctx BottomUpMutatorContext) {
if o, ok := ctx.Module().(OverrideModule); ok {
overridableDeps := ctx.GetDirectDepsWithTag(overrideBaseDepTag)
if len(overridableDeps) > 1 {
diff --git a/android/packaging.go b/android/packaging.go
index 3c64d56f0..d6158715c 100644
--- a/android/packaging.go
+++ b/android/packaging.go
@@ -65,30 +65,32 @@ type PackagingSpec struct {
}
type packagingSpecGob struct {
- RelPathInPackage string
- SrcPath Path
- SymlinkTarget string
- Executable bool
- Partition string
- SkipInstall bool
- AconfigPaths *Paths
- ArchType ArchType
- Overrides *[]string
- Owner string
+ RelPathInPackage string
+ SrcPath Path
+ SymlinkTarget string
+ Executable bool
+ EffectiveLicenseFiles *Paths
+ Partition string
+ SkipInstall bool
+ AconfigPaths *Paths
+ ArchType ArchType
+ Overrides *[]string
+ Owner string
}
func (p *PackagingSpec) ToGob() *packagingSpecGob {
return &packagingSpecGob{
- RelPathInPackage: p.relPathInPackage,
- SrcPath: p.srcPath,
- SymlinkTarget: p.symlinkTarget,
- Executable: p.executable,
- Partition: p.partition,
- SkipInstall: p.skipInstall,
- AconfigPaths: p.aconfigPaths,
- ArchType: p.archType,
- Overrides: p.overrides,
- Owner: p.owner,
+ RelPathInPackage: p.relPathInPackage,
+ SrcPath: p.srcPath,
+ SymlinkTarget: p.symlinkTarget,
+ Executable: p.executable,
+ EffectiveLicenseFiles: p.effectiveLicenseFiles,
+ Partition: p.partition,
+ SkipInstall: p.skipInstall,
+ AconfigPaths: p.aconfigPaths,
+ ArchType: p.archType,
+ Overrides: p.overrides,
+ Owner: p.owner,
}
}
@@ -97,6 +99,7 @@ func (p *PackagingSpec) FromGob(data *packagingSpecGob) {
p.srcPath = data.SrcPath
p.symlinkTarget = data.SymlinkTarget
p.executable = data.Executable
+ p.effectiveLicenseFiles = data.EffectiveLicenseFiles
p.partition = data.Partition
p.skipInstall = data.SkipInstall
p.aconfigPaths = data.AconfigPaths
diff --git a/android/paths.go b/android/paths.go
index 9c2df6589..ec05831ca 100644
--- a/android/paths.go
+++ b/android/paths.go
@@ -1363,21 +1363,21 @@ type OutputPath struct {
}
type outputPathGob struct {
- basePath
+ BasePath basePath
OutDir string
FullPath string
}
func (p *OutputPath) ToGob() *outputPathGob {
return &outputPathGob{
- basePath: p.basePath,
+ BasePath: p.basePath,
OutDir: p.outDir,
FullPath: p.fullPath,
}
}
func (p *OutputPath) FromGob(data *outputPathGob) {
- p.basePath = data.basePath
+ p.basePath = data.BasePath
p.outDir = data.OutDir
p.fullPath = data.FullPath
}
@@ -1788,7 +1788,7 @@ type InstallPath struct {
}
type installPathGob struct {
- basePath
+ BasePath basePath
SoongOutDir string
PartitionDir string
Partition string
@@ -1798,7 +1798,7 @@ type installPathGob struct {
func (p *InstallPath) ToGob() *installPathGob {
return &installPathGob{
- basePath: p.basePath,
+ BasePath: p.basePath,
SoongOutDir: p.soongOutDir,
PartitionDir: p.partitionDir,
Partition: p.partition,
@@ -1808,7 +1808,7 @@ func (p *InstallPath) ToGob() *installPathGob {
}
func (p *InstallPath) FromGob(data *installPathGob) {
- p.basePath = data.basePath
+ p.basePath = data.BasePath
p.soongOutDir = data.SoongOutDir
p.partitionDir = data.PartitionDir
p.partition = data.Partition
diff --git a/android/prebuilt.go b/android/prebuilt.go
index 4f04d057b..017ba76c3 100644
--- a/android/prebuilt.go
+++ b/android/prebuilt.go
@@ -400,13 +400,13 @@ func PrebuiltGetPreferred(ctx BaseModuleContext, module Module) Module {
}
func RegisterPrebuiltsPreArchMutators(ctx RegisterMutatorsContext) {
- ctx.BottomUp("prebuilt_rename", PrebuiltRenameMutator).Parallel()
+ ctx.BottomUp("prebuilt_rename", PrebuiltRenameMutator).Parallel().UsesRename()
}
func RegisterPrebuiltsPostDepsMutators(ctx RegisterMutatorsContext) {
- ctx.BottomUp("prebuilt_source", PrebuiltSourceDepsMutator).Parallel()
+ ctx.BottomUp("prebuilt_source", PrebuiltSourceDepsMutator).Parallel().UsesReverseDependencies()
ctx.BottomUp("prebuilt_select", PrebuiltSelectModuleMutator).Parallel()
- ctx.BottomUp("prebuilt_postdeps", PrebuiltPostDepsMutator).Parallel()
+ ctx.BottomUp("prebuilt_postdeps", PrebuiltPostDepsMutator).Parallel().UsesReplaceDependencies()
}
// Returns the name of the source module corresponding to a prebuilt module
@@ -677,7 +677,7 @@ type createdByJavaSdkLibraryName interface {
//
// Even though this is a cc_prebuilt_library_shared, we create both the variants today
// https://source.corp.google.com/h/googleplex-android/platform/build/soong/+/e08e32b45a18a77bc3c3e751f730539b1b374f1b:cc/library.go;l=2113-2116;drc=2c4a9779cd1921d0397a12b3d3521f4c9b30d747;bpv=1;bpt=0
-func (p *Prebuilt) variantIsDisabled(ctx BaseMutatorContext, prebuilt Module) bool {
+func (p *Prebuilt) variantIsDisabled(ctx BaseModuleContext, prebuilt Module) bool {
return p.srcsSupplier != nil && len(p.srcsSupplier(ctx, prebuilt)) == 0
}
@@ -687,7 +687,7 @@ type apexVariationName interface {
// usePrebuilt returns true if a prebuilt should be used instead of the source module. The prebuilt
// will be used if it is marked "prefer" or if the source module is disabled.
-func (p *Prebuilt) usePrebuilt(ctx BaseMutatorContext, source Module, prebuilt Module) bool {
+func (p *Prebuilt) usePrebuilt(ctx BaseModuleContext, source Module, prebuilt Module) bool {
isMainlinePrebuilt := func(prebuilt Module) bool {
apex, ok := prebuilt.(apexVariationName)
if !ok {
diff --git a/android/register.go b/android/register.go
index 2ce602580..94d875d19 100644
--- a/android/register.go
+++ b/android/register.go
@@ -91,7 +91,14 @@ type mutator struct {
bottomUpMutator blueprint.BottomUpMutator
topDownMutator blueprint.TopDownMutator
transitionMutator blueprint.TransitionMutator
- parallel bool
+
+ parallel bool
+ usesRename bool
+ usesReverseDependencies bool
+ usesReplaceDependencies bool
+ usesCreateModule bool
+ mutatesDependencies bool
+ mutatesGlobalState bool
}
var _ sortableComponent = &mutator{}
diff --git a/android/variable.go b/android/variable.go
index 248e1e853..4210f6720 100644
--- a/android/variable.go
+++ b/android/variable.go
@@ -478,6 +478,8 @@ type ProductVariables struct {
ProductManufacturer string `json:",omitempty"`
ProductBrand string `json:",omitempty"`
+ ProductDevice string `json:",omitempty"`
+ ProductModel string `json:",omitempty"`
ReleaseVersion string `json:",omitempty"`
ReleaseAconfigValueSets []string `json:",omitempty"`