diff options
Diffstat (limited to 'android/module.go')
-rw-r--r-- | android/module.go | 50 |
1 files changed, 37 insertions, 13 deletions
diff --git a/android/module.go b/android/module.go index 35513d69d..9f73729fb 100644 --- a/android/module.go +++ b/android/module.go @@ -111,10 +111,6 @@ type Module interface { TargetRequiredModuleNames() []string VintfFragmentModuleNames(ctx ConfigAndErrorContext) []string - // TransitivePackagingSpecs returns the PackagingSpecs for this module and any transitive - // dependencies with dependency tags for which IsInstallDepNeeded() returns true. - TransitivePackagingSpecs() []PackagingSpec - ConfigurableEvaluator(ctx ConfigAndErrorContext) proptools.ConfigurableEvaluator } @@ -830,8 +826,7 @@ type ModuleBase struct { // The primary licenses property, may be nil, records license metadata for the module. primaryLicensesProperty applicableLicensesProperty - noAddressSanitizer bool - packagingSpecsDepSet *DepSet[PackagingSpec] + noAddressSanitizer bool hooks hooks @@ -1437,10 +1432,6 @@ func isInstallDepNeeded(dep Module, tag blueprint.DependencyTag) bool { return IsInstallDepNeededTag(tag) } -func (m *ModuleBase) TransitivePackagingSpecs() []PackagingSpec { - return m.packagingSpecsDepSet.ToList() -} - func (m *ModuleBase) NoAddressSanitizer() bool { return m.noAddressSanitizer } @@ -1929,6 +1920,13 @@ func (m *ModuleBase) GenerateBuildActions(blueprintCtx blueprint.ModuleContext) if ctx.Failed() { return } + + if x, ok := m.module.(IDEInfo); ok { + var result IdeInfo + x.IDEInfo(ctx, &result) + result.BaseModuleName = x.BaseModuleName() + SetProvider(ctx, IdeInfoProviderKey, result) + } } if incrementalEnabled && cacheKey != nil { @@ -1968,8 +1966,7 @@ func (m *ModuleBase) GenerateBuildActions(blueprintCtx blueprint.ModuleContext) ctx.TransitiveInstallFiles = NewDepSet[InstallPath](TOPOLOGICAL, ctx.installFiles, dependencyInstallFiles) installFiles.TransitiveInstallFiles = ctx.TransitiveInstallFiles - m.packagingSpecsDepSet = NewDepSet[PackagingSpec](TOPOLOGICAL, ctx.packagingSpecs, dependencyPackagingSpecs) - installFiles.TransitivePackagingSpecs = m.packagingSpecsDepSet + installFiles.TransitivePackagingSpecs = NewDepSet[PackagingSpec](TOPOLOGICAL, ctx.packagingSpecs, dependencyPackagingSpecs) SetProvider(ctx, InstallFilesProvider, installFiles) buildLicenseMetadata(ctx, ctx.licenseMetadataFile) @@ -2710,7 +2707,7 @@ func (c *buildTargetSingleton) GenerateBuildActions(ctx SingletonContext) { // Collect information for opening IDE project files in java/jdeps.go. type IDEInfo interface { - IDEInfo(ideInfo *IdeInfo) + IDEInfo(ctx BaseModuleContext, ideInfo *IdeInfo) BaseModuleName() string } @@ -2722,7 +2719,9 @@ type IDECustomizedModuleName interface { IDECustomizedModuleName() string } +// Collect information for opening IDE project files in java/jdeps.go. type IdeInfo struct { + BaseModuleName string `json:"-"` Deps []string `json:"dependencies,omitempty"` Srcs []string `json:"srcs,omitempty"` Aidl_include_dirs []string `json:"aidl_include_dirs,omitempty"` @@ -2736,6 +2735,31 @@ type IdeInfo struct { Libs []string `json:"libs,omitempty"` } +// Merge merges two IdeInfos and produces a new one, leaving the origional unchanged +func (i IdeInfo) Merge(other IdeInfo) IdeInfo { + return IdeInfo{ + Deps: mergeStringLists(i.Deps, other.Deps), + Srcs: mergeStringLists(i.Srcs, other.Srcs), + Aidl_include_dirs: mergeStringLists(i.Aidl_include_dirs, other.Aidl_include_dirs), + Jarjar_rules: mergeStringLists(i.Jarjar_rules, other.Jarjar_rules), + Jars: mergeStringLists(i.Jars, other.Jars), + Classes: mergeStringLists(i.Classes, other.Classes), + Installed_paths: mergeStringLists(i.Installed_paths, other.Installed_paths), + SrcJars: mergeStringLists(i.SrcJars, other.SrcJars), + Paths: mergeStringLists(i.Paths, other.Paths), + Static_libs: mergeStringLists(i.Static_libs, other.Static_libs), + Libs: mergeStringLists(i.Libs, other.Libs), + } +} + +// mergeStringLists appends the two string lists together and returns a new string list, +// leaving the originals unchanged. Duplicate strings will be deduplicated. +func mergeStringLists(a, b []string) []string { + return FirstUniqueStrings(Concat(a, b)) +} + +var IdeInfoProviderKey = blueprint.NewProvider[IdeInfo]() + func CheckBlueprintSyntax(ctx BaseModuleContext, filename string, contents string) []error { bpctx := ctx.blueprintBaseModuleContext() return blueprint.CheckBlueprintSyntax(bpctx.ModuleFactories(), filename, contents) |