Compare commits
10 commits
5daba7432c
...
2450781c33
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2450781c33 | ||
|
|
7b095f73bd | ||
|
|
d5c9d6498b | ||
|
|
cd34413b9d | ||
|
|
1b297b02d2 | ||
|
|
fc4af1f5cc | ||
|
|
6f53e14455 | ||
|
|
6b45f84557 | ||
|
|
cc1c4aaf9a | ||
|
|
c099116fb0 |
12 changed files with 116 additions and 49 deletions
|
|
@ -1169,14 +1169,7 @@ func (c *config) ExtraOtaKeys(ctx PathContext, recovery bool) []SourcePath {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *config) BuildKeys() string {
|
func (c *config) BuildKeys() string {
|
||||||
defaultCert := String(c.productVariables.DefaultAppCertificate)
|
return "release-keys"
|
||||||
if defaultCert == "" || defaultCert == filepath.Join(testKeyDir, "testkey") {
|
|
||||||
return "test-keys"
|
|
||||||
}
|
|
||||||
if strings.HasPrefix(defaultCert, "vendor/lineage-priv/") {
|
|
||||||
return "release-keys"
|
|
||||||
}
|
|
||||||
return "dev-keys"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *config) ApexKeyDir(ctx ModuleContext) SourcePath {
|
func (c *config) ApexKeyDir(ctx ModuleContext) SourcePath {
|
||||||
|
|
|
||||||
|
|
@ -250,6 +250,7 @@ func createInstallInRootAllowingRules() []Rule {
|
||||||
NotModuleType("prebuilt_system").
|
NotModuleType("prebuilt_system").
|
||||||
NotModuleType("prebuilt_first_stage_ramdisk").
|
NotModuleType("prebuilt_first_stage_ramdisk").
|
||||||
NotModuleType("prebuilt_res").
|
NotModuleType("prebuilt_res").
|
||||||
|
NotModuleType("prebuilt_any").
|
||||||
Because("install_in_root is only for init_first_stage or librecovery_ui_ext."),
|
Because("install_in_root is only for init_first_stage or librecovery_ui_ext."),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -341,6 +342,7 @@ func createKotlinPluginRule() []Rule {
|
||||||
func createPrebuiltEtcBpDefineRule() Rule {
|
func createPrebuiltEtcBpDefineRule() Rule {
|
||||||
return NeverAllow().
|
return NeverAllow().
|
||||||
ModuleType(
|
ModuleType(
|
||||||
|
"prebuilt_any",
|
||||||
"prebuilt_usr_srec",
|
"prebuilt_usr_srec",
|
||||||
"prebuilt_priv_app",
|
"prebuilt_priv_app",
|
||||||
"prebuilt_rfs",
|
"prebuilt_rfs",
|
||||||
|
|
|
||||||
|
|
@ -140,6 +140,7 @@ func (m *vintfDataRule) GenerateAndroidBuildActions(ctx ModuleContext) {
|
||||||
|
|
||||||
// Process vintf fragment source file with assemble_vintf tool
|
// Process vintf fragment source file with assemble_vintf tool
|
||||||
builder.Command().
|
builder.Command().
|
||||||
|
Implicits(inputPaths).
|
||||||
Flags(assembleVintfEnvs).
|
Flags(assembleVintfEnvs).
|
||||||
BuiltTool("assemble_vintf").
|
BuiltTool("assemble_vintf").
|
||||||
FlagWithArg("-i ", strings.Join(inputPaths.Strings(), ":")).
|
FlagWithArg("-i ", strings.Join(inputPaths.Strings(), ":")).
|
||||||
|
|
|
||||||
|
|
@ -87,6 +87,7 @@ func RegisterPrebuiltEtcBuildComponents(ctx android.RegistrationContext) {
|
||||||
ctx.RegisterModuleType("prebuilt_sbin", PrebuiltSbinFactory)
|
ctx.RegisterModuleType("prebuilt_sbin", PrebuiltSbinFactory)
|
||||||
ctx.RegisterModuleType("prebuilt_system", PrebuiltSystemFactory)
|
ctx.RegisterModuleType("prebuilt_system", PrebuiltSystemFactory)
|
||||||
ctx.RegisterModuleType("prebuilt_first_stage_ramdisk", PrebuiltFirstStageRamdiskFactory)
|
ctx.RegisterModuleType("prebuilt_first_stage_ramdisk", PrebuiltFirstStageRamdiskFactory)
|
||||||
|
ctx.RegisterModuleType("prebuilt_any", PrebuiltAnyFactory)
|
||||||
|
|
||||||
ctx.RegisterModuleType("prebuilt_defaults", defaultsFactory)
|
ctx.RegisterModuleType("prebuilt_defaults", defaultsFactory)
|
||||||
|
|
||||||
|
|
@ -104,12 +105,6 @@ type PrebuiltEtcProperties struct {
|
||||||
// set. May use globs in filenames.
|
// set. May use globs in filenames.
|
||||||
Srcs proptools.Configurable[[]string] `android:"path,arch_variant"`
|
Srcs proptools.Configurable[[]string] `android:"path,arch_variant"`
|
||||||
|
|
||||||
// Destination files of this prebuilt. Requires srcs to be used and causes srcs not to implicitly
|
|
||||||
// set filename_from_src. This can be used to install each source file to a different directory
|
|
||||||
// and/or change filenames when files are installed. Must be exactly one entry per source file,
|
|
||||||
// which means care must be taken if srcs has globs.
|
|
||||||
Dsts proptools.Configurable[[]string] `android:"path,arch_variant"`
|
|
||||||
|
|
||||||
// Optional name for the installed file. If unspecified, name of the module is used as the file
|
// Optional name for the installed file. If unspecified, name of the module is used as the file
|
||||||
// name. Only available when using a single source (src).
|
// name. Only available when using a single source (src).
|
||||||
Filename *string `android:"arch_variant"`
|
Filename *string `android:"arch_variant"`
|
||||||
|
|
@ -148,6 +143,20 @@ type PrebuiltEtcProperties struct {
|
||||||
Oem_specific *bool `android:"arch_variant"`
|
Oem_specific *bool `android:"arch_variant"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Dsts is useful in that it allows prebuilt_* modules to easily map the source files to the
|
||||||
|
// install path within the partition. Dsts values are allowed to contain filepath separator
|
||||||
|
// so that the source files can be installed in subdirectories within the partition.
|
||||||
|
// However, this functionality should not be supported for prebuilt_root module type, as it
|
||||||
|
// allows the module to install to any arbitrary location. Thus, this property is defined in
|
||||||
|
// a separate struct so that it's not available to be set in prebuilt_root module type.
|
||||||
|
type PrebuiltDstsProperties struct {
|
||||||
|
// Destination files of this prebuilt. Requires srcs to be used and causes srcs not to implicitly
|
||||||
|
// set filename_from_src. This can be used to install each source file to a different directory
|
||||||
|
// and/or change filenames when files are installed. Must be exactly one entry per source file,
|
||||||
|
// which means care must be taken if srcs has globs.
|
||||||
|
Dsts proptools.Configurable[[]string] `android:"path,arch_variant"`
|
||||||
|
}
|
||||||
|
|
||||||
type prebuiltSubdirProperties struct {
|
type prebuiltSubdirProperties struct {
|
||||||
// Optional subdirectory under which this file is installed into, cannot be specified with
|
// Optional subdirectory under which this file is installed into, cannot be specified with
|
||||||
// relative_install_path, prefer relative_install_path.
|
// relative_install_path, prefer relative_install_path.
|
||||||
|
|
@ -183,6 +192,8 @@ type PrebuiltEtc struct {
|
||||||
|
|
||||||
properties PrebuiltEtcProperties
|
properties PrebuiltEtcProperties
|
||||||
|
|
||||||
|
dstsProperties PrebuiltDstsProperties
|
||||||
|
|
||||||
// rootProperties is used to return the value of the InstallInRoot() method. Currently, only
|
// rootProperties is used to return the value of the InstallInRoot() method. Currently, only
|
||||||
// prebuilt_avb and prebuilt_root modules use this.
|
// prebuilt_avb and prebuilt_root modules use this.
|
||||||
rootProperties prebuiltRootProperties
|
rootProperties prebuiltRootProperties
|
||||||
|
|
@ -373,7 +384,7 @@ func (p *PrebuiltEtc) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||||
if srcProperty.IsPresent() && len(srcsProperty) > 0 {
|
if srcProperty.IsPresent() && len(srcsProperty) > 0 {
|
||||||
ctx.PropertyErrorf("src", "src is set. Cannot set srcs")
|
ctx.PropertyErrorf("src", "src is set. Cannot set srcs")
|
||||||
}
|
}
|
||||||
dstsProperty := p.properties.Dsts.GetOrDefault(ctx, nil)
|
dstsProperty := p.dstsProperties.Dsts.GetOrDefault(ctx, nil)
|
||||||
if len(dstsProperty) > 0 && len(srcsProperty) == 0 {
|
if len(dstsProperty) > 0 && len(srcsProperty) == 0 {
|
||||||
ctx.PropertyErrorf("dsts", "dsts is set. Must use srcs")
|
ctx.PropertyErrorf("dsts", "dsts is set. Must use srcs")
|
||||||
}
|
}
|
||||||
|
|
@ -580,6 +591,7 @@ func InitPrebuiltEtcModule(p *PrebuiltEtc, dirBase string) {
|
||||||
p.AddProperties(&p.properties)
|
p.AddProperties(&p.properties)
|
||||||
p.AddProperties(&p.subdirProperties)
|
p.AddProperties(&p.subdirProperties)
|
||||||
p.AddProperties(&p.rootProperties)
|
p.AddProperties(&p.rootProperties)
|
||||||
|
p.AddProperties(&p.dstsProperties)
|
||||||
}
|
}
|
||||||
|
|
||||||
func InitPrebuiltRootModule(p *PrebuiltEtc) {
|
func InitPrebuiltRootModule(p *PrebuiltEtc) {
|
||||||
|
|
@ -591,6 +603,7 @@ func InitPrebuiltRootModule(p *PrebuiltEtc) {
|
||||||
func InitPrebuiltAvbModule(p *PrebuiltEtc) {
|
func InitPrebuiltAvbModule(p *PrebuiltEtc) {
|
||||||
p.installDirBase = "avb"
|
p.installDirBase = "avb"
|
||||||
p.AddProperties(&p.properties)
|
p.AddProperties(&p.properties)
|
||||||
|
p.AddProperties(&p.dstsProperties)
|
||||||
p.rootProperties.Install_in_root = proptools.BoolPtr(true)
|
p.rootProperties.Install_in_root = proptools.BoolPtr(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -634,6 +647,20 @@ func PrebuiltEtcHostFactory() android.Module {
|
||||||
return 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
|
// prebuilt_etc_host is for a host prebuilt artifact that is installed in
|
||||||
// <partition>/etc/<sub_dir> directory.
|
// <partition>/etc/<sub_dir> directory.
|
||||||
func PrebuiltEtcCaCertsFactory() android.Module {
|
func PrebuiltEtcCaCertsFactory() android.Module {
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,8 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"android/soong/android"
|
"android/soong/android"
|
||||||
|
|
||||||
|
"github.com/google/blueprint/proptools"
|
||||||
)
|
)
|
||||||
|
|
||||||
type fsverityProperties struct {
|
type fsverityProperties struct {
|
||||||
|
|
@ -27,10 +29,10 @@ type fsverityProperties struct {
|
||||||
// will be generated and included to the filesystem image.
|
// will be generated and included to the filesystem image.
|
||||||
// etc/security/fsverity/BuildManifest.apk will also be generated which contains information
|
// etc/security/fsverity/BuildManifest.apk will also be generated which contains information
|
||||||
// about generated .fsv_meta files.
|
// about generated .fsv_meta files.
|
||||||
Inputs []string
|
Inputs proptools.Configurable[[]string]
|
||||||
|
|
||||||
// APK libraries to link against, for etc/security/fsverity/BuildManifest.apk
|
// APK libraries to link against, for etc/security/fsverity/BuildManifest.apk
|
||||||
Libs []string `android:"path"`
|
Libs proptools.Configurable[[]string] `android:"path"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *filesystem) writeManifestGeneratorListFile(ctx android.ModuleContext, outputPath android.WritablePath, matchedSpecs []android.PackagingSpec, rebasedDir android.OutputPath) {
|
func (f *filesystem) writeManifestGeneratorListFile(ctx android.ModuleContext, outputPath android.WritablePath, matchedSpecs []android.PackagingSpec, rebasedDir android.OutputPath) {
|
||||||
|
|
@ -44,7 +46,7 @@ func (f *filesystem) writeManifestGeneratorListFile(ctx android.ModuleContext, o
|
||||||
|
|
||||||
func (f *filesystem) buildFsverityMetadataFiles(ctx android.ModuleContext, builder *android.RuleBuilder, specs map[string]android.PackagingSpec, rootDir android.OutputPath, rebasedDir android.OutputPath) {
|
func (f *filesystem) buildFsverityMetadataFiles(ctx android.ModuleContext, builder *android.RuleBuilder, specs map[string]android.PackagingSpec, rootDir android.OutputPath, rebasedDir android.OutputPath) {
|
||||||
match := func(path string) bool {
|
match := func(path string) bool {
|
||||||
for _, pattern := range f.properties.Fsverity.Inputs {
|
for _, pattern := range f.properties.Fsverity.Inputs.GetOrDefault(ctx, nil) {
|
||||||
if matched, err := filepath.Match(pattern, path); matched {
|
if matched, err := filepath.Match(pattern, path); matched {
|
||||||
return true
|
return true
|
||||||
} else if err != nil {
|
} else if err != nil {
|
||||||
|
|
@ -112,7 +114,7 @@ func (f *filesystem) buildFsverityMetadataFiles(ctx android.ModuleContext, build
|
||||||
apkPath := rebasedDir.Join(ctx, "etc", "security", "fsverity", fmt.Sprintf("BuildManifest%s.apk", apkNameSuffix))
|
apkPath := rebasedDir.Join(ctx, "etc", "security", "fsverity", fmt.Sprintf("BuildManifest%s.apk", apkNameSuffix))
|
||||||
idsigPath := rebasedDir.Join(ctx, "etc", "security", "fsverity", fmt.Sprintf("BuildManifest%s.apk.idsig", apkNameSuffix))
|
idsigPath := rebasedDir.Join(ctx, "etc", "security", "fsverity", fmt.Sprintf("BuildManifest%s.apk.idsig", apkNameSuffix))
|
||||||
manifestTemplatePath := android.PathForSource(ctx, "system/security/fsverity/AndroidManifest.xml")
|
manifestTemplatePath := android.PathForSource(ctx, "system/security/fsverity/AndroidManifest.xml")
|
||||||
libs := android.PathsForModuleSrc(ctx, f.properties.Fsverity.Libs)
|
libs := android.PathsForModuleSrc(ctx, f.properties.Fsverity.Libs.GetOrDefault(ctx, nil))
|
||||||
|
|
||||||
minSdkVersion := ctx.Config().PlatformSdkCodename()
|
minSdkVersion := ctx.Config().PlatformSdkCodename()
|
||||||
if minSdkVersion == "REL" {
|
if minSdkVersion == "REL" {
|
||||||
|
|
|
||||||
|
|
@ -224,7 +224,7 @@ func partitionSpecificFsProps(ctx android.EarlyModuleContext, fsProps *filesyste
|
||||||
fsProps.Gen_aconfig_flags_pb = proptools.BoolPtr(true)
|
fsProps.Gen_aconfig_flags_pb = proptools.BoolPtr(true)
|
||||||
// Identical to that of the aosp_shared_system_image
|
// Identical to that of the aosp_shared_system_image
|
||||||
if partitionVars.ProductFsverityGenerateMetadata {
|
if partitionVars.ProductFsverityGenerateMetadata {
|
||||||
fsProps.Fsverity.Inputs = []string{
|
fsProps.Fsverity.Inputs = proptools.NewSimpleConfigurable([]string{
|
||||||
"etc/boot-image.prof",
|
"etc/boot-image.prof",
|
||||||
"etc/dirty-image-objects",
|
"etc/dirty-image-objects",
|
||||||
"etc/preloaded-classes",
|
"etc/preloaded-classes",
|
||||||
|
|
@ -232,8 +232,8 @@ func partitionSpecificFsProps(ctx android.EarlyModuleContext, fsProps *filesyste
|
||||||
"framework/*",
|
"framework/*",
|
||||||
"framework/*/*", // framework/{arch}
|
"framework/*/*", // framework/{arch}
|
||||||
"framework/oat/*/*", // framework/oat/{arch}
|
"framework/oat/*/*", // framework/oat/{arch}
|
||||||
}
|
})
|
||||||
fsProps.Fsverity.Libs = []string{":framework-res{.export-package.apk}"}
|
fsProps.Fsverity.Libs = proptools.NewSimpleConfigurable([]string{":framework-res{.export-package.apk}"})
|
||||||
}
|
}
|
||||||
// Most of the symlinks and directories listed here originate from create_root_structure.mk,
|
// Most of the symlinks and directories listed here originate from create_root_structure.mk,
|
||||||
// but the handwritten generic system image also recreates them:
|
// but the handwritten generic system image also recreates them:
|
||||||
|
|
@ -377,12 +377,12 @@ func partitionSpecificFsProps(ctx android.EarlyModuleContext, fsProps *filesyste
|
||||||
})
|
})
|
||||||
case "system_ext":
|
case "system_ext":
|
||||||
if partitionVars.ProductFsverityGenerateMetadata {
|
if partitionVars.ProductFsverityGenerateMetadata {
|
||||||
fsProps.Fsverity.Inputs = []string{
|
fsProps.Fsverity.Inputs = proptools.NewSimpleConfigurable([]string{
|
||||||
"framework/*",
|
"framework/*",
|
||||||
"framework/*/*", // framework/{arch}
|
"framework/*/*", // framework/{arch}
|
||||||
"framework/oat/*/*", // framework/oat/{arch}
|
"framework/oat/*/*", // framework/oat/{arch}
|
||||||
}
|
})
|
||||||
fsProps.Fsverity.Libs = []string{":framework-res{.export-package.apk}"}
|
fsProps.Fsverity.Libs = proptools.NewSimpleConfigurable([]string{":framework-res{.export-package.apk}"})
|
||||||
}
|
}
|
||||||
case "product":
|
case "product":
|
||||||
fsProps.Gen_aconfig_flags_pb = proptools.BoolPtr(true)
|
fsProps.Gen_aconfig_flags_pb = proptools.BoolPtr(true)
|
||||||
|
|
|
||||||
|
|
@ -271,6 +271,8 @@ func TestPrebuiltEtcModuleGen(t *testing.T) {
|
||||||
"some/non/existing/file.txt:system/etc/file.txt",
|
"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.xml:google",
|
||||||
"device/sample/etc/apns-full-conf.xml:product/etc/apns-conf-2.xml",
|
"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 =
|
config.TestProductVariables.PartitionVarsForSoongMigrationOnlyDoNotUse.PartitionQualifiedVariables =
|
||||||
map[string]android.PartitionQualifiedVariablesType{
|
map[string]android.PartitionQualifiedVariablesType{
|
||||||
|
|
@ -347,15 +349,25 @@ func TestPrebuiltEtcModuleGen(t *testing.T) {
|
||||||
eval := generatedModule0.ConfigurableEvaluator(android.PanickingConfigAndErrorContext(result.TestContext))
|
eval := generatedModule0.ConfigurableEvaluator(android.PanickingConfigAndErrorContext(result.TestContext))
|
||||||
android.AssertBoolEquals(
|
android.AssertBoolEquals(
|
||||||
t,
|
t,
|
||||||
"module expected to set correct srcs and dsts properties",
|
"module expected to set correct srcs property",
|
||||||
true,
|
true,
|
||||||
checkModuleProp(generatedModule0, func(actual interface{}) bool {
|
checkModuleProp(generatedModule0, func(actual interface{}) bool {
|
||||||
if p, ok := actual.(*etc.PrebuiltEtcProperties); ok {
|
if p, ok := actual.(*etc.PrebuiltEtcProperties); ok {
|
||||||
srcs := p.Srcs.GetOrDefault(eval, nil)
|
srcs := p.Srcs.GetOrDefault(eval, nil)
|
||||||
dsts := p.Dsts.GetOrDefault(eval, nil)
|
|
||||||
return len(srcs) == 1 &&
|
return len(srcs) == 1 &&
|
||||||
srcs[0] == "apns-full-conf.xml" &&
|
srcs[0] == "apns-full-conf.xml"
|
||||||
len(dsts) == 1 &&
|
}
|
||||||
|
return false
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
android.AssertBoolEquals(
|
||||||
|
t,
|
||||||
|
"module expected to set correct dsts property",
|
||||||
|
true,
|
||||||
|
checkModuleProp(generatedModule0, func(actual interface{}) bool {
|
||||||
|
if p, ok := actual.(*etc.PrebuiltDstsProperties); ok {
|
||||||
|
dsts := p.Dsts.GetOrDefault(eval, nil)
|
||||||
|
return len(dsts) == 1 &&
|
||||||
dsts[0] == "apns-conf.xml"
|
dsts[0] == "apns-conf.xml"
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
|
|
@ -366,15 +378,25 @@ func TestPrebuiltEtcModuleGen(t *testing.T) {
|
||||||
eval = generatedModule1.ConfigurableEvaluator(android.PanickingConfigAndErrorContext(result.TestContext))
|
eval = generatedModule1.ConfigurableEvaluator(android.PanickingConfigAndErrorContext(result.TestContext))
|
||||||
android.AssertBoolEquals(
|
android.AssertBoolEquals(
|
||||||
t,
|
t,
|
||||||
"module expected to set correct srcs and dsts properties",
|
"module expected to set correct srcs property",
|
||||||
true,
|
true,
|
||||||
checkModuleProp(generatedModule1, func(actual interface{}) bool {
|
checkModuleProp(generatedModule1, func(actual interface{}) bool {
|
||||||
if p, ok := actual.(*etc.PrebuiltEtcProperties); ok {
|
if p, ok := actual.(*etc.PrebuiltEtcProperties); ok {
|
||||||
srcs := p.Srcs.GetOrDefault(eval, nil)
|
srcs := p.Srcs.GetOrDefault(eval, nil)
|
||||||
dsts := p.Dsts.GetOrDefault(eval, nil)
|
|
||||||
return len(srcs) == 1 &&
|
return len(srcs) == 1 &&
|
||||||
srcs[0] == "apns-full-conf.xml" &&
|
srcs[0] == "apns-full-conf.xml"
|
||||||
len(dsts) == 1 &&
|
}
|
||||||
|
return false
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
android.AssertBoolEquals(
|
||||||
|
t,
|
||||||
|
"module expected to set correct dsts property",
|
||||||
|
true,
|
||||||
|
checkModuleProp(generatedModule1, func(actual interface{}) bool {
|
||||||
|
if p, ok := actual.(*etc.PrebuiltDstsProperties); ok {
|
||||||
|
dsts := p.Dsts.GetOrDefault(eval, nil)
|
||||||
|
return len(dsts) == 1 &&
|
||||||
dsts[0] == "apns-conf-2.xml"
|
dsts[0] == "apns-conf-2.xml"
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
|
|
|
||||||
|
|
@ -162,6 +162,10 @@ func createFsGenState(ctx android.LoadHookContext, generatedPrebuiltEtcModuleNam
|
||||||
(*fsGenState.fsDeps["product"])["system_other_avbpubkey"] = defaultDepCandidateProps(ctx.Config())
|
(*fsGenState.fsDeps["product"])["system_other_avbpubkey"] = defaultDepCandidateProps(ctx.Config())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(ctx.Config().DeviceManifestFiles()) > 0 {
|
||||||
|
(*fsGenState.fsDeps["vendor"])["vendor_manifest.xml"] = defaultDepCandidateProps(ctx.Config())
|
||||||
|
}
|
||||||
|
|
||||||
// Add common resources `prebuilt_res` module as dep of recovery partition
|
// Add common resources `prebuilt_res` module as dep of recovery partition
|
||||||
(*fsGenState.fsDeps["recovery"])[fmt.Sprintf("recovery-resources-common-%s", getDpi(ctx))] = defaultDepCandidateProps(ctx.Config())
|
(*fsGenState.fsDeps["recovery"])[fmt.Sprintf("recovery-resources-common-%s", getDpi(ctx))] = defaultDepCandidateProps(ctx.Config())
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -164,7 +164,6 @@ type prebuiltModuleProperties struct {
|
||||||
Ramdisk *bool
|
Ramdisk *bool
|
||||||
|
|
||||||
Srcs []string
|
Srcs []string
|
||||||
Dsts []string
|
|
||||||
|
|
||||||
No_full_install *bool
|
No_full_install *bool
|
||||||
|
|
||||||
|
|
@ -301,6 +300,7 @@ func createPrebuiltEtcModulesInDirectory(ctx android.LoadHookContext, partition,
|
||||||
etcInstallPathKey = etcInstallPath
|
etcInstallPathKey = etcInstallPath
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
moduleFactory := etcInstallPathToFactoryList[etcInstallPathKey]
|
||||||
relDestDirFromInstallDirBase, _ := filepath.Rel(etcInstallPathKey, destDir)
|
relDestDirFromInstallDirBase, _ := filepath.Rel(etcInstallPathKey, destDir)
|
||||||
|
|
||||||
for fileIndex := range maxLen {
|
for fileIndex := range maxLen {
|
||||||
|
|
@ -335,13 +335,31 @@ func createPrebuiltEtcModulesInDirectory(ctx android.LoadHookContext, partition,
|
||||||
propsList = append(propsList, &prebuiltInstallInRootProperties{
|
propsList = append(propsList, &prebuiltInstallInRootProperties{
|
||||||
Install_in_root: proptools.BoolPtr(true),
|
Install_in_root: proptools.BoolPtr(true),
|
||||||
})
|
})
|
||||||
|
// Discard any previously picked module and force it to prebuilt_{root,any} as
|
||||||
|
// they are the only modules allowed to specify the `install_in_root` property.
|
||||||
|
etcInstallPathKey = ""
|
||||||
|
relDestDirFromInstallDirBase = destDir
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set appropriate srcs, dsts, and releative_install_path based on
|
// Set appropriate srcs, dsts, and releative_install_path based on
|
||||||
// the source and install file names
|
// the source and install file names
|
||||||
if allCopyFileNamesUnchanged {
|
modulePropsPtr.Srcs = srcBaseFiles
|
||||||
modulePropsPtr.Srcs = srcBaseFiles
|
|
||||||
|
|
||||||
|
// prebuilt_root should only be used in very limited cases in prebuilt_etc moddule gen, where:
|
||||||
|
// - all source file names are identical to the installed file names, and
|
||||||
|
// - all source files are installed in root, not the subdirectories of root
|
||||||
|
// prebuilt_root currently does not have a good way to specify the names of the multiple
|
||||||
|
// installed files, and prebuilt_root does not allow installing files at a subdirectory
|
||||||
|
// of the root.
|
||||||
|
// Use prebuilt_any instead of prebuilt_root if either of the conditions are not met as
|
||||||
|
// a fallback behavior.
|
||||||
|
if etcInstallPathKey == "" {
|
||||||
|
if !(allCopyFileNamesUnchanged && android.InList(relDestDirFromInstallDirBase, []string{"", "."})) {
|
||||||
|
moduleFactory = etc.PrebuiltAnyFactory
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if allCopyFileNamesUnchanged {
|
||||||
// Specify relative_install_path if it is not installed in the root directory of the
|
// Specify relative_install_path if it is not installed in the root directory of the
|
||||||
// partition
|
// partition
|
||||||
if !android.InList(relDestDirFromInstallDirBase, []string{"", "."}) {
|
if !android.InList(relDestDirFromInstallDirBase, []string{"", "."}) {
|
||||||
|
|
@ -350,15 +368,18 @@ func createPrebuiltEtcModulesInDirectory(ctx android.LoadHookContext, partition,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
modulePropsPtr.Srcs = srcBaseFiles
|
// If dsts property has to be set and the selected module type is prebuilt_root,
|
||||||
dsts := []string{}
|
// use prebuilt_any instead.
|
||||||
|
dsts := proptools.NewConfigurable[[]string](nil, nil)
|
||||||
for _, installBaseFile := range installBaseFiles {
|
for _, installBaseFile := range installBaseFiles {
|
||||||
dsts = append(dsts, filepath.Join(relDestDirFromInstallDirBase, installBaseFile))
|
dsts.AppendSimpleValue([]string{filepath.Join(relDestDirFromInstallDirBase, installBaseFile)})
|
||||||
}
|
}
|
||||||
modulePropsPtr.Dsts = dsts
|
propsList = append(propsList, &etc.PrebuiltDstsProperties{
|
||||||
|
Dsts: dsts,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.CreateModuleInDirectory(etcInstallPathToFactoryList[etcInstallPathKey], srcDir, propsList...)
|
ctx.CreateModuleInDirectory(moduleFactory, srcDir, propsList...)
|
||||||
moduleNames = append(moduleNames, moduleName)
|
moduleNames = append(moduleNames, moduleName)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ var (
|
||||||
"goldmont-without-sha-xsaves": []string{"-C target-cpu=goldmont", "-C target-feature=-sha,-xsaves"},
|
"goldmont-without-sha-xsaves": []string{"-C target-cpu=goldmont", "-C target-feature=-sha,-xsaves"},
|
||||||
"haswell": []string{"-C target-cpu=haswell"},
|
"haswell": []string{"-C target-cpu=haswell"},
|
||||||
"ivybridge": []string{"-C target-cpu=ivybridge"},
|
"ivybridge": []string{"-C target-cpu=ivybridge"},
|
||||||
"sandybridge": []string{"-C target-cpu=sandybridge"},
|
"sandybridge": []string{"-C target-cpu=nehalem"},
|
||||||
"silvermont": []string{"-C target-cpu=silvermont"},
|
"silvermont": []string{"-C target-cpu=silvermont"},
|
||||||
"skylake": []string{"-C target-cpu=skylake"},
|
"skylake": []string{"-C target-cpu=skylake"},
|
||||||
//TODO: Add target-cpu=stoneyridge when rustc supports it.
|
//TODO: Add target-cpu=stoneyridge when rustc supports it.
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ var (
|
||||||
"goldmont-without-sha-xsaves": []string{"-C target-cpu=goldmont", "-C target-feature=-sha,-xsaves"},
|
"goldmont-without-sha-xsaves": []string{"-C target-cpu=goldmont", "-C target-feature=-sha,-xsaves"},
|
||||||
"haswell": []string{"-C target-cpu=haswell"},
|
"haswell": []string{"-C target-cpu=haswell"},
|
||||||
"ivybridge": []string{"-C target-cpu=ivybridge"},
|
"ivybridge": []string{"-C target-cpu=ivybridge"},
|
||||||
"sandybridge": []string{"-C target-cpu=sandybridge"},
|
"sandybridge": []string{"-C target-cpu=nehalem"},
|
||||||
"silvermont": []string{"-C target-cpu=silvermont"},
|
"silvermont": []string{"-C target-cpu=silvermont"},
|
||||||
"skylake": []string{"-C target-cpu=skylake"},
|
"skylake": []string{"-C target-cpu=skylake"},
|
||||||
//TODO: Add target-cpu=stoneyridge when rustc supports it.
|
//TODO: Add target-cpu=stoneyridge when rustc supports it.
|
||||||
|
|
|
||||||
|
|
@ -40,12 +40,7 @@ def get_build_flavor(product_config):
|
||||||
return build_flavor
|
return build_flavor
|
||||||
|
|
||||||
def get_build_keys(product_config):
|
def get_build_keys(product_config):
|
||||||
default_cert = product_config.get("DefaultAppCertificate", "")
|
return "release-keys"
|
||||||
if default_cert == "" or default_cert == os.path.join(TEST_KEY_DIR, "testKey"):
|
|
||||||
return "test-keys"
|
|
||||||
if default_cert.startswith("vendor/lineage-priv/"):
|
|
||||||
return "release-keys"
|
|
||||||
return "dev-keys"
|
|
||||||
|
|
||||||
def override_config(config):
|
def override_config(config):
|
||||||
if "PRODUCT_BUILD_PROP_OVERRIDES" in config:
|
if "PRODUCT_BUILD_PROP_OVERRIDES" in config:
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue