Merge "Make IdeInfo into a provider" into main am: 78a3761bde
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3245754 Change-Id: If90b650d7e0832de74a858c541277f9658f477c3 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -1947,6 +1947,13 @@ func (m *ModuleBase) GenerateBuildActions(blueprintCtx blueprint.ModuleContext)
|
||||
if ctx.Failed() {
|
||||
return
|
||||
}
|
||||
|
||||
if x, ok := m.module.(IDEInfo); ok {
|
||||
var result IdeInfo
|
||||
x.IDEInfo(&result)
|
||||
result.BaseModuleName = x.BaseModuleName()
|
||||
SetProvider(ctx, IdeInfoProviderKey, result)
|
||||
}
|
||||
}
|
||||
|
||||
if incrementalEnabled && cacheKey != nil {
|
||||
@@ -2744,7 +2751,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"`
|
||||
@@ -2758,6 +2767,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)
|
||||
|
@@ -57,27 +57,19 @@ func (j *jdepsGeneratorSingleton) GenerateBuildActions(ctx android.SingletonCont
|
||||
return
|
||||
}
|
||||
|
||||
ideInfoProvider, ok := module.(android.IDEInfo)
|
||||
ideInfoProvider, ok := android.OtherModuleProvider(ctx, module, android.IdeInfoProviderKey)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
name := ideInfoProvider.BaseModuleName()
|
||||
name := ideInfoProvider.BaseModuleName
|
||||
ideModuleNameProvider, ok := module.(android.IDECustomizedModuleName)
|
||||
if ok {
|
||||
name = ideModuleNameProvider.IDECustomizedModuleName()
|
||||
}
|
||||
|
||||
dpInfo := moduleInfos[name]
|
||||
ideInfoProvider.IDEInfo(&dpInfo)
|
||||
dpInfo.Deps = android.FirstUniqueStrings(dpInfo.Deps)
|
||||
dpInfo.Srcs = android.FirstUniqueStrings(dpInfo.Srcs)
|
||||
dpInfo.Aidl_include_dirs = android.FirstUniqueStrings(dpInfo.Aidl_include_dirs)
|
||||
dpInfo.Jarjar_rules = android.FirstUniqueStrings(dpInfo.Jarjar_rules)
|
||||
dpInfo.Jars = android.FirstUniqueStrings(dpInfo.Jars)
|
||||
dpInfo.SrcJars = android.FirstUniqueStrings(dpInfo.SrcJars)
|
||||
dpInfo = dpInfo.Merge(ideInfoProvider)
|
||||
dpInfo.Paths = []string{ctx.ModuleDir(module)}
|
||||
dpInfo.Static_libs = android.FirstUniqueStrings(dpInfo.Static_libs)
|
||||
dpInfo.Libs = android.FirstUniqueStrings(dpInfo.Libs)
|
||||
moduleInfos[name] = dpInfo
|
||||
|
||||
mkProvider, ok := module.(android.AndroidMkDataProvider)
|
||||
|
Reference in New Issue
Block a user