Introduce prebuilt_any module type
prebuilt_any is a "wildcard" module type that allows installing the files in any subdirectories within the partition. This module is only used for converting the PRODUCT_COPY_FILES in fsgen, and should not be written in the bp files. Test: m nothing --no-skip-soong-tests Bug: 375053752 Change-Id: Ic0839b0dbbfa6b012c6b920eecf4ebc6fed8d51f
This commit is contained in:
parent
c099116fb0
commit
cc1c4aaf9a
4 changed files with 26 additions and 1 deletions
|
|
@ -250,6 +250,7 @@ func createInstallInRootAllowingRules() []Rule {
|
|||
NotModuleType("prebuilt_system").
|
||||
NotModuleType("prebuilt_first_stage_ramdisk").
|
||||
NotModuleType("prebuilt_res").
|
||||
NotModuleType("prebuilt_any").
|
||||
Because("install_in_root is only for init_first_stage or librecovery_ui_ext."),
|
||||
}
|
||||
}
|
||||
|
|
@ -341,6 +342,7 @@ func createKotlinPluginRule() []Rule {
|
|||
func createPrebuiltEtcBpDefineRule() Rule {
|
||||
return NeverAllow().
|
||||
ModuleType(
|
||||
"prebuilt_any",
|
||||
"prebuilt_usr_srec",
|
||||
"prebuilt_priv_app",
|
||||
"prebuilt_rfs",
|
||||
|
|
|
|||
|
|
@ -87,6 +87,7 @@ func RegisterPrebuiltEtcBuildComponents(ctx android.RegistrationContext) {
|
|||
ctx.RegisterModuleType("prebuilt_sbin", PrebuiltSbinFactory)
|
||||
ctx.RegisterModuleType("prebuilt_system", PrebuiltSystemFactory)
|
||||
ctx.RegisterModuleType("prebuilt_first_stage_ramdisk", PrebuiltFirstStageRamdiskFactory)
|
||||
ctx.RegisterModuleType("prebuilt_any", PrebuiltAnyFactory)
|
||||
|
||||
ctx.RegisterModuleType("prebuilt_defaults", defaultsFactory)
|
||||
|
||||
|
|
@ -634,6 +635,20 @@ func PrebuiltEtcHostFactory() android.Module {
|
|||
return module
|
||||
}
|
||||
|
||||
// prebuilt_any is a special module where the module can define the subdirectory that the files
|
||||
// are installed to. This is only used for converting the PRODUCT_COPY_FILES entries to Soong
|
||||
// modules, and should never be defined in the bp files. If none of the existing prebuilt_*
|
||||
// modules allow installing the file at the desired location, introduce a new prebuilt_* module
|
||||
// type instead.
|
||||
func PrebuiltAnyFactory() android.Module {
|
||||
module := &PrebuiltEtc{}
|
||||
InitPrebuiltEtcModule(module, ".")
|
||||
// This module is device-only
|
||||
android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
|
||||
android.InitDefaultableModule(module)
|
||||
return module
|
||||
}
|
||||
|
||||
// prebuilt_etc_host is for a host prebuilt artifact that is installed in
|
||||
// <partition>/etc/<sub_dir> directory.
|
||||
func PrebuiltEtcCaCertsFactory() android.Module {
|
||||
|
|
|
|||
|
|
@ -271,6 +271,8 @@ func TestPrebuiltEtcModuleGen(t *testing.T) {
|
|||
"some/non/existing/file.txt:system/etc/file.txt",
|
||||
"device/sample/etc/apns-full-conf.xml:product/etc/apns-conf.xml:google",
|
||||
"device/sample/etc/apns-full-conf.xml:product/etc/apns-conf-2.xml",
|
||||
"device/sample/etc/apns-full-conf.xml:system/foo/file.txt",
|
||||
"device/sample/etc/apns-full-conf.xml:system/foo/apns-full-conf.xml",
|
||||
}
|
||||
config.TestProductVariables.PartitionVarsForSoongMigrationOnlyDoNotUse.PartitionQualifiedVariables =
|
||||
map[string]android.PartitionQualifiedVariablesType{
|
||||
|
|
|
|||
|
|
@ -301,6 +301,7 @@ func createPrebuiltEtcModulesInDirectory(ctx android.LoadHookContext, partition,
|
|||
etcInstallPathKey = etcInstallPath
|
||||
}
|
||||
}
|
||||
moduleFactory := etcInstallPathToFactoryList[etcInstallPathKey]
|
||||
relDestDirFromInstallDirBase, _ := filepath.Rel(etcInstallPathKey, destDir)
|
||||
|
||||
for fileIndex := range maxLen {
|
||||
|
|
@ -350,6 +351,11 @@ func createPrebuiltEtcModulesInDirectory(ctx android.LoadHookContext, partition,
|
|||
})
|
||||
}
|
||||
} else {
|
||||
// If dsts property has to be set and the selected module type is prebuilt_root,
|
||||
// use prebuilt_any instead.
|
||||
if etcInstallPathKey == "" {
|
||||
moduleFactory = etc.PrebuiltAnyFactory
|
||||
}
|
||||
modulePropsPtr.Srcs = srcBaseFiles
|
||||
dsts := []string{}
|
||||
for _, installBaseFile := range installBaseFiles {
|
||||
|
|
@ -358,7 +364,7 @@ func createPrebuiltEtcModulesInDirectory(ctx android.LoadHookContext, partition,
|
|||
modulePropsPtr.Dsts = dsts
|
||||
}
|
||||
|
||||
ctx.CreateModuleInDirectory(etcInstallPathToFactoryList[etcInstallPathKey], srcDir, propsList...)
|
||||
ctx.CreateModuleInDirectory(moduleFactory, srcDir, propsList...)
|
||||
moduleNames = append(moduleNames, moduleName)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue