summaryrefslogtreecommitdiff
path: root/android/module_context.go
diff options
context:
space:
mode:
author Colin Cross <ccross@android.com> 2023-11-06 13:54:06 -0800
committer Colin Cross <ccross@android.com> 2024-01-02 16:03:43 -0800
commitd6fd013394892f810ec40ce92809d2df9ee948ce (patch)
tree39b923318c7deb7b3ce4029d792757fe45034c6a /android/module_context.go
parentd9bbf4b42468ee31cb40af9c6f7e55a7f07fbf04 (diff)
Support generating module_info.json in Soong
Generate module_info.json for some Soong modules in Soong in order to pass fewer properties to Kati, which can prevent Kati reanalysis when some Android.bp changes are made. Soong modules can export a ModuleInfoJSONProvider containing the data that should be included in module-info.json. During the androidmk singleton the providers are collected and written to a single JSON file. Make then merges the Soong modules into its own modules. For now, to keep the result as similar as possible to the module-info.json currently being generated by Make, only modules that are exported to Make are written to the Soong module-info.json. Bug: 309006256 Test: Compare module-info.json Change-Id: I996520eb48e04743d43ac11c9aba0f3ada7745de
Diffstat (limited to 'android/module_context.go')
-rw-r--r--android/module_context.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/android/module_context.go b/android/module_context.go
index 81692d5a2..e772f8bc4 100644
--- a/android/module_context.go
+++ b/android/module_context.go
@@ -210,6 +210,11 @@ type ModuleContext interface {
// LicenseMetadataFile returns the path where the license metadata for this module will be
// generated.
LicenseMetadataFile() Path
+
+ // ModuleInfoJSON returns a pointer to the ModuleInfoJSON struct that can be filled out by
+ // GenerateAndroidBuildActions. If it is called then the struct will be written out and included in
+ // the module-info.json generated by Make, and Make will not generate its own data for this module.
+ ModuleInfoJSON() *ModuleInfoJSON
}
type moduleContext struct {
@@ -518,6 +523,8 @@ func (m *moduleContext) installFile(installPath InstallPath, name string, srcPat
if !m.skipInstall() {
deps = append(deps, InstallPaths(m.module.base().installFilesDepSet.ToList())...)
+ deps = append(deps, m.module.base().installedInitRcPaths...)
+ deps = append(deps, m.module.base().installedVintfFragmentsPaths...)
var implicitDeps, orderOnlyDeps Paths
@@ -695,6 +702,15 @@ func (m *moduleContext) LicenseMetadataFile() Path {
return m.module.base().licenseMetadataFile
}
+func (m *moduleContext) ModuleInfoJSON() *ModuleInfoJSON {
+ if moduleInfoJSON := m.module.base().moduleInfoJSON; moduleInfoJSON != nil {
+ return moduleInfoJSON
+ }
+ moduleInfoJSON := &ModuleInfoJSON{}
+ m.module.base().moduleInfoJSON = moduleInfoJSON
+ return moduleInfoJSON
+}
+
// Returns a list of paths expanded from globs and modules referenced using ":module" syntax. The property must
// be tagged with `android:"path" to support automatic source module dependency resolution.
//