Soong filesystem may install aconfig_flags.pb
By setting aconfig_flags: true, soong filesystem module installs the
aconfig_flags.pb file to its etc directory.
We need to define aconfigFilePaths to ModuleBase to store the list of
aconfig file paths that is generated from the GenerateBuildActions().
The aconfigFilePaths are collected when build the filesystem module
to build the aconfig_flags.pb for the filesystem image.
Bug: 335363964
Test: compare the cache list with those generated from make.
Change-Id: Ia32b566bf43174e94b9e610b9503608c6b583899
diff --git a/android/aconfig_providers.go b/android/aconfig_providers.go
index 7317587..ee9891d 100644
--- a/android/aconfig_providers.go
+++ b/android/aconfig_providers.go
@@ -130,6 +130,7 @@
AconfigFiles: mergedAconfigFiles,
ModeInfos: mergedModeInfos,
})
+ ctx.Module().base().aconfigFilePaths = getAconfigFilePaths(ctx.Module().base(), mergedAconfigFiles)
}
}
diff --git a/android/module.go b/android/module.go
index d7f0537..21ca9be 100644
--- a/android/module.go
+++ b/android/module.go
@@ -902,6 +902,9 @@
installedInitRcPaths InstallPaths
installedVintfFragmentsPaths InstallPaths
+ // Merged Aconfig files for all transitive deps.
+ aconfigFilePaths Paths
+
// set of dependency module:location mappings used to populate the license metadata for
// apex containers.
licenseInstallMap []string
diff --git a/android/module_context.go b/android/module_context.go
index 605d3ba..3c1e30a 100644
--- a/android/module_context.go
+++ b/android/module_context.go
@@ -482,6 +482,10 @@
return m.packageFile(fullInstallPath, srcPath, false)
}
+func (m *moduleContext) getAconfigPaths() *Paths {
+ return &m.module.base().aconfigFilePaths
+}
+
func (m *moduleContext) packageFile(fullInstallPath InstallPath, srcPath Path, executable bool) PackagingSpec {
licenseFiles := m.Module().EffectiveLicenseFiles()
spec := PackagingSpec{
@@ -492,6 +496,7 @@
effectiveLicenseFiles: &licenseFiles,
partition: fullInstallPath.partition,
skipInstall: m.skipInstall(),
+ aconfigPaths: m.getAconfigPaths(),
}
m.packagingSpecs = append(m.packagingSpecs, spec)
return spec
@@ -616,6 +621,7 @@
executable: false,
partition: fullInstallPath.partition,
skipInstall: m.skipInstall(),
+ aconfigPaths: m.getAconfigPaths(),
})
return fullInstallPath
@@ -658,6 +664,7 @@
executable: false,
partition: fullInstallPath.partition,
skipInstall: m.skipInstall(),
+ aconfigPaths: m.getAconfigPaths(),
})
return fullInstallPath
diff --git a/android/packaging.go b/android/packaging.go
index fe61da1..a7260a6 100644
--- a/android/packaging.go
+++ b/android/packaging.go
@@ -48,6 +48,9 @@
// is created via InstallFile or InstallSymlink) or a simple packaging (i.e. created via
// PackageFile).
skipInstall bool
+
+ // Paths of aconfig files for the built artifact
+ aconfigPaths *Paths
}
func (p *PackagingSpec) Equals(other *PackagingSpec) bool {
@@ -102,6 +105,11 @@
return p.skipInstall
}
+// Paths of aconfig files for the built artifact
+func (p *PackagingSpec) GetAconfigPaths() Paths {
+ return *p.aconfigPaths
+}
+
type PackageModule interface {
Module
packagingBase() *PackagingBase