summaryrefslogtreecommitdiff
path: root/android/androidmk.go
diff options
context:
space:
mode:
Diffstat (limited to 'android/androidmk.go')
-rw-r--r--android/androidmk.go321
1 files changed, 221 insertions, 100 deletions
diff --git a/android/androidmk.go b/android/androidmk.go
index 87a93e396..d9d78f349 100644
--- a/android/androidmk.go
+++ b/android/androidmk.go
@@ -64,7 +64,6 @@ type AndroidMkDataProvider interface {
type AndroidMkData struct {
Class string
SubName string
- DistFiles TaggedDistFiles
OutputFile OptionalPath
Disabled bool
Include string
@@ -166,7 +165,7 @@ type AndroidMkExtraEntriesContext interface {
type androidMkExtraEntriesContext struct {
ctx fillInEntriesContext
- mod blueprint.Module
+ mod Module
}
func (a *androidMkExtraEntriesContext) Provider(provider blueprint.AnyProviderKey) (any, bool) {
@@ -333,9 +332,28 @@ type distCopy struct {
dest string
}
+func (d *distCopy) String() string {
+ if len(d.dest) == 0 {
+ return d.from.String()
+ }
+ return fmt.Sprintf("%s:%s", d.from.String(), d.dest)
+}
+
+type distCopies []distCopy
+
+func (d *distCopies) Strings() (ret []string) {
+ if d == nil {
+ return
+ }
+ for _, dist := range *d {
+ ret = append(ret, dist.String())
+ }
+ return
+}
+
// Compute the contributions that the module makes to the dist.
-func (a *AndroidMkEntries) getDistContributions(mod blueprint.Module) *distContributions {
- amod := mod.(Module).base()
+func (a *AndroidMkEntries) getDistContributions(mod Module) *distContributions {
+ amod := mod.base()
name := amod.BaseModuleName()
// Collate the set of associated tag/paths available for copying to the dist.
@@ -372,7 +390,7 @@ func (a *AndroidMkEntries) getDistContributions(mod blueprint.Module) *distContr
// Collate the contributions this module makes to the dist.
distContributions := &distContributions{}
- if !exemptFromRequiredApplicableLicensesProperty(mod.(Module)) {
+ if !exemptFromRequiredApplicableLicensesProperty(mod) {
distContributions.licenseMetadataFile = info.LicenseMetadataFile
}
@@ -483,7 +501,7 @@ func generateDistContributionsForMake(distContributions *distContributions) []st
// Compute the list of Make strings to declare phony goals and dist-for-goals
// calls from the module's dist and dists properties.
-func (a *AndroidMkEntries) GetDistForGoals(mod blueprint.Module) []string {
+func (a *AndroidMkEntries) GetDistForGoals(mod Module) []string {
distContributions := a.getDistContributions(mod)
if distContributions == nil {
return nil
@@ -504,11 +522,10 @@ type fillInEntriesContext interface {
HasMutatorFinished(mutatorName string) bool
}
-func (a *AndroidMkEntries) fillInEntries(ctx fillInEntriesContext, mod blueprint.Module) {
+func (a *AndroidMkEntries) fillInEntries(ctx fillInEntriesContext, mod Module) {
a.entryContext = ctx
a.EntryMap = make(map[string][]string)
- amod := mod.(Module)
- base := amod.base()
+ base := mod.base()
name := base.BaseModuleName()
if a.OverrideName != "" {
name = a.OverrideName
@@ -517,10 +534,10 @@ func (a *AndroidMkEntries) fillInEntries(ctx fillInEntriesContext, mod blueprint
if a.Include == "" {
a.Include = "$(BUILD_PREBUILT)"
}
- a.Required = append(a.Required, amod.RequiredModuleNames(ctx)...)
- a.Required = append(a.Required, amod.VintfFragmentModuleNames(ctx)...)
- a.Host_required = append(a.Host_required, amod.HostRequiredModuleNames()...)
- a.Target_required = append(a.Target_required, amod.TargetRequiredModuleNames()...)
+ a.Required = append(a.Required, mod.RequiredModuleNames(ctx)...)
+ a.Required = append(a.Required, mod.VintfFragmentModuleNames(ctx)...)
+ a.Host_required = append(a.Host_required, mod.HostRequiredModuleNames()...)
+ a.Target_required = append(a.Target_required, mod.TargetRequiredModuleNames()...)
for _, distString := range a.GetDistForGoals(mod) {
fmt.Fprintln(&a.header, distString)
@@ -536,7 +553,7 @@ func (a *AndroidMkEntries) fillInEntries(ctx fillInEntriesContext, mod blueprint
a.AddStrings("LOCAL_REQUIRED_MODULES", a.Required...)
a.AddStrings("LOCAL_HOST_REQUIRED_MODULES", a.Host_required...)
a.AddStrings("LOCAL_TARGET_REQUIRED_MODULES", a.Target_required...)
- a.AddStrings("LOCAL_SOONG_MODULE_TYPE", ctx.ModuleType(amod))
+ a.AddStrings("LOCAL_SOONG_MODULE_TYPE", ctx.ModuleType(mod))
// If the install rule was generated by Soong tell Make about it.
info := OtherModuleProviderOrDefault(ctx, mod, InstallFilesProvider)
@@ -700,22 +717,26 @@ func AndroidMkSingleton() Singleton {
type androidMkSingleton struct{}
-func (c *androidMkSingleton) GenerateBuildActions(ctx SingletonContext) {
- var androidMkModulesList []blueprint.Module
+func allModulesSorted(ctx SingletonContext) []Module {
+ var allModules []Module
- ctx.VisitAllModulesBlueprint(func(module blueprint.Module) {
- androidMkModulesList = append(androidMkModulesList, module)
+ ctx.VisitAllModules(func(module Module) {
+ allModules = append(allModules, module)
})
// Sort the module list by the module names to eliminate random churns, which may erroneously
// invoke additional build processes.
- sort.SliceStable(androidMkModulesList, func(i, j int) bool {
- return ctx.ModuleName(androidMkModulesList[i]) < ctx.ModuleName(androidMkModulesList[j])
+ sort.SliceStable(allModules, func(i, j int) bool {
+ return ctx.ModuleName(allModules[i]) < ctx.ModuleName(allModules[j])
})
- // If running in soong-only mode, do a different, more limited version of this singleton
+ return allModules
+}
+
+func (c *androidMkSingleton) GenerateBuildActions(ctx SingletonContext) {
+ // If running in soong-only mode, more limited version of this singleton is run as
+ // soong only androidmk singleton
if !ctx.Config().KatiEnabled() {
- c.soongOnlyBuildActions(ctx, androidMkModulesList)
return
}
@@ -726,7 +747,7 @@ func (c *androidMkSingleton) GenerateBuildActions(ctx SingletonContext) {
moduleInfoJSON := PathForOutput(ctx, "module-info"+String(ctx.Config().productVariables.Make_suffix)+".json")
- err := translateAndroidMk(ctx, absolutePath(transMk.String()), moduleInfoJSON, androidMkModulesList)
+ err := translateAndroidMk(ctx, absolutePath(transMk.String()), moduleInfoJSON, allModulesSorted(ctx))
if err != nil {
ctx.Errorf(err.Error())
}
@@ -737,12 +758,63 @@ func (c *androidMkSingleton) GenerateBuildActions(ctx SingletonContext) {
})
}
+type soongOnlyAndroidMkSingleton struct {
+ Singleton
+}
+
+func soongOnlyAndroidMkSingletonFactory() Singleton {
+ return &soongOnlyAndroidMkSingleton{}
+}
+
+func (so *soongOnlyAndroidMkSingleton) GenerateBuildActions(ctx SingletonContext) {
+ if !ctx.Config().KatiEnabled() {
+ so.soongOnlyBuildActions(ctx, allModulesSorted(ctx))
+ }
+}
+
// In soong-only mode, we don't do most of the androidmk stuff. But disted files are still largely
// defined through the androidmk mechanisms, so this function is an alternate implementation of
// the androidmk singleton that just focuses on getting the dist contributions
-func (c *androidMkSingleton) soongOnlyBuildActions(ctx SingletonContext, mods []blueprint.Module) {
- allDistContributions := getDistContributionsFromMods(ctx, mods)
-
+// TODO(b/397766191): Change the signature to take ModuleProxy
+// Please only access the module's internal data through providers.
+func (so *soongOnlyAndroidMkSingleton) soongOnlyBuildActions(ctx SingletonContext, mods []Module) {
+ allDistContributions, moduleInfoJSONs := getSoongOnlyDataFromMods(ctx, mods)
+
+ singletonDists := getSingletonDists(ctx.Config())
+ singletonDists.lock.Lock()
+ if contribution := distsToDistContributions(singletonDists.dists); contribution != nil {
+ allDistContributions = append(allDistContributions, *contribution)
+ }
+ singletonDists.lock.Unlock()
+
+ // Build module-info.json. Only in builds with HasDeviceProduct(), as we need a named
+ // device to have a TARGET_OUT folder.
+ if ctx.Config().HasDeviceProduct() {
+ preMergePath := PathForOutput(ctx, "module_info_pre_merging.json")
+ moduleInfoJSONPath := pathForInstall(ctx, Android, X86_64, "", "module-info.json")
+ if err := writeModuleInfoJSON(ctx, moduleInfoJSONs, preMergePath); err != nil {
+ ctx.Errorf("%s", err)
+ }
+ builder := NewRuleBuilder(pctx, ctx)
+ builder.Command().
+ BuiltTool("merge_module_info_json").
+ FlagWithOutput("-o ", moduleInfoJSONPath).
+ Input(preMergePath)
+ builder.Build("merge_module_info_json", "merge module info json")
+ ctx.Phony("module-info", moduleInfoJSONPath)
+ ctx.Phony("droidcore-unbundled", moduleInfoJSONPath)
+ allDistContributions = append(allDistContributions, distContributions{
+ copiesForGoals: []*copiesForGoals{{
+ goals: "general-tests droidcore-unbundled",
+ copies: []distCopy{{
+ from: moduleInfoJSONPath,
+ dest: "module-info.json",
+ }},
+ }},
+ })
+ }
+
+ // Build dist.mk for the packaging step to read and generate dist targets
distMkFile := absolutePath(filepath.Join(ctx.Config().katiPackageMkDir(), "dist.mk"))
var goalOutputPairs []string
@@ -793,34 +865,66 @@ func writeValueIfChanged(ctx SingletonContext, path string, value string) {
}
}
-func getDistContributionsFromMods(ctx fillInEntriesContext, mods []blueprint.Module) []distContributions {
+func distsToDistContributions(dists []dist) *distContributions {
+ if len(dists) == 0 {
+ return nil
+ }
+
+ copyGoals := []*copiesForGoals{}
+ for _, dist := range dists {
+ for _, goal := range dist.goals {
+ copyGoals = append(copyGoals, &copiesForGoals{
+ goals: goal,
+ copies: dist.paths,
+ })
+ }
+ }
+
+ return &distContributions{
+ copiesForGoals: copyGoals,
+ }
+}
+
+// getSoongOnlyDataFromMods gathers data from the given modules needed in soong-only builds.
+// Currently, this is the dist contributions, and the module-info.json contents.
+func getSoongOnlyDataFromMods(ctx fillInEntriesContext, mods []Module) ([]distContributions, []*ModuleInfoJSON) {
var allDistContributions []distContributions
+ var moduleInfoJSONs []*ModuleInfoJSON
for _, mod := range mods {
- if amod, ok := mod.(Module); ok && shouldSkipAndroidMkProcessing(ctx, amod.base()) {
+ if distInfo, ok := OtherModuleProvider(ctx, mod, DistProvider); ok {
+ if contribution := distsToDistContributions(distInfo.Dists); contribution != nil {
+ allDistContributions = append(allDistContributions, *contribution)
+ }
+ }
+
+ commonInfo, _ := OtherModuleProvider(ctx, mod, CommonModuleInfoKey)
+ if commonInfo.SkipAndroidMkProcessing {
continue
}
if info, ok := OtherModuleProvider(ctx, mod, AndroidMkInfoProvider); ok {
// Deep copy the provider info since we need to modify the info later
info := deepCopyAndroidMkProviderInfo(info)
- info.PrimaryInfo.fillInEntries(ctx, mod)
+ info.PrimaryInfo.fillInEntries(ctx, mod, &commonInfo)
if info.PrimaryInfo.disabled() {
continue
}
- if contribution := info.PrimaryInfo.getDistContributions(ctx, mod); contribution != nil {
+ if moduleInfoJSON, ok := OtherModuleProvider(ctx, mod, ModuleInfoJSONProvider); ok {
+ moduleInfoJSONs = append(moduleInfoJSONs, moduleInfoJSON...)
+ }
+ if contribution := info.PrimaryInfo.getDistContributions(ctx, mod, &commonInfo); contribution != nil {
allDistContributions = append(allDistContributions, *contribution)
}
for _, ei := range info.ExtraInfo {
- ei.fillInEntries(ctx, mod)
+ ei.fillInEntries(ctx, mod, &commonInfo)
if ei.disabled() {
continue
}
- if contribution := ei.getDistContributions(ctx, mod); contribution != nil {
+ if contribution := ei.getDistContributions(ctx, mod, &commonInfo); contribution != nil {
allDistContributions = append(allDistContributions, *contribution)
}
}
} else {
- switch x := mod.(type) {
- case AndroidMkDataProvider:
+ if x, ok := mod.(AndroidMkDataProvider); ok {
data := x.AndroidMk()
if data.Include == "" {
@@ -831,29 +935,34 @@ func getDistContributionsFromMods(ctx fillInEntriesContext, mods []blueprint.Mod
if data.Entries.disabled() {
continue
}
+ if moduleInfoJSON, ok := OtherModuleProvider(ctx, mod, ModuleInfoJSONProvider); ok {
+ moduleInfoJSONs = append(moduleInfoJSONs, moduleInfoJSON...)
+ }
if contribution := data.Entries.getDistContributions(mod); contribution != nil {
allDistContributions = append(allDistContributions, *contribution)
}
- case AndroidMkEntriesProvider:
+ }
+ if x, ok := mod.(AndroidMkEntriesProvider); ok {
entriesList := x.AndroidMkEntries()
for _, entries := range entriesList {
entries.fillInEntries(ctx, mod)
if entries.disabled() {
continue
}
+ if moduleInfoJSON, ok := OtherModuleProvider(ctx, mod, ModuleInfoJSONProvider); ok {
+ moduleInfoJSONs = append(moduleInfoJSONs, moduleInfoJSON...)
+ }
if contribution := entries.getDistContributions(mod); contribution != nil {
allDistContributions = append(allDistContributions, *contribution)
}
}
- default:
- // Not exported to make so no make variables to set.
}
}
}
- return allDistContributions
+ return allDistContributions, moduleInfoJSONs
}
-func translateAndroidMk(ctx SingletonContext, absMkFile string, moduleInfoJSONPath WritablePath, mods []blueprint.Module) error {
+func translateAndroidMk(ctx SingletonContext, absMkFile string, moduleInfoJSONPath WritablePath, mods []Module) error {
buf := &bytes.Buffer{}
var moduleInfoJSONs []*ModuleInfoJSON
@@ -868,8 +977,8 @@ func translateAndroidMk(ctx SingletonContext, absMkFile string, moduleInfoJSONPa
return err
}
- if amod, ok := mod.(Module); ok && ctx.PrimaryModule(amod) == amod {
- typeStats[ctx.ModuleType(amod)] += 1
+ if ctx.PrimaryModule(mod) == mod {
+ typeStats[ctx.ModuleType(mod)] += 1
}
}
@@ -913,7 +1022,7 @@ func writeModuleInfoJSON(ctx SingletonContext, moduleInfoJSONs []*ModuleInfoJSON
return nil
}
-func translateAndroidMkModule(ctx SingletonContext, w io.Writer, moduleInfoJSONs *[]*ModuleInfoJSON, mod blueprint.Module) error {
+func translateAndroidMkModule(ctx SingletonContext, w io.Writer, moduleInfoJSONs *[]*ModuleInfoJSON, mod Module) error {
defer func() {
if r := recover(); r != nil {
panic(fmt.Errorf("%s in translateAndroidMkModule for module %s variant %s",
@@ -944,12 +1053,11 @@ func translateAndroidMkModule(ctx SingletonContext, w io.Writer, moduleInfoJSONs
return err
}
-func (data *AndroidMkData) fillInData(ctx fillInEntriesContext, mod blueprint.Module) {
+func (data *AndroidMkData) fillInData(ctx fillInEntriesContext, mod Module) {
// Get the preamble content through AndroidMkEntries logic.
data.Entries = AndroidMkEntries{
Class: data.Class,
SubName: data.SubName,
- DistFiles: data.DistFiles,
OutputFile: data.OutputFile,
Disabled: data.Disabled,
Include: data.Include,
@@ -968,9 +1076,9 @@ func (data *AndroidMkData) fillInData(ctx fillInEntriesContext, mod blueprint.Mo
// A support func for the deprecated AndroidMkDataProvider interface. Use AndroidMkEntryProvider
// instead.
func translateAndroidModule(ctx SingletonContext, w io.Writer, moduleInfoJSONs *[]*ModuleInfoJSON,
- mod blueprint.Module, provider AndroidMkDataProvider) error {
+ mod Module, provider AndroidMkDataProvider) error {
- amod := mod.(Module).base()
+ amod := mod.base()
if shouldSkipAndroidMkProcessing(ctx, amod) {
return nil
}
@@ -982,7 +1090,7 @@ func translateAndroidModule(ctx SingletonContext, w io.Writer, moduleInfoJSONs *
}
data.fillInData(ctx, mod)
- aconfigUpdateAndroidMkData(ctx, mod.(Module), &data)
+ aconfigUpdateAndroidMkData(ctx, mod, &data)
prefix := ""
if amod.ArchSpecific() {
@@ -1037,7 +1145,7 @@ func translateAndroidModule(ctx SingletonContext, w io.Writer, moduleInfoJSONs *
if !data.Entries.disabled() {
if moduleInfoJSON, ok := OtherModuleProvider(ctx, mod, ModuleInfoJSONProvider); ok {
- *moduleInfoJSONs = append(*moduleInfoJSONs, moduleInfoJSON)
+ *moduleInfoJSONs = append(*moduleInfoJSONs, moduleInfoJSON...)
}
}
@@ -1063,23 +1171,28 @@ func WriteAndroidMkData(w io.Writer, data AndroidMkData) {
}
func translateAndroidMkEntriesModule(ctx SingletonContext, w io.Writer, moduleInfoJSONs *[]*ModuleInfoJSON,
- mod blueprint.Module, provider AndroidMkEntriesProvider) error {
- if shouldSkipAndroidMkProcessing(ctx, mod.(Module).base()) {
+ mod Module, provider AndroidMkEntriesProvider) error {
+ if shouldSkipAndroidMkProcessing(ctx, mod.base()) {
return nil
}
entriesList := provider.AndroidMkEntries()
- aconfigUpdateAndroidMkEntries(ctx, mod.(Module), &entriesList)
+ aconfigUpdateAndroidMkEntries(ctx, mod, &entriesList)
+
+ moduleInfoJSON, providesModuleInfoJSON := OtherModuleProvider(ctx, mod, ModuleInfoJSONProvider)
// Any new or special cases here need review to verify correct propagation of license information.
for _, entries := range entriesList {
entries.fillInEntries(ctx, mod)
entries.write(w)
- }
- if len(entriesList) > 0 && !entriesList[0].disabled() {
- if moduleInfoJSON, ok := OtherModuleProvider(ctx, mod, ModuleInfoJSONProvider); ok {
- *moduleInfoJSONs = append(*moduleInfoJSONs, moduleInfoJSON)
+ if providesModuleInfoJSON && !entries.disabled() {
+ // append only the name matching moduleInfoJSON entry
+ for _, m := range moduleInfoJSON {
+ if m.RegisterNameOverride == entries.OverrideName && m.SubName == entries.SubName {
+ *moduleInfoJSONs = append(*moduleInfoJSONs, m)
+ }
+ }
}
}
@@ -1223,30 +1336,33 @@ type AndroidMkProviderInfoProducer interface {
// TODO: rename it to AndroidMkEntriesProvider after AndroidMkEntriesProvider interface is gone.
var AndroidMkInfoProvider = blueprint.NewProvider[*AndroidMkProviderInfo]()
+// TODO(b/397766191): Change the signature to take ModuleProxy
+// Please only access the module's internal data through providers.
func translateAndroidMkEntriesInfoModule(ctx SingletonContext, w io.Writer, moduleInfoJSONs *[]*ModuleInfoJSON,
- mod blueprint.Module, providerInfo *AndroidMkProviderInfo) error {
- if shouldSkipAndroidMkProcessing(ctx, mod.(Module).base()) {
+ mod Module, providerInfo *AndroidMkProviderInfo) error {
+ commonInfo, _ := OtherModuleProvider(ctx, mod, CommonModuleInfoKey)
+ if commonInfo.SkipAndroidMkProcessing {
return nil
}
// Deep copy the provider info since we need to modify the info later
info := deepCopyAndroidMkProviderInfo(providerInfo)
- aconfigUpdateAndroidMkInfos(ctx, mod.(Module), &info)
+ aconfigUpdateAndroidMkInfos(ctx, mod, &info)
// Any new or special cases here need review to verify correct propagation of license information.
- info.PrimaryInfo.fillInEntries(ctx, mod)
+ info.PrimaryInfo.fillInEntries(ctx, mod, &commonInfo)
info.PrimaryInfo.write(w)
if len(info.ExtraInfo) > 0 {
for _, ei := range info.ExtraInfo {
- ei.fillInEntries(ctx, mod)
+ ei.fillInEntries(ctx, mod, &commonInfo)
ei.write(w)
}
}
if !info.PrimaryInfo.disabled() {
if moduleInfoJSON, ok := OtherModuleProvider(ctx, mod, ModuleInfoJSONProvider); ok {
- *moduleInfoJSONs = append(*moduleInfoJSONs, moduleInfoJSON)
+ *moduleInfoJSONs = append(*moduleInfoJSONs, moduleInfoJSON...)
}
}
@@ -1368,14 +1484,14 @@ func (a *AndroidMkInfo) AddCompatibilityTestSuites(suites ...string) {
a.AddStrings("LOCAL_COMPATIBILITY_SUITE", suites...)
}
-func (a *AndroidMkInfo) fillInEntries(ctx fillInEntriesContext, mod blueprint.Module) {
+// TODO(b/397766191): Change the signature to take ModuleProxy
+// Please only access the module's internal data through providers.
+func (a *AndroidMkInfo) fillInEntries(ctx fillInEntriesContext, mod Module, commonInfo *CommonModuleInfo) {
helperInfo := AndroidMkInfo{
EntryMap: make(map[string][]string),
}
- amod := mod.(Module)
- base := amod.base()
- name := base.BaseModuleName()
+ name := commonInfo.BaseModuleName
if a.OverrideName != "" {
name = a.OverrideName
}
@@ -1383,16 +1499,16 @@ func (a *AndroidMkInfo) fillInEntries(ctx fillInEntriesContext, mod blueprint.Mo
if a.Include == "" {
a.Include = "$(BUILD_PREBUILT)"
}
- a.Required = append(a.Required, amod.RequiredModuleNames(ctx)...)
- a.Required = append(a.Required, amod.VintfFragmentModuleNames(ctx)...)
- a.Host_required = append(a.Host_required, amod.HostRequiredModuleNames()...)
- a.Target_required = append(a.Target_required, amod.TargetRequiredModuleNames()...)
+ a.Required = append(a.Required, commonInfo.RequiredModuleNames...)
+ a.Required = append(a.Required, commonInfo.VintfFragmentModuleNames...)
+ a.Host_required = append(a.Host_required, commonInfo.HostRequiredModuleNames...)
+ a.Target_required = append(a.Target_required, commonInfo.TargetRequiredModuleNames...)
- for _, distString := range a.GetDistForGoals(ctx, mod) {
+ for _, distString := range a.GetDistForGoals(ctx, mod, commonInfo) {
a.HeaderStrings = append(a.HeaderStrings, distString)
}
- a.HeaderStrings = append(a.HeaderStrings, fmt.Sprintf("\ninclude $(CLEAR_VARS) # type: %s, name: %s, variant: %s", ctx.ModuleType(mod), base.BaseModuleName(), ctx.ModuleSubDir(mod)))
+ a.HeaderStrings = append(a.HeaderStrings, fmt.Sprintf("\ninclude $(CLEAR_VARS) # type: %s, name: %s, variant: %s", ctx.ModuleType(mod), commonInfo.BaseModuleName, ctx.ModuleSubDir(mod)))
// Collect make variable assignment entries.
helperInfo.SetString("LOCAL_PATH", ctx.ModuleDir(mod))
@@ -1402,7 +1518,7 @@ func (a *AndroidMkInfo) fillInEntries(ctx fillInEntriesContext, mod blueprint.Mo
helperInfo.AddStrings("LOCAL_REQUIRED_MODULES", a.Required...)
helperInfo.AddStrings("LOCAL_HOST_REQUIRED_MODULES", a.Host_required...)
helperInfo.AddStrings("LOCAL_TARGET_REQUIRED_MODULES", a.Target_required...)
- helperInfo.AddStrings("LOCAL_SOONG_MODULE_TYPE", ctx.ModuleType(amod))
+ helperInfo.AddStrings("LOCAL_SOONG_MODULE_TYPE", ctx.ModuleType(mod))
// If the install rule was generated by Soong tell Make about it.
info := OtherModuleProviderOrDefault(ctx, mod, InstallFilesProvider)
@@ -1417,7 +1533,7 @@ func (a *AndroidMkInfo) fillInEntries(ctx fillInEntriesContext, mod blueprint.Mo
// Soong may not have generated the install rule also when `no_full_install: true`.
// Mark this module as uninstallable in order to prevent Make from creating an
// install rule there.
- helperInfo.SetBoolIfTrue("LOCAL_UNINSTALLABLE_MODULE", proptools.Bool(base.commonProperties.No_full_install))
+ helperInfo.SetBoolIfTrue("LOCAL_UNINSTALLABLE_MODULE", commonInfo.NoFullInstall)
}
if info.UncheckedModule {
@@ -1432,31 +1548,31 @@ func (a *AndroidMkInfo) fillInEntries(ctx fillInEntriesContext, mod blueprint.Mo
helperInfo.AddStrings("LOCAL_TEST_DATA", androidMkDataPaths(info.TestData)...)
}
- if am, ok := mod.(ApexModule); ok {
- helperInfo.SetBoolIfTrue("LOCAL_NOT_AVAILABLE_FOR_PLATFORM", am.NotAvailableForPlatform())
+ if commonInfo.IsApexModule {
+ helperInfo.SetBoolIfTrue("LOCAL_NOT_AVAILABLE_FOR_PLATFORM", commonInfo.NotAvailableForPlatform)
}
- archStr := base.Arch().ArchType.String()
+ archStr := commonInfo.Target.Arch.ArchType.String()
host := false
- switch base.Os().Class {
+ switch commonInfo.Target.Os.Class {
case Host:
- if base.Target().HostCross {
+ if commonInfo.Target.HostCross {
// Make cannot identify LOCAL_MODULE_HOST_CROSS_ARCH:= common.
- if base.Arch().ArchType != Common {
+ if commonInfo.Target.Arch.ArchType != Common {
helperInfo.SetString("LOCAL_MODULE_HOST_CROSS_ARCH", archStr)
}
} else {
// Make cannot identify LOCAL_MODULE_HOST_ARCH:= common.
- if base.Arch().ArchType != Common {
+ if commonInfo.Target.Arch.ArchType != Common {
helperInfo.SetString("LOCAL_MODULE_HOST_ARCH", archStr)
}
}
host = true
case Device:
// Make cannot identify LOCAL_MODULE_TARGET_ARCH:= common.
- if base.Arch().ArchType != Common {
- if base.Target().NativeBridge {
- hostArchStr := base.Target().NativeBridgeHostArchName
+ if commonInfo.Target.Arch.ArchType != Common {
+ if commonInfo.Target.NativeBridge {
+ hostArchStr := commonInfo.Target.NativeBridgeHostArchName
if hostArchStr != "" {
helperInfo.SetString("LOCAL_MODULE_TARGET_ARCH", hostArchStr)
}
@@ -1465,27 +1581,28 @@ func (a *AndroidMkInfo) fillInEntries(ctx fillInEntriesContext, mod blueprint.Mo
}
}
- if !base.InVendorRamdisk() {
+ if !commonInfo.InVendorRamdisk {
helperInfo.AddPaths("LOCAL_FULL_INIT_RC", info.InitRcPaths)
}
if len(info.VintfFragmentsPaths) > 0 {
helperInfo.AddPaths("LOCAL_FULL_VINTF_FRAGMENTS", info.VintfFragmentsPaths)
}
- helperInfo.SetBoolIfTrue("LOCAL_PROPRIETARY_MODULE", Bool(base.commonProperties.Proprietary))
- if Bool(base.commonProperties.Vendor) || Bool(base.commonProperties.Soc_specific) {
+ helperInfo.SetBoolIfTrue("LOCAL_PROPRIETARY_MODULE", commonInfo.Proprietary)
+ if commonInfo.Vendor || commonInfo.SocSpecific {
helperInfo.SetString("LOCAL_VENDOR_MODULE", "true")
}
- helperInfo.SetBoolIfTrue("LOCAL_ODM_MODULE", Bool(base.commonProperties.Device_specific))
- helperInfo.SetBoolIfTrue("LOCAL_PRODUCT_MODULE", Bool(base.commonProperties.Product_specific))
- helperInfo.SetBoolIfTrue("LOCAL_SYSTEM_EXT_MODULE", Bool(base.commonProperties.System_ext_specific))
- if base.commonProperties.Owner != nil {
- helperInfo.SetString("LOCAL_MODULE_OWNER", *base.commonProperties.Owner)
+ helperInfo.SetBoolIfTrue("LOCAL_ODM_MODULE", commonInfo.DeviceSpecific)
+ helperInfo.SetBoolIfTrue("LOCAL_PRODUCT_MODULE", commonInfo.ProductSpecific)
+ helperInfo.SetBoolIfTrue("LOCAL_SYSTEM_EXT_MODULE", commonInfo.SystemExtSpecific)
+ if commonInfo.Owner != "" {
+ helperInfo.SetString("LOCAL_MODULE_OWNER", commonInfo.Owner)
}
}
if host {
- makeOs := base.Os().String()
- if base.Os() == Linux || base.Os() == LinuxBionic || base.Os() == LinuxMusl {
+ os := commonInfo.Target.Os
+ makeOs := os.String()
+ if os == Linux || os == LinuxBionic || os == LinuxMusl {
makeOs = "linux"
}
helperInfo.SetString("LOCAL_MODULE_HOST_OS", makeOs)
@@ -1543,8 +1660,10 @@ func (a *AndroidMkInfo) write(w io.Writer) {
// Compute the list of Make strings to declare phony goals and dist-for-goals
// calls from the module's dist and dists properties.
-func (a *AndroidMkInfo) GetDistForGoals(ctx fillInEntriesContext, mod blueprint.Module) []string {
- distContributions := a.getDistContributions(ctx, mod)
+// TODO(b/397766191): Change the signature to take ModuleProxy
+// Please only access the module's internal data through providers.
+func (a *AndroidMkInfo) GetDistForGoals(ctx fillInEntriesContext, mod Module, commonInfo *CommonModuleInfo) []string {
+ distContributions := a.getDistContributions(ctx, mod, commonInfo)
if distContributions == nil {
return nil
}
@@ -1553,9 +1672,11 @@ func (a *AndroidMkInfo) GetDistForGoals(ctx fillInEntriesContext, mod blueprint.
}
// Compute the contributions that the module makes to the dist.
-func (a *AndroidMkInfo) getDistContributions(ctx fillInEntriesContext, mod blueprint.Module) *distContributions {
- amod := mod.(Module).base()
- name := amod.BaseModuleName()
+// TODO(b/397766191): Change the signature to take ModuleProxy
+// Please only access the module's internal data through providers.
+func (a *AndroidMkInfo) getDistContributions(ctx fillInEntriesContext, mod Module,
+ commonInfo *CommonModuleInfo) *distContributions {
+ name := commonInfo.BaseModuleName
// Collate the set of associated tag/paths available for copying to the dist.
// Start with an empty (nil) set.
@@ -1591,12 +1712,12 @@ func (a *AndroidMkInfo) getDistContributions(ctx fillInEntriesContext, mod bluep
// Collate the contributions this module makes to the dist.
distContributions := &distContributions{}
- if !exemptFromRequiredApplicableLicensesProperty(mod.(Module)) {
+ if !commonInfo.ExemptFromRequiredApplicableLicensesProperty {
distContributions.licenseMetadataFile = info.LicenseMetadataFile
}
// Iterate over this module's dist structs, merged from the dist and dists properties.
- for _, dist := range amod.Dists() {
+ for _, dist := range commonInfo.Dists {
// Get the list of goals this dist should be enabled for. e.g. sdk, droidcore
goals := strings.Join(dist.Targets, " ")