Merge "Add new flags for Rust 1.83 update" into main
diff --git a/android/androidmk.go b/android/androidmk.go
index 6f094e5..f862a96 100644
--- a/android/androidmk.go
+++ b/android/androidmk.go
@@ -838,7 +838,7 @@
continue
}
if moduleInfoJSON, ok := OtherModuleProvider(ctx, mod, ModuleInfoJSONProvider); ok {
- moduleInfoJSONs = append(moduleInfoJSONs, moduleInfoJSON)
+ moduleInfoJSONs = append(moduleInfoJSONs, moduleInfoJSON...)
}
if contribution := info.PrimaryInfo.getDistContributions(ctx, mod); contribution != nil {
allDistContributions = append(allDistContributions, *contribution)
@@ -866,7 +866,7 @@
continue
}
if moduleInfoJSON, ok := OtherModuleProvider(ctx, mod, ModuleInfoJSONProvider); ok {
- moduleInfoJSONs = append(moduleInfoJSONs, moduleInfoJSON)
+ moduleInfoJSONs = append(moduleInfoJSONs, moduleInfoJSON...)
}
if contribution := data.Entries.getDistContributions(mod); contribution != nil {
allDistContributions = append(allDistContributions, *contribution)
@@ -879,7 +879,7 @@
continue
}
if moduleInfoJSON, ok := OtherModuleProvider(ctx, mod, ModuleInfoJSONProvider); ok {
- moduleInfoJSONs = append(moduleInfoJSONs, moduleInfoJSON)
+ moduleInfoJSONs = append(moduleInfoJSONs, moduleInfoJSON...)
}
if contribution := entries.getDistContributions(mod); contribution != nil {
allDistContributions = append(allDistContributions, *contribution)
@@ -1077,7 +1077,7 @@
if !data.Entries.disabled() {
if moduleInfoJSON, ok := OtherModuleProvider(ctx, mod, ModuleInfoJSONProvider); ok {
- *moduleInfoJSONs = append(*moduleInfoJSONs, moduleInfoJSON)
+ *moduleInfoJSONs = append(*moduleInfoJSONs, moduleInfoJSON...)
}
}
@@ -1111,15 +1111,20 @@
entriesList := provider.AndroidMkEntries()
aconfigUpdateAndroidMkEntries(ctx, mod.(Module), &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)
+ }
+ }
}
}
@@ -1286,7 +1291,7 @@
if !info.PrimaryInfo.disabled() {
if moduleInfoJSON, ok := OtherModuleProvider(ctx, mod, ModuleInfoJSONProvider); ok {
- *moduleInfoJSONs = append(*moduleInfoJSONs, moduleInfoJSON)
+ *moduleInfoJSONs = append(*moduleInfoJSONs, moduleInfoJSON...)
}
}
diff --git a/android/defaults.go b/android/defaults.go
index 510ebe0..0fc1768 100644
--- a/android/defaults.go
+++ b/android/defaults.go
@@ -178,6 +178,7 @@
module.AddProperties(
&hostAndDeviceProperties{},
commonProperties,
+ &baseProperties{},
&ApexProperties{},
&distProperties{})
diff --git a/android/module.go b/android/module.go
index 75b550a..788c21b 100644
--- a/android/module.go
+++ b/android/module.go
@@ -257,6 +257,8 @@
Name *string
}
+// Properties common to all modules inheriting from ModuleBase. These properties are automatically
+// inherited by sub-modules created with ctx.CreateModule()
type commonProperties struct {
// emit build rules for this module
//
@@ -409,15 +411,6 @@
// VINTF manifest fragments to be installed if this module is installed
Vintf_fragments proptools.Configurable[[]string] `android:"path"`
- // names of other modules to install if this module is installed
- Required proptools.Configurable[[]string] `android:"arch_variant"`
-
- // names of other modules to install on host if this module is installed
- Host_required []string `android:"arch_variant"`
-
- // names of other modules to install on target if this module is installed
- Target_required []string `android:"arch_variant"`
-
// The OsType of artifacts that this module variant is responsible for creating.
//
// Set by osMutator
@@ -518,6 +511,19 @@
Overrides []string
}
+// Properties common to all modules inheriting from ModuleBase. Unlike commonProperties, these
+// properties are NOT automatically inherited by sub-modules created with ctx.CreateModule()
+type baseProperties struct {
+ // names of other modules to install if this module is installed
+ Required proptools.Configurable[[]string] `android:"arch_variant"`
+
+ // names of other modules to install on host if this module is installed
+ Host_required []string `android:"arch_variant"`
+
+ // names of other modules to install on target if this module is installed
+ Target_required []string `android:"arch_variant"`
+}
+
type distProperties struct {
// configuration to distribute output files from this module to the distribution
// directory (default: $OUT/dist, configurable with $DIST_DIR)
@@ -716,6 +722,7 @@
m.AddProperties(
&base.nameProperties,
&base.commonProperties,
+ &base.baseProperties,
&base.distProperties)
initProductVariableModule(m)
@@ -834,6 +841,7 @@
nameProperties nameProperties
commonProperties commonProperties
+ baseProperties baseProperties
distProperties distProperties
variableProperties interface{}
hostAndDeviceProperties hostAndDeviceProperties
@@ -1619,15 +1627,15 @@
}
func (m *ModuleBase) RequiredModuleNames(ctx ConfigurableEvaluatorContext) []string {
- return m.base().commonProperties.Required.GetOrDefault(m.ConfigurableEvaluator(ctx), nil)
+ return m.base().baseProperties.Required.GetOrDefault(m.ConfigurableEvaluator(ctx), nil)
}
func (m *ModuleBase) HostRequiredModuleNames() []string {
- return m.base().commonProperties.Host_required
+ return m.base().baseProperties.Host_required
}
func (m *ModuleBase) TargetRequiredModuleNames() []string {
- return m.base().commonProperties.Target_required
+ return m.base().baseProperties.Target_required
}
func (m *ModuleBase) VintfFragmentModuleNames(ctx ConfigurableEvaluatorContext) []string {
@@ -1722,12 +1730,13 @@
if ctx.Device() {
// Generate a target suffix for use in atest etc.
ctx.Phony(namespacePrefix+ctx.ModuleName()+"-target"+suffix, deps...)
- } else if ctx.Target().HostCross {
- // Generate a host-cross suffix for use in atest etc.
- ctx.Phony(namespacePrefix+ctx.ModuleName()+"-host-cross"+suffix, deps...)
} else {
// Generate a host suffix for use in atest etc.
ctx.Phony(namespacePrefix+ctx.ModuleName()+"-host"+suffix, deps...)
+ if ctx.Target().HostCross {
+ // Generate a host-cross suffix for use in atest etc.
+ ctx.Phony(namespacePrefix+ctx.ModuleName()+"-host-cross"+suffix, deps...)
+ }
}
info.BlueprintDir = ctx.ModuleDir()
@@ -2125,63 +2134,84 @@
SetProvider(ctx, InstallFilesProvider, installFiles)
buildLicenseMetadata(ctx, ctx.licenseMetadataFile)
- if ctx.moduleInfoJSON != nil {
- var installed InstallPaths
- installed = append(installed, ctx.katiInstalls.InstallPaths()...)
- installed = append(installed, ctx.katiSymlinks.InstallPaths()...)
- installed = append(installed, ctx.katiInitRcInstalls.InstallPaths()...)
- installed = append(installed, ctx.katiVintfInstalls.InstallPaths()...)
- installedStrings := installed.Strings()
+ if len(ctx.moduleInfoJSON) > 0 {
+ for _, moduleInfoJSON := range ctx.moduleInfoJSON {
+ if moduleInfoJSON.Disabled {
+ continue
+ }
+ var installed InstallPaths
+ installed = append(installed, ctx.katiInstalls.InstallPaths()...)
+ installed = append(installed, ctx.katiSymlinks.InstallPaths()...)
+ installed = append(installed, ctx.katiInitRcInstalls.InstallPaths()...)
+ installed = append(installed, ctx.katiVintfInstalls.InstallPaths()...)
+ installedStrings := installed.Strings()
- var targetRequired, hostRequired []string
- if ctx.Host() {
- targetRequired = m.commonProperties.Target_required
- } else {
- hostRequired = m.commonProperties.Host_required
- }
+ var targetRequired, hostRequired []string
+ if ctx.Host() {
+ targetRequired = m.baseProperties.Target_required
+ } else {
+ hostRequired = m.baseProperties.Host_required
+ }
- var data []string
- for _, d := range ctx.testData {
- data = append(data, d.ToRelativeInstallPath())
- }
+ var data []string
+ for _, d := range ctx.testData {
+ data = append(data, d.ToRelativeInstallPath())
+ }
- if ctx.moduleInfoJSON.Uninstallable {
- installedStrings = nil
- if len(ctx.moduleInfoJSON.CompatibilitySuites) == 1 && ctx.moduleInfoJSON.CompatibilitySuites[0] == "null-suite" {
- ctx.moduleInfoJSON.CompatibilitySuites = nil
- ctx.moduleInfoJSON.TestConfig = nil
- ctx.moduleInfoJSON.AutoTestConfig = nil
- data = nil
+ if moduleInfoJSON.Uninstallable {
+ installedStrings = nil
+ if len(moduleInfoJSON.CompatibilitySuites) == 1 && moduleInfoJSON.CompatibilitySuites[0] == "null-suite" {
+ moduleInfoJSON.CompatibilitySuites = nil
+ moduleInfoJSON.TestConfig = nil
+ moduleInfoJSON.AutoTestConfig = nil
+ data = nil
+ }
+ }
+
+ // M(C)TS supports a full test suite and partial per-module MTS test suites, with naming mts-${MODULE}.
+ // To reduce repetition, if we find a partial M(C)TS test suite without an full M(C)TS test suite,
+ // we add the full test suite to our list. This was inherited from
+ // AndroidMkEntries.AddCompatibilityTestSuites.
+ suites := moduleInfoJSON.CompatibilitySuites
+ if PrefixInList(suites, "mts-") && !InList("mts", suites) {
+ suites = append(suites, "mts")
+ }
+ if PrefixInList(suites, "mcts-") && !InList("mcts", suites) {
+ suites = append(suites, "mcts")
+ }
+ moduleInfoJSON.CompatibilitySuites = suites
+
+ required := append(m.RequiredModuleNames(ctx), m.VintfFragmentModuleNames(ctx)...)
+ required = append(required, moduleInfoJSON.ExtraRequired...)
+
+ registerName := moduleInfoJSON.RegisterNameOverride
+ if len(registerName) == 0 {
+ registerName = m.moduleInfoRegisterName(ctx, moduleInfoJSON.SubName)
+ }
+
+ moduleName := moduleInfoJSON.ModuleNameOverride
+ if len(moduleName) == 0 {
+ moduleName = m.BaseModuleName() + moduleInfoJSON.SubName
+ }
+
+ supportedVariants := moduleInfoJSON.SupportedVariantsOverride
+ if moduleInfoJSON.SupportedVariantsOverride == nil {
+ supportedVariants = []string{m.moduleInfoVariant(ctx)}
+ }
+
+ moduleInfoJSON.core = CoreModuleInfoJSON{
+ RegisterName: registerName,
+ Path: []string{ctx.ModuleDir()},
+ Installed: installedStrings,
+ ModuleName: moduleName,
+ SupportedVariants: supportedVariants,
+ TargetDependencies: targetRequired,
+ HostDependencies: hostRequired,
+ Data: data,
+ Required: required,
}
}
- // M(C)TS supports a full test suite and partial per-module MTS test suites, with naming mts-${MODULE}.
- // To reduce repetition, if we find a partial M(C)TS test suite without an full M(C)TS test suite,
- // we add the full test suite to our list. This was inherited from
- // AndroidMkEntries.AddCompatibilityTestSuites.
- suites := ctx.moduleInfoJSON.CompatibilitySuites
- if PrefixInList(suites, "mts-") && !InList("mts", suites) {
- suites = append(suites, "mts")
- }
- if PrefixInList(suites, "mcts-") && !InList("mcts", suites) {
- suites = append(suites, "mcts")
- }
- ctx.moduleInfoJSON.CompatibilitySuites = suites
-
- required := append(m.RequiredModuleNames(ctx), m.VintfFragmentModuleNames(ctx)...)
- required = append(required, ctx.moduleInfoJSON.ExtraRequired...)
-
- ctx.moduleInfoJSON.core = CoreModuleInfoJSON{
- RegisterName: m.moduleInfoRegisterName(ctx, ctx.moduleInfoJSON.SubName),
- Path: []string{ctx.ModuleDir()},
- Installed: installedStrings,
- ModuleName: m.BaseModuleName() + ctx.moduleInfoJSON.SubName,
- SupportedVariants: []string{m.moduleInfoVariant(ctx)},
- TargetDependencies: targetRequired,
- HostDependencies: hostRequired,
- Data: data,
- Required: required,
- }
SetProvider(ctx, ModuleInfoJSONProvider, ctx.moduleInfoJSON)
}
diff --git a/android/module_context.go b/android/module_context.go
index e63c672..1f4758c 100644
--- a/android/module_context.go
+++ b/android/module_context.go
@@ -231,6 +231,10 @@
// the module-info.json generated by Make, and Make will not generate its own data for this module.
ModuleInfoJSON() *ModuleInfoJSON
+ // Simiar to ModuleInfoJSON, ExtraModuleInfoJSON also returns a pointer to the ModuleInfoJSON struct.
+ // This should only be called by a module that generates multiple AndroidMkEntries struct.
+ ExtraModuleInfoJSON() *ModuleInfoJSON
+
// SetOutputFiles stores the outputFiles to outputFiles property, which is used
// to set the OutputFilesProvider later.
SetOutputFiles(outputFiles Paths, tag string)
@@ -296,7 +300,7 @@
// moduleInfoJSON can be filled out by GenerateAndroidBuildActions to write a JSON file that will
// be included in the final module-info.json produced by Make.
- moduleInfoJSON *ModuleInfoJSON
+ moduleInfoJSON []*ModuleInfoJSON
// containersInfo stores the information about the containers and the information of the
// apexes the module belongs to.
@@ -624,8 +628,8 @@
skipInstall: m.skipInstall(),
aconfigPaths: uniquelist.Make(m.getAconfigPaths()),
archType: m.target.Arch.ArchType,
- overrides: uniquelist.Make(overrides),
- owner: owner,
+ overrides: uniquelist.Make(overrides),
+ owner: owner,
}
m.packagingSpecs = append(m.packagingSpecs, spec)
return spec
@@ -759,8 +763,8 @@
skipInstall: m.skipInstall(),
aconfigPaths: uniquelist.Make(m.getAconfigPaths()),
archType: m.target.Arch.ArchType,
- overrides: uniquelist.Make(overrides),
- owner: owner,
+ overrides: uniquelist.Make(overrides),
+ owner: owner,
})
return fullInstallPath
@@ -807,8 +811,8 @@
skipInstall: m.skipInstall(),
aconfigPaths: uniquelist.Make(m.getAconfigPaths()),
archType: m.target.Arch.ArchType,
- overrides: uniquelist.Make(overrides),
- owner: owner,
+ overrides: uniquelist.Make(overrides),
+ owner: owner,
})
return fullInstallPath
@@ -846,11 +850,20 @@
}
func (m *moduleContext) ModuleInfoJSON() *ModuleInfoJSON {
- if moduleInfoJSON := m.moduleInfoJSON; moduleInfoJSON != nil {
- return moduleInfoJSON
+ if len(m.moduleInfoJSON) == 0 {
+ moduleInfoJSON := &ModuleInfoJSON{}
+ m.moduleInfoJSON = append(m.moduleInfoJSON, moduleInfoJSON)
}
+ return m.moduleInfoJSON[0]
+}
+
+func (m *moduleContext) ExtraModuleInfoJSON() *ModuleInfoJSON {
+ if len(m.moduleInfoJSON) == 0 {
+ panic("call ModuleInfoJSON() instead")
+ }
+
moduleInfoJSON := &ModuleInfoJSON{}
- m.moduleInfoJSON = moduleInfoJSON
+ m.moduleInfoJSON = append(m.moduleInfoJSON, moduleInfoJSON)
return moduleInfoJSON
}
diff --git a/android/module_info_json.go b/android/module_info_json.go
index 27120ef..f7bffdb 100644
--- a/android/module_info_json.go
+++ b/android/module_info_json.go
@@ -34,7 +34,7 @@
SrcJars []string `json:"srcjars,omitempty"` // $(sort $(ALL_MODULES.$(m).SRCJARS))
ClassesJar []string `json:"classes_jar,omitempty"` // $(sort $(ALL_MODULES.$(m).CLASSES_JAR))
TestMainlineModules []string `json:"test_mainline_modules,omitempty"` // $(sort $(ALL_MODULES.$(m).TEST_MAINLINE_MODULES))
- IsUnitTest bool `json:"is_unit_test,omitempty"` // $(ALL_MODULES.$(m).IS_UNIT_TEST)
+ IsUnitTest string `json:"is_unit_test,omitempty"` // $(ALL_MODULES.$(m).IS_UNIT_TEST)
TestOptionsTags []string `json:"test_options_tags,omitempty"` // $(sort $(ALL_MODULES.$(m).TEST_OPTIONS_TAGS))
RuntimeDependencies []string `json:"runtime_dependencies,omitempty"` // $(sort $(ALL_MODULES.$(m).LOCAL_RUNTIME_LIBRARIES))
StaticDependencies []string `json:"static_dependencies,omitempty"` // $(sort $(ALL_MODULES.$(m).LOCAL_STATIC_LIBRARIES))
@@ -44,6 +44,11 @@
AutoTestConfig []string `json:"auto_test_config,omitempty"` // $(ALL_MODULES.$(m).auto_test_config)
TestConfig []string `json:"test_config,omitempty"` // $(strip $(ALL_MODULES.$(m).TEST_CONFIG) $(ALL_MODULES.$(m).EXTRA_TEST_CONFIGS)
ExtraRequired []string `json:"-"`
+
+ SupportedVariantsOverride []string `json:"-"`
+ Disabled bool `json:"-"`
+ RegisterNameOverride string `json:"-"`
+ ModuleNameOverride string `json:"-"`
}
type ModuleInfoJSON struct {
@@ -128,4 +133,4 @@
return gobtools.CustomGobDecode[combinedModuleInfoJSON](data, m)
}
-var ModuleInfoJSONProvider = blueprint.NewProvider[*ModuleInfoJSON]()
+var ModuleInfoJSONProvider = blueprint.NewProvider[[]*ModuleInfoJSON]()
diff --git a/android/vendor_api_levels.go b/android/vendor_api_levels.go
index 4d364fd..d32bc56 100644
--- a/android/vendor_api_levels.go
+++ b/android/vendor_api_levels.go
@@ -27,6 +27,8 @@
sdkVersion = 35
case 202504:
sdkVersion = 36
+ case 202604:
+ sdkVersion = 37
default:
ok = false
}
diff --git a/cc/test.go b/cc/test.go
index 32b1551..9a339de 100644
--- a/cc/test.go
+++ b/cc/test.go
@@ -397,6 +397,24 @@
test.Properties.Test_options.Unit_test = proptools.BoolPtr(true)
}
+ if ctx.PrimaryArch() && !ctx.Config().KatiEnabled() { // TODO(spandandas): Remove the special case for kati
+ // Install the test config in testcases/ directory for atest.
+ // Use PrimaryArch and SubName to prevent duplicate installation rules
+ c, ok := ctx.Module().(*Module)
+ if !ok {
+ ctx.ModuleErrorf("Not a cc_test module")
+ }
+ testCases := android.PathForModuleInPartitionInstall(ctx, "testcases", ctx.ModuleName()+c.SubName())
+ if test.testConfig != nil {
+ ctx.InstallFile(testCases, test.testConfig.Base(), test.testConfig)
+ }
+ for _, extraTestConfig := range test.extraTestConfigs {
+ ctx.InstallFile(testCases, extraTestConfig.Base(), extraTestConfig)
+ }
+ ctx.InstallTestData(testCases, test.data)
+ ctx.InstallFile(testCases, file.Base(), file)
+ }
+
test.binaryDecorator.baseInstaller.installTestData(ctx, test.data)
test.binaryDecorator.baseInstaller.install(ctx, file)
}
diff --git a/fsgen/filesystem_creator.go b/fsgen/filesystem_creator.go
index ebcc68b..9dcbec1 100644
--- a/fsgen/filesystem_creator.go
+++ b/fsgen/filesystem_creator.go
@@ -42,8 +42,85 @@
ctx.PreDepsMutators(RegisterCollectFileSystemDepsMutators)
}
+type generatedPartitionData struct {
+ partitionType string
+ moduleName string
+ // supported is true if the module was created successfully, false if there was some problem
+ // and the module couldn't be created.
+ supported bool
+ handwritten bool
+}
+
+type allGeneratedPartitionData []generatedPartitionData
+
+func (d allGeneratedPartitionData) moduleNames() []string {
+ var result []string
+ for _, data := range d {
+ if data.supported {
+ result = append(result, data.moduleName)
+ }
+ }
+ return result
+}
+
+func (d allGeneratedPartitionData) types() []string {
+ var result []string
+ for _, data := range d {
+ if data.supported {
+ result = append(result, data.partitionType)
+ }
+ }
+ return result
+}
+
+func (d allGeneratedPartitionData) unsupportedTypes() []string {
+ var result []string
+ for _, data := range d {
+ if !data.supported {
+ result = append(result, data.partitionType)
+ }
+ }
+ return result
+}
+
+func (d allGeneratedPartitionData) names() []string {
+ var result []string
+ for _, data := range d {
+ if data.supported {
+ result = append(result, data.moduleName)
+ }
+ }
+ return result
+}
+
+func (d allGeneratedPartitionData) nameForType(ty string) string {
+ for _, data := range d {
+ if data.supported && data.partitionType == ty {
+ return data.moduleName
+ }
+ }
+ return ""
+}
+
+func (d allGeneratedPartitionData) typeForName(name string) string {
+ for _, data := range d {
+ if data.supported && data.moduleName == name {
+ return data.partitionType
+ }
+ }
+ return ""
+}
+
+func (d allGeneratedPartitionData) isHandwritten(name string) bool {
+ for _, data := range d {
+ if data.supported && data.moduleName == name {
+ return data.handwritten
+ }
+ }
+ return false
+}
+
type filesystemCreatorProps struct {
- Generated_partition_types []string `blueprint:"mutated"`
Unsupported_partition_types []string `blueprint:"mutated"`
Vbmeta_module_names []string `blueprint:"mutated"`
@@ -78,59 +155,71 @@
return module
}
-func generatedPartitions(ctx android.EarlyModuleContext) []string {
+func generatedPartitions(ctx android.EarlyModuleContext) allGeneratedPartitionData {
partitionVars := ctx.Config().ProductVariables().PartitionVarsForSoongMigrationOnlyDoNotUse
- generatedPartitions := []string{"system"}
+
+ var result allGeneratedPartitionData
+ addGenerated := func(ty string) {
+ result = append(result, generatedPartitionData{
+ partitionType: ty,
+ moduleName: generatedModuleNameForPartition(ctx.Config(), ty),
+ supported: true,
+ })
+ }
+
+ if ctx.Config().UseSoongSystemImage() {
+ if ctx.Config().SoongDefinedSystemImage() == "" {
+ panic("PRODUCT_SOONG_DEFINED_SYSTEM_IMAGE must be set if USE_SOONG_DEFINED_SYSTEM_IMAGE is true")
+ }
+ result = append(result, generatedPartitionData{
+ partitionType: "system",
+ moduleName: ctx.Config().SoongDefinedSystemImage(),
+ supported: true,
+ handwritten: true,
+ })
+ } else {
+ addGenerated("system")
+ }
if ctx.DeviceConfig().SystemExtPath() == "system_ext" {
- generatedPartitions = append(generatedPartitions, "system_ext")
+ addGenerated("system_ext")
}
if ctx.DeviceConfig().BuildingVendorImage() && ctx.DeviceConfig().VendorPath() == "vendor" {
- generatedPartitions = append(generatedPartitions, "vendor")
+ addGenerated("vendor")
}
if ctx.DeviceConfig().BuildingProductImage() && ctx.DeviceConfig().ProductPath() == "product" {
- generatedPartitions = append(generatedPartitions, "product")
+ addGenerated("product")
}
if ctx.DeviceConfig().BuildingOdmImage() && ctx.DeviceConfig().OdmPath() == "odm" {
- generatedPartitions = append(generatedPartitions, "odm")
+ addGenerated("odm")
}
if ctx.DeviceConfig().BuildingUserdataImage() && ctx.DeviceConfig().UserdataPath() == "data" {
- generatedPartitions = append(generatedPartitions, "userdata")
+ addGenerated("userdata")
}
if partitionVars.BuildingSystemDlkmImage {
- generatedPartitions = append(generatedPartitions, "system_dlkm")
+ addGenerated("system_dlkm")
}
if partitionVars.BuildingVendorDlkmImage {
- generatedPartitions = append(generatedPartitions, "vendor_dlkm")
+ addGenerated("vendor_dlkm")
}
if partitionVars.BuildingOdmDlkmImage {
- generatedPartitions = append(generatedPartitions, "odm_dlkm")
+ addGenerated("odm_dlkm")
}
if partitionVars.BuildingRamdiskImage {
- generatedPartitions = append(generatedPartitions, "ramdisk")
+ addGenerated("ramdisk")
}
if buildingVendorBootImage(partitionVars) {
- generatedPartitions = append(generatedPartitions, "vendor_ramdisk")
+ addGenerated("vendor_ramdisk")
}
if ctx.DeviceConfig().BuildingRecoveryImage() && ctx.DeviceConfig().RecoveryPath() == "recovery" {
- generatedPartitions = append(generatedPartitions, "recovery")
+ addGenerated("recovery")
}
- return generatedPartitions
+ return result
}
func (f *filesystemCreator) createInternalModules(ctx android.LoadHookContext) {
- soongGeneratedPartitions := generatedPartitions(ctx)
- finalSoongGeneratedPartitions := make([]string, 0, len(soongGeneratedPartitions))
- for _, partitionType := range soongGeneratedPartitions {
- if f.createPartition(ctx, partitionType) {
- f.properties.Generated_partition_types = append(f.properties.Generated_partition_types, partitionType)
- finalSoongGeneratedPartitions = append(finalSoongGeneratedPartitions, partitionType)
- } else {
- f.properties.Unsupported_partition_types = append(f.properties.Unsupported_partition_types, partitionType)
- }
- }
- finalSoongGeneratedPartitionNames := make([]string, 0, len(finalSoongGeneratedPartitions))
- for _, partitionType := range finalSoongGeneratedPartitions {
- finalSoongGeneratedPartitionNames = append(finalSoongGeneratedPartitionNames, generatedModuleNameForPartition(ctx.Config(), partitionType))
+ partitions := generatedPartitions(ctx)
+ for i := range partitions {
+ f.createPartition(ctx, partitions, &partitions[i])
}
// Create android_info.prop
f.createAndroidInfo(ctx)
@@ -162,13 +251,13 @@
var systemOtherImageName string
if buildingSystemOtherImage(partitionVars) {
- systemModule := generatedModuleNameForPartition(ctx.Config(), "system")
+ systemModule := partitions.nameForType("system")
systemOtherImageName = generatedModuleNameForPartition(ctx.Config(), "system_other")
ctx.CreateModule(
filesystem.SystemOtherImageFactory,
&filesystem.SystemOtherImageProperties{
System_image: &systemModule,
- Preinstall_dexpreopt_files_from: finalSoongGeneratedPartitionNames,
+ Preinstall_dexpreopt_files_from: partitions.moduleNames(),
},
&struct {
Name *string
@@ -178,19 +267,19 @@
)
}
- for _, x := range f.createVbmetaPartitions(ctx, finalSoongGeneratedPartitions) {
+ for _, x := range f.createVbmetaPartitions(ctx, partitions) {
f.properties.Vbmeta_module_names = append(f.properties.Vbmeta_module_names, x.moduleName)
f.properties.Vbmeta_partition_names = append(f.properties.Vbmeta_partition_names, x.partitionName)
}
var superImageSubpartitions []string
if buildingSuperImage(partitionVars) {
- superImageSubpartitions = createSuperImage(ctx, finalSoongGeneratedPartitions, partitionVars, systemOtherImageName)
+ superImageSubpartitions = createSuperImage(ctx, partitions, partitionVars, systemOtherImageName)
f.properties.Super_image = ":" + generatedModuleNameForPartition(ctx.Config(), "super")
}
- ctx.Config().Get(fsGenStateOnceKey).(*FsGenState).soongGeneratedPartitions = finalSoongGeneratedPartitions
- f.createDeviceModule(ctx, finalSoongGeneratedPartitions, f.properties.Vbmeta_module_names, superImageSubpartitions)
+ ctx.Config().Get(fsGenStateOnceKey).(*FsGenState).soongGeneratedPartitions = partitions
+ f.createDeviceModule(ctx, partitions, f.properties.Vbmeta_module_names, superImageSubpartitions)
}
func generatedModuleName(cfg android.Config, suffix string) string {
@@ -233,7 +322,7 @@
func (f *filesystemCreator) createDeviceModule(
ctx android.LoadHookContext,
- generatedPartitionTypes []string,
+ partitions allGeneratedPartitionData,
vbmetaPartitions []string,
superImageSubPartitions []string,
) {
@@ -250,35 +339,35 @@
if f.properties.Super_image != "" {
partitionProps.Super_partition_name = proptools.StringPtr(generatedModuleNameForPartition(ctx.Config(), "super"))
}
- if android.InList("system", generatedPartitionTypes) && !android.InList("system", superImageSubPartitions) {
- partitionProps.System_partition_name = proptools.StringPtr(generatedModuleNameForPartition(ctx.Config(), "system"))
+ if modName := partitions.nameForType("system"); modName != "" && !android.InList("system", superImageSubPartitions) {
+ partitionProps.System_partition_name = proptools.StringPtr(modName)
}
- if android.InList("system_ext", generatedPartitionTypes) && !android.InList("system_ext", superImageSubPartitions) {
- partitionProps.System_ext_partition_name = proptools.StringPtr(generatedModuleNameForPartition(ctx.Config(), "system_ext"))
+ if modName := partitions.nameForType("system_ext"); modName != "" && !android.InList("system_ext", superImageSubPartitions) {
+ partitionProps.System_ext_partition_name = proptools.StringPtr(modName)
}
- if android.InList("vendor", generatedPartitionTypes) && !android.InList("vendor", superImageSubPartitions) {
- partitionProps.Vendor_partition_name = proptools.StringPtr(generatedModuleNameForPartition(ctx.Config(), "vendor"))
+ if modName := partitions.nameForType("vendor"); modName != "" && !android.InList("vendor", superImageSubPartitions) {
+ partitionProps.Vendor_partition_name = proptools.StringPtr(modName)
}
- if android.InList("product", generatedPartitionTypes) && !android.InList("product", superImageSubPartitions) {
- partitionProps.Product_partition_name = proptools.StringPtr(generatedModuleNameForPartition(ctx.Config(), "product"))
+ if modName := partitions.nameForType("product"); modName != "" && !android.InList("product", superImageSubPartitions) {
+ partitionProps.Product_partition_name = proptools.StringPtr(modName)
}
- if android.InList("odm", generatedPartitionTypes) && !android.InList("odm", superImageSubPartitions) {
- partitionProps.Odm_partition_name = proptools.StringPtr(generatedModuleNameForPartition(ctx.Config(), "odm"))
+ if modName := partitions.nameForType("odm"); modName != "" && !android.InList("odm", superImageSubPartitions) {
+ partitionProps.Odm_partition_name = proptools.StringPtr(modName)
}
- if android.InList("userdata", f.properties.Generated_partition_types) {
- partitionProps.Userdata_partition_name = proptools.StringPtr(generatedModuleNameForPartition(ctx.Config(), "userdata"))
+ if modName := partitions.nameForType("userdata"); modName != "" {
+ partitionProps.Userdata_partition_name = proptools.StringPtr(modName)
}
- if android.InList("recovery", f.properties.Generated_partition_types) {
- partitionProps.Recovery_partition_name = proptools.StringPtr(generatedModuleNameForPartition(ctx.Config(), "recovery"))
+ if modName := partitions.nameForType("recovery"); modName != "" {
+ partitionProps.Recovery_partition_name = proptools.StringPtr(modName)
}
- if android.InList("system_dlkm", f.properties.Generated_partition_types) && !android.InList("system_dlkm", superImageSubPartitions) {
- partitionProps.System_dlkm_partition_name = proptools.StringPtr(generatedModuleNameForPartition(ctx.Config(), "system_dlkm"))
+ if modName := partitions.nameForType("system_dlkm"); modName != "" && !android.InList("system_dlkm", superImageSubPartitions) {
+ partitionProps.System_dlkm_partition_name = proptools.StringPtr(modName)
}
- if android.InList("vendor_dlkm", f.properties.Generated_partition_types) && !android.InList("vendor_dlkm", superImageSubPartitions) {
- partitionProps.Vendor_dlkm_partition_name = proptools.StringPtr(generatedModuleNameForPartition(ctx.Config(), "vendor_dlkm"))
+ if modName := partitions.nameForType("vendor_dlkm"); modName != "" && !android.InList("vendor_dlkm", superImageSubPartitions) {
+ partitionProps.Vendor_dlkm_partition_name = proptools.StringPtr(modName)
}
- if android.InList("odm_dlkm", f.properties.Generated_partition_types) && !android.InList("odm_dlkm", superImageSubPartitions) {
- partitionProps.Odm_dlkm_partition_name = proptools.StringPtr(generatedModuleNameForPartition(ctx.Config(), "odm_dlkm"))
+ if modName := partitions.nameForType("odm_dlkm"); modName != "" && !android.InList("odm_dlkm", superImageSubPartitions) {
+ partitionProps.Odm_dlkm_partition_name = proptools.StringPtr(modName)
}
if f.properties.Boot_image != "" {
partitionProps.Boot_partition_name = proptools.StringPtr(generatedModuleNameForPartition(ctx.Config(), "boot"))
@@ -302,7 +391,8 @@
ctx.CreateModule(filesystem.AndroidDeviceFactory, baseProps, partitionProps, deviceProps)
}
-func partitionSpecificFsProps(ctx android.EarlyModuleContext, fsProps *filesystem.FilesystemProperties, partitionVars android.PartitionVariables, partitionType string) {
+func partitionSpecificFsProps(ctx android.EarlyModuleContext, partitions allGeneratedPartitionData, fsProps *filesystem.FilesystemProperties, partitionType string) {
+ partitionVars := ctx.Config().ProductVariables().PartitionVarsForSoongMigrationOnlyDoNotUse
switch partitionType {
case "system":
fsProps.Build_logtags = proptools.BoolPtr(true)
@@ -354,8 +444,8 @@
fsProps.Dirs = proptools.NewSimpleConfigurable(commonPartitionDirs)
fsProps.Security_patch = proptools.StringPtr(ctx.Config().PlatformSecurityPatch())
- if ctx.DeviceConfig().SystemExtPath() == "system_ext" {
- fsProps.Import_aconfig_flags_from = []string{generatedModuleNameForPartition(ctx.Config(), "system_ext")}
+ if systemExtName := partitions.nameForType("system_ext"); systemExtName != "" {
+ fsProps.Import_aconfig_flags_from = []string{systemExtName}
}
fsProps.Stem = proptools.StringPtr("system.img")
case "system_ext":
@@ -371,9 +461,9 @@
fsProps.Stem = proptools.StringPtr("system_ext.img")
case "product":
fsProps.Gen_aconfig_flags_pb = proptools.BoolPtr(true)
- fsProps.Android_filesystem_deps.System = proptools.StringPtr(generatedModuleNameForPartition(ctx.Config(), "system"))
- if ctx.DeviceConfig().SystemExtPath() == "system_ext" {
- fsProps.Android_filesystem_deps.System_ext = proptools.StringPtr(generatedModuleNameForPartition(ctx.Config(), "system_ext"))
+ fsProps.Android_filesystem_deps.System = proptools.StringPtr(partitions.nameForType("system"))
+ if systemExtName := partitions.nameForType("system_ext"); systemExtName != "" {
+ fsProps.Android_filesystem_deps.System_ext = proptools.StringPtr(systemExtName)
}
fsProps.Security_patch = proptools.StringPtr(ctx.Config().PlatformSecurityPatch())
fsProps.Stem = proptools.StringPtr("product.img")
@@ -389,9 +479,9 @@
Name: proptools.StringPtr("lib/modules"),
},
}
- fsProps.Android_filesystem_deps.System = proptools.StringPtr(generatedModuleNameForPartition(ctx.Config(), "system"))
- if ctx.DeviceConfig().SystemExtPath() == "system_ext" {
- fsProps.Android_filesystem_deps.System_ext = proptools.StringPtr(generatedModuleNameForPartition(ctx.Config(), "system_ext"))
+ fsProps.Android_filesystem_deps.System = proptools.StringPtr(partitions.nameForType("system"))
+ if systemExtName := partitions.nameForType("system_ext"); systemExtName != "" {
+ fsProps.Android_filesystem_deps.System_ext = proptools.StringPtr(systemExtName)
}
fsProps.Security_patch = proptools.StringPtr(partitionVars.VendorSecurityPatch)
fsProps.Stem = proptools.StringPtr("vendor.img")
@@ -481,8 +571,8 @@
fsProps.Security_patch = proptools.StringPtr(partitionVars.OdmDlkmSecurityPatch)
fsProps.Stem = proptools.StringPtr("odm_dlkm.img")
case "vendor_ramdisk":
- if android.InList("recovery", generatedPartitions(ctx)) {
- fsProps.Include_files_of = []string{generatedModuleNameForPartition(ctx.Config(), "recovery")}
+ if recoveryName := partitions.nameForType("recovery"); recoveryName != "" {
+ fsProps.Include_files_of = []string{recoveryName}
}
fsProps.Stem = proptools.StringPtr("vendor_ramdisk.img")
}
@@ -496,16 +586,22 @@
}
)
-// Creates a soong module to build the given partition. Returns false if we can't support building
-// it.
-func (f *filesystemCreator) createPartition(ctx android.LoadHookContext, partitionType string) bool {
- baseProps := generateBaseProps(proptools.StringPtr(generatedModuleNameForPartition(ctx.Config(), partitionType)))
-
- fsProps, supported := generateFsProps(ctx, partitionType)
- if !supported {
- return false
+// Creates a soong module to build the given partition.
+func (f *filesystemCreator) createPartition(ctx android.LoadHookContext, partitions allGeneratedPartitionData, partition *generatedPartitionData) {
+ // Nextgen team's handwritten soong system image, don't need to create anything ourselves
+ if partition.partitionType == "system" && ctx.Config().UseSoongSystemImage() {
+ return
}
+ baseProps := generateBaseProps(proptools.StringPtr(partition.moduleName))
+
+ fsProps, supported := generateFsProps(ctx, partitions, partition.partitionType)
+ if !supported {
+ partition.supported = false
+ return
+ }
+
+ partitionType := partition.partitionType
if partitionType == "vendor" || partitionType == "product" || partitionType == "system" {
fsProps.Linker_config.Gen_linker_config = proptools.BoolPtr(true)
if partitionType != "system" {
@@ -529,7 +625,6 @@
if partitionType == "vendor" {
f.createVendorBuildProp(ctx)
}
- return true
}
// Creates filegroups for the files specified in BOARD_(partition_)AVB_KEY_PATH
@@ -731,7 +826,7 @@
moduleName := generatedModuleName(ctx.Config(), "recovery-prop.default")
var vendorBuildProp *string
- if android.InList("vendor", generatedPartitions(ctx)) {
+ if ctx.DeviceConfig().BuildingVendorImage() && ctx.DeviceConfig().VendorPath() == "vendor" {
vendorBuildProp = proptools.StringPtr(":" + generatedModuleName(ctx.Config(), "vendor-build.prop"))
}
@@ -821,7 +916,7 @@
}
}
-func generateFsProps(ctx android.EarlyModuleContext, partitionType string) (*filesystem.FilesystemProperties, bool) {
+func generateFsProps(ctx android.EarlyModuleContext, partitions allGeneratedPartitionData, partitionType string) (*filesystem.FilesystemProperties, bool) {
fsProps := &filesystem.FilesystemProperties{}
partitionVars := ctx.Config().ProductVariables().PartitionVarsForSoongMigrationOnlyDoNotUse
@@ -889,7 +984,7 @@
}
- partitionSpecificFsProps(ctx, fsProps, partitionVars, partitionType)
+ partitionSpecificFsProps(ctx, partitions, fsProps, partitionType)
return fsProps, true
}
@@ -976,12 +1071,12 @@
return result
}
-func (f *filesystemCreator) createFileListDiffTest(ctx android.ModuleContext, partitionType string) android.Path {
- partitionModuleName := generatedModuleNameForPartition(ctx.Config(), partitionType)
+func (f *filesystemCreator) createFileListDiffTest(ctx android.ModuleContext, partitionType string, partitionModuleName string) android.Path {
partitionImage := ctx.GetDirectDepWithTag(partitionModuleName, generatedFilesystemDepTag)
filesystemInfo, ok := android.OtherModuleProvider(ctx, partitionImage, filesystem.FilesystemProvider)
if !ok {
ctx.ModuleErrorf("Expected module %s to provide FileysystemInfo", partitionModuleName)
+ return nil
}
makeFileList := android.PathForArbitraryOutput(ctx, fmt.Sprintf("target/product/%s/obj/PACKAGING/%s_intermediates/file_list.txt", ctx.Config().DeviceName(), partitionType))
diffTestResultFile := android.PathForModuleOut(ctx, fmt.Sprintf("diff_test_%s.txt", partitionModuleName))
@@ -1042,8 +1137,8 @@
var generatedVbmetaPartitionDepTag imageDepTagType
func (f *filesystemCreator) DepsMutator(ctx android.BottomUpMutatorContext) {
- for _, partitionType := range f.properties.Generated_partition_types {
- ctx.AddDependency(ctx.Module(), generatedFilesystemDepTag, generatedModuleNameForPartition(ctx.Config(), partitionType))
+ for _, name := range ctx.Config().Get(fsGenStateOnceKey).(*FsGenState).soongGeneratedPartitions.names() {
+ ctx.AddDependency(ctx.Module(), generatedFilesystemDepTag, name)
}
for _, vbmetaModule := range f.properties.Vbmeta_module_names {
ctx.AddDependency(ctx.Module(), generatedVbmetaPartitionDepTag, vbmetaModule)
@@ -1056,9 +1151,11 @@
}
f.HideFromMake()
+ partitions := ctx.Config().Get(fsGenStateOnceKey).(*FsGenState).soongGeneratedPartitions
+
var content strings.Builder
generatedBp := android.PathForModuleOut(ctx, "soong_generated_product_config.bp")
- for _, partition := range ctx.Config().Get(fsGenStateOnceKey).(*FsGenState).soongGeneratedPartitions {
+ for _, partition := range partitions.types() {
content.WriteString(generateBpContent(ctx, partition))
content.WriteString("\n")
}
@@ -1067,12 +1164,12 @@
ctx.Phony("product_config_to_bp", generatedBp)
var diffTestFiles []android.Path
- for _, partitionType := range f.properties.Generated_partition_types {
- diffTestFile := f.createFileListDiffTest(ctx, partitionType)
+ for _, partitionType := range partitions.types() {
+ diffTestFile := f.createFileListDiffTest(ctx, partitionType, partitions.nameForType(partitionType))
diffTestFiles = append(diffTestFiles, diffTestFile)
ctx.Phony(fmt.Sprintf("soong_generated_%s_filesystem_test", partitionType), diffTestFile)
}
- for _, partitionType := range f.properties.Unsupported_partition_types {
+ for _, partitionType := range slices.Concat(partitions.unsupportedTypes(), f.properties.Unsupported_partition_types) {
diffTestFile := createFailingCommand(ctx, fmt.Sprintf("Couldn't build %s partition", partitionType))
diffTestFiles = append(diffTestFiles, diffTestFile)
ctx.Phony(fmt.Sprintf("soong_generated_%s_filesystem_test", partitionType), diffTestFile)
@@ -1118,13 +1215,13 @@
}
func generateBpContent(ctx android.EarlyModuleContext, partitionType string) string {
- fsProps, fsTypeSupported := generateFsProps(ctx, partitionType)
+ fsGenState := ctx.Config().Get(fsGenStateOnceKey).(*FsGenState)
+ fsProps, fsTypeSupported := generateFsProps(ctx, fsGenState.soongGeneratedPartitions, partitionType)
if !fsTypeSupported {
return ""
}
baseProps := generateBaseProps(proptools.StringPtr(generatedModuleNameForPartition(ctx.Config(), partitionType)))
- fsGenState := ctx.Config().Get(fsGenStateOnceKey).(*FsGenState)
deps := fsGenState.fsDeps[partitionType]
highPriorityDeps := fsGenState.generatedPrebuiltEtcModuleNames
depProps := generateDepStruct(*deps, highPriorityDeps)
diff --git a/fsgen/fsgen_mutators.go b/fsgen/fsgen_mutators.go
index 9327669..9b25e77 100644
--- a/fsgen/fsgen_mutators.go
+++ b/fsgen/fsgen_mutators.go
@@ -60,8 +60,8 @@
depCandidates []string
// Map of names of partition to the information of modules to be added as deps
fsDeps map[string]*multilibDeps
- // List of name of partitions to be generated by the filesystem_creator module
- soongGeneratedPartitions []string
+ // Information about the main soong-generated partitions
+ soongGeneratedPartitions allGeneratedPartitionData
// Mutex to protect the fsDeps
fsDepsMutex sync.Mutex
// Map of _all_ soong module names to their corresponding installation properties
@@ -282,9 +282,12 @@
removeOverriddenDeps(mctx)
fsGenState := mctx.Config().Get(fsGenStateOnceKey).(*FsGenState)
fsDeps := fsGenState.fsDeps
- soongGeneratedPartitionMap := getAllSoongGeneratedPartitionNames(mctx.Config(), fsGenState.soongGeneratedPartitions)
m := mctx.Module()
- if partition, ok := soongGeneratedPartitionMap[m.Name()]; ok {
+ if partition := fsGenState.soongGeneratedPartitions.typeForName(m.Name()); partition != "" {
+ if fsGenState.soongGeneratedPartitions.isHandwritten(m.Name()) {
+ // Handwritten image, don't modify it
+ return
+ }
depsStruct := generateDepStruct(*fsDeps[partition], fsGenState.generatedPrebuiltEtcModuleNames)
if err := proptools.AppendMatchingProperties(m.GetProperties(), depsStruct, nil); err != nil {
mctx.ModuleErrorf(err.Error())
diff --git a/fsgen/super_img.go b/fsgen/super_img.go
index e353688..569f780 100644
--- a/fsgen/super_img.go
+++ b/fsgen/super_img.go
@@ -29,7 +29,7 @@
func createSuperImage(
ctx android.LoadHookContext,
- partitions []string,
+ partitions allGeneratedPartitionData,
partitionVars android.PartitionVariables,
systemOtherImageName string,
) []string {
@@ -90,40 +90,40 @@
var superImageSubpartitions []string
partitionNameProps := &filesystem.SuperImagePartitionNameProperties{}
- if android.InList("system", partitions) {
- partitionNameProps.System_partition = proptools.StringPtr(generatedModuleNameForPartition(ctx.Config(), "system"))
+ if modName := partitions.nameForType("system"); modName != "" {
+ partitionNameProps.System_partition = proptools.StringPtr(modName)
superImageSubpartitions = append(superImageSubpartitions, "system")
}
- if android.InList("system_ext", partitions) {
- partitionNameProps.System_ext_partition = proptools.StringPtr(generatedModuleNameForPartition(ctx.Config(), "system_ext"))
+ if modName := partitions.nameForType("system_ext"); modName != "" {
+ partitionNameProps.System_ext_partition = proptools.StringPtr(modName)
superImageSubpartitions = append(superImageSubpartitions, "system_ext")
}
- if android.InList("system_dlkm", partitions) {
- partitionNameProps.System_dlkm_partition = proptools.StringPtr(generatedModuleNameForPartition(ctx.Config(), "system_dlkm"))
+ if modName := partitions.nameForType("system_dlkm"); modName != "" {
+ partitionNameProps.System_dlkm_partition = proptools.StringPtr(modName)
superImageSubpartitions = append(superImageSubpartitions, "system_dlkm")
}
- if android.InList("system_other", partitions) {
- partitionNameProps.System_other_partition = proptools.StringPtr(generatedModuleNameForPartition(ctx.Config(), "system_other"))
+ if modName := partitions.nameForType("system_other"); modName != "" {
+ partitionNameProps.System_other_partition = proptools.StringPtr(modName)
superImageSubpartitions = append(superImageSubpartitions, "system_other")
}
- if android.InList("product", partitions) {
- partitionNameProps.Product_partition = proptools.StringPtr(generatedModuleNameForPartition(ctx.Config(), "product"))
+ if modName := partitions.nameForType("product"); modName != "" {
+ partitionNameProps.Product_partition = proptools.StringPtr(modName)
superImageSubpartitions = append(superImageSubpartitions, "product")
}
- if android.InList("vendor", partitions) {
- partitionNameProps.Vendor_partition = proptools.StringPtr(generatedModuleNameForPartition(ctx.Config(), "vendor"))
+ if modName := partitions.nameForType("vendor"); modName != "" {
+ partitionNameProps.Vendor_partition = proptools.StringPtr(modName)
superImageSubpartitions = append(superImageSubpartitions, "vendor")
}
- if android.InList("vendor_dlkm", partitions) {
- partitionNameProps.Vendor_dlkm_partition = proptools.StringPtr(generatedModuleNameForPartition(ctx.Config(), "vendor_dlkm"))
+ if modName := partitions.nameForType("vendor_dlkm"); modName != "" {
+ partitionNameProps.Vendor_dlkm_partition = proptools.StringPtr(modName)
superImageSubpartitions = append(superImageSubpartitions, "vendor_dlkm")
}
- if android.InList("odm", partitions) {
- partitionNameProps.Odm_partition = proptools.StringPtr(generatedModuleNameForPartition(ctx.Config(), "odm"))
+ if modName := partitions.nameForType("odm"); modName != "" {
+ partitionNameProps.Odm_partition = proptools.StringPtr(modName)
superImageSubpartitions = append(superImageSubpartitions, "odm")
}
- if android.InList("odm_dlkm", partitions) {
- partitionNameProps.Odm_dlkm_partition = proptools.StringPtr(generatedModuleNameForPartition(ctx.Config(), "odm_dlkm"))
+ if modName := partitions.nameForType("odm_dlkm"); modName != "" {
+ partitionNameProps.Odm_dlkm_partition = proptools.StringPtr(modName)
superImageSubpartitions = append(superImageSubpartitions, "odm_dlkm")
}
diff --git a/fsgen/vbmeta_partitions.go b/fsgen/vbmeta_partitions.go
index be738ea..93425ae 100644
--- a/fsgen/vbmeta_partitions.go
+++ b/fsgen/vbmeta_partitions.go
@@ -17,7 +17,6 @@
import (
"android/soong/android"
"android/soong/filesystem"
- "slices"
"strconv"
"github.com/google/blueprint/proptools"
@@ -63,7 +62,7 @@
// like vbmeta_system might contain the avb metadata for just a few products. In cuttlefish
// vbmeta_system contains metadata about product, system, and system_ext. Using chained partitions,
// that group of partitions can be updated independently from the other signed partitions.
-func (f *filesystemCreator) createVbmetaPartitions(ctx android.LoadHookContext, generatedPartitionTypes []string) []vbmetaModuleInfo {
+func (f *filesystemCreator) createVbmetaPartitions(ctx android.LoadHookContext, partitions allGeneratedPartitionData) []vbmetaModuleInfo {
partitionVars := ctx.Config().ProductVariables().PartitionVarsForSoongMigrationOnlyDoNotUse
// Some products seem to have BuildingVbmetaImage as true even when BoardAvbEnable is false
if !partitionVars.BuildingVbmetaImage || !partitionVars.BoardAvbEnable {
@@ -114,11 +113,9 @@
var partitionModules []string
for _, partition := range props.Partitions {
- if !slices.Contains(generatedPartitionTypes, partition) {
- // The partition is probably unsupported.
- continue
+ if modName := partitions.nameForType(partition); modName != "" {
+ partitionModules = append(partitionModules, modName)
}
- partitionModules = append(partitionModules, generatedModuleNameForPartition(ctx.Config(), partition))
}
name := generatedModuleNameForPartition(ctx.Config(), chainedName)
@@ -218,7 +215,7 @@
var chainedPartitionModules []string
var includePartitionModules []string
- allGeneratedPartitionTypes := append(generatedPartitionTypes,
+ allGeneratedPartitionTypes := append(partitions.types(),
chainedPartitionTypes...,
)
if len(f.properties.Boot_image) > 0 {
diff --git a/java/androidmk.go b/java/androidmk.go
index 039e847..e0a86b5 100644
--- a/java/androidmk.go
+++ b/java/androidmk.go
@@ -23,13 +23,12 @@
"github.com/google/blueprint/proptools"
)
-func (library *Library) AndroidMkEntriesHostDex() android.AndroidMkEntries {
- hostDexNeeded := Bool(library.deviceProperties.Hostdex) && !library.Host()
- if library.hideApexVariantFromMake {
- hostDexNeeded = false
- }
+func (library *Library) hostDexNeeded() bool {
+ return Bool(library.deviceProperties.Hostdex) && !library.Host() && !library.hideApexVariantFromMake
+}
- if hostDexNeeded {
+func (library *Library) AndroidMkEntriesHostDex() android.AndroidMkEntries {
+ if library.hostDexNeeded() {
var output android.Path
if library.dexJarFile.IsSet() {
output = library.dexJarFile.Path()
diff --git a/java/dexpreopt.go b/java/dexpreopt.go
index 24e5f50..f52ce5d 100644
--- a/java/dexpreopt.go
+++ b/java/dexpreopt.go
@@ -80,11 +80,11 @@
// safe to use in `android.AndroidMkExtraEntriesFunc`.
func (install dexpreopterInstall) ToMakeEntries() android.AndroidMkEntries {
return android.AndroidMkEntries{
- Class: "ETC",
- OutputFile: android.OptionalPathForPath(install.outputPathOnHost),
+ OverrideName: install.FullModuleName(),
+ Class: "ETC",
+ OutputFile: android.OptionalPathForPath(install.outputPathOnHost),
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
- entries.SetString("LOCAL_MODULE", install.FullModuleName())
entries.SetString("LOCAL_MODULE_PATH", install.installDirOnDevice.String())
entries.SetString("LOCAL_INSTALLED_MODULE_STEM", install.installFileOnDevice)
entries.SetString("LOCAL_NOT_AVAILABLE_FOR_PLATFORM", "false")
@@ -93,6 +93,14 @@
}
}
+func (install dexpreopterInstall) AddModuleInfoJSONForApex(ctx android.ModuleContext) {
+ moduleInfoJSON := ctx.ExtraModuleInfoJSON()
+ moduleInfoJSON.RegisterNameOverride = install.FullModuleName()
+ moduleInfoJSON.ModuleNameOverride = install.FullModuleName()
+ moduleInfoJSON.Class = []string{"ETC"}
+ moduleInfoJSON.SystemSharedLibs = []string{"none"}
+}
+
type Dexpreopter struct {
dexpreopter
}
@@ -660,6 +668,12 @@
return entries
}
+func (d *dexpreopter) ModuleInfoJSONForApex(ctx android.ModuleContext) {
+ for _, install := range d.builtInstalledForApex {
+ install.AddModuleInfoJSONForApex(ctx)
+ }
+}
+
func (d *dexpreopter) OutputProfilePathOnHost() android.Path {
return d.outputProfilePathOnHost
}
diff --git a/java/java.go b/java/java.go
index 70ebebe..66550d5 100644
--- a/java/java.go
+++ b/java/java.go
@@ -1069,6 +1069,29 @@
}
setOutputFiles(ctx, j.Module)
+
+ moduleInfoJSON := ctx.ModuleInfoJSON()
+ moduleInfoJSON.Class = []string{"JAVA_LIBRARIES"}
+ if j.implementationAndResourcesJar != nil {
+ moduleInfoJSON.ClassesJar = []string{j.implementationAndResourcesJar.String()}
+ }
+ moduleInfoJSON.SystemSharedLibs = []string{"none"}
+
+ if j.hostDexNeeded() {
+ hostDexModuleInfoJSON := ctx.ExtraModuleInfoJSON()
+ hostDexModuleInfoJSON.SubName = "-hostdex"
+ hostDexModuleInfoJSON.Class = []string{"JAVA_LIBRARIES"}
+ if j.implementationAndResourcesJar != nil {
+ hostDexModuleInfoJSON.ClassesJar = []string{j.implementationAndResourcesJar.String()}
+ }
+ hostDexModuleInfoJSON.SystemSharedLibs = []string{"none"}
+ hostDexModuleInfoJSON.SupportedVariantsOverride = []string{"HOST"}
+ }
+
+ if j.hideApexVariantFromMake {
+ moduleInfoJSON.Disabled = true
+ j.dexpreopter.ModuleInfoJSONForApex(ctx)
+ }
}
func (j *Library) getJarInstallDir(ctx android.ModuleContext) android.InstallPath {
@@ -1627,6 +1650,11 @@
MkInclude: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk",
MkAppClass: "JAVA_LIBRARIES",
})
+
+ moduleInfoJSON := ctx.ModuleInfoJSON()
+ if proptools.Bool(j.testProperties.Test_options.Unit_test) {
+ moduleInfoJSON.CompatibilitySuites = append(moduleInfoJSON.CompatibilitySuites, "host-unit-tests")
+ }
}
func (j *Test) GenerateAndroidBuildActions(ctx android.ModuleContext) {
@@ -1704,10 +1732,54 @@
})
j.Library.GenerateAndroidBuildActions(ctx)
+
+ moduleInfoJSON := ctx.ModuleInfoJSON()
+ // LOCAL_MODULE_TAGS
+ moduleInfoJSON.Tags = append(moduleInfoJSON.Tags, "tests")
+ var allTestConfigs android.Paths
+ if j.testConfig != nil {
+ allTestConfigs = append(allTestConfigs, j.testConfig)
+ }
+ allTestConfigs = append(allTestConfigs, j.extraTestConfigs...)
+ if len(allTestConfigs) > 0 {
+ moduleInfoJSON.TestConfig = allTestConfigs.Strings()
+ } else {
+ optionalConfig := android.ExistentPathForSource(ctx, ctx.ModuleDir(), "AndroidTest.xml")
+ if optionalConfig.Valid() {
+ moduleInfoJSON.TestConfig = append(moduleInfoJSON.TestConfig, optionalConfig.String())
+ }
+ }
+ if len(j.testProperties.Test_suites) > 0 {
+ moduleInfoJSON.CompatibilitySuites = append(moduleInfoJSON.CompatibilitySuites, j.testProperties.Test_suites...)
+ } else {
+ moduleInfoJSON.CompatibilitySuites = append(moduleInfoJSON.CompatibilitySuites, "null-suite")
+ }
+ if _, ok := j.testConfig.(android.WritablePath); ok {
+ moduleInfoJSON.AutoTestConfig = []string{"true"}
+ }
+ if proptools.Bool(j.testProperties.Test_options.Unit_test) {
+ moduleInfoJSON.IsUnitTest = "true"
+ if ctx.Host() {
+ moduleInfoJSON.CompatibilitySuites = append(moduleInfoJSON.CompatibilitySuites, "host-unit-tests")
+ }
+ }
+ moduleInfoJSON.TestMainlineModules = append(moduleInfoJSON.TestMainlineModules, j.testProperties.Test_mainline_modules...)
}
func (j *TestHelperLibrary) GenerateAndroidBuildActions(ctx android.ModuleContext) {
j.Library.GenerateAndroidBuildActions(ctx)
+
+ moduleInfoJSON := ctx.ModuleInfoJSON()
+ moduleInfoJSON.Tags = append(moduleInfoJSON.Tags, "tests")
+ if len(j.testHelperLibraryProperties.Test_suites) > 0 {
+ moduleInfoJSON.CompatibilitySuites = append(moduleInfoJSON.CompatibilitySuites, j.testHelperLibraryProperties.Test_suites...)
+ } else {
+ moduleInfoJSON.CompatibilitySuites = append(moduleInfoJSON.CompatibilitySuites, "null-suite")
+ }
+ optionalConfig := android.ExistentPathForSource(ctx, ctx.ModuleDir(), "AndroidTest.xml")
+ if optionalConfig.Valid() {
+ moduleInfoJSON.TestConfig = append(moduleInfoJSON.TestConfig, optionalConfig.String())
+ }
}
func (j *JavaTestImport) GenerateAndroidBuildActions(ctx android.ModuleContext) {
diff --git a/java/ravenwood.go b/java/ravenwood.go
index 8c8d8e9..3b6c80b 100644
--- a/java/ravenwood.go
+++ b/java/ravenwood.go
@@ -258,6 +258,15 @@
// Install our JAR with all dependencies
ctx.InstallFile(installPath, ctx.ModuleName()+".jar", r.outputFile, installDeps...)
+
+ moduleInfoJSON := ctx.ModuleInfoJSON()
+ if _, ok := r.testConfig.(android.WritablePath); ok {
+ moduleInfoJSON.AutoTestConfig = []string{"true"}
+ }
+ if r.testConfig != nil {
+ moduleInfoJSON.TestConfig = append(moduleInfoJSON.TestConfig, r.testConfig.String())
+ }
+ moduleInfoJSON.CompatibilitySuites = []string{"general-tests", "ravenwood-tests"}
}
func (r *ravenwoodTest) AndroidMkEntries() []android.AndroidMkEntries {