Merge "Add android_system_image_defaults" into main
This commit is contained in:
@@ -36,6 +36,7 @@ func init() {
|
|||||||
func registerBuildComponents(ctx android.RegistrationContext) {
|
func registerBuildComponents(ctx android.RegistrationContext) {
|
||||||
ctx.RegisterModuleType("android_filesystem", filesystemFactory)
|
ctx.RegisterModuleType("android_filesystem", filesystemFactory)
|
||||||
ctx.RegisterModuleType("android_system_image", systemImageFactory)
|
ctx.RegisterModuleType("android_system_image", systemImageFactory)
|
||||||
|
ctx.RegisterModuleType("android_system_image_defaults", systemImageDefaultsFactory)
|
||||||
ctx.RegisterModuleType("avb_add_hash_footer", avbAddHashFooterFactory)
|
ctx.RegisterModuleType("avb_add_hash_footer", avbAddHashFooterFactory)
|
||||||
ctx.RegisterModuleType("avb_add_hash_footer_defaults", avbAddHashFooterDefaultsFactory)
|
ctx.RegisterModuleType("avb_add_hash_footer_defaults", avbAddHashFooterDefaultsFactory)
|
||||||
ctx.RegisterModuleType("avb_gen_vbmeta_image", avbGenVbmetaImageFactory)
|
ctx.RegisterModuleType("avb_gen_vbmeta_image", avbGenVbmetaImageFactory)
|
||||||
|
@@ -364,3 +364,72 @@ func TestFileSystemWithCoverageVariants(t *testing.T) {
|
|||||||
t.Error("prebuilt should use cov variant of filesystem")
|
t.Error("prebuilt should use cov variant of filesystem")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestSystemImageDefaults(t *testing.T) {
|
||||||
|
result := fixture.RunTestWithBp(t, `
|
||||||
|
android_system_image_defaults {
|
||||||
|
name: "defaults",
|
||||||
|
multilib: {
|
||||||
|
common: {
|
||||||
|
deps: [
|
||||||
|
"phony",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
lib64: {
|
||||||
|
deps: [
|
||||||
|
"libbar",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
compile_multilib: "both",
|
||||||
|
}
|
||||||
|
|
||||||
|
android_system_image {
|
||||||
|
name: "system",
|
||||||
|
defaults: ["defaults"],
|
||||||
|
multilib: {
|
||||||
|
lib32: {
|
||||||
|
deps: [
|
||||||
|
"foo",
|
||||||
|
"libbar",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
cc_binary {
|
||||||
|
name: "foo",
|
||||||
|
compile_multilib: "prefer32",
|
||||||
|
}
|
||||||
|
|
||||||
|
cc_library {
|
||||||
|
name: "libbar",
|
||||||
|
required: ["libbaz"],
|
||||||
|
}
|
||||||
|
|
||||||
|
cc_library {
|
||||||
|
name: "libbaz",
|
||||||
|
}
|
||||||
|
|
||||||
|
phony {
|
||||||
|
name: "phony",
|
||||||
|
required: ["libquz"],
|
||||||
|
}
|
||||||
|
|
||||||
|
cc_library {
|
||||||
|
name: "libquz",
|
||||||
|
}
|
||||||
|
`)
|
||||||
|
|
||||||
|
fs := result.ModuleForTests("system", "android_common").Module().(*systemImage)
|
||||||
|
expected := []string{
|
||||||
|
"bin/foo",
|
||||||
|
"lib/libbar.so",
|
||||||
|
"lib64/libbar.so",
|
||||||
|
"lib64/libbaz.so",
|
||||||
|
"lib64/libquz.so",
|
||||||
|
}
|
||||||
|
for _, e := range expected {
|
||||||
|
android.AssertStringListContains(t, "missing entry", fs.entries, e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -21,6 +21,7 @@ import (
|
|||||||
|
|
||||||
type systemImage struct {
|
type systemImage struct {
|
||||||
filesystem
|
filesystem
|
||||||
|
android.DefaultableModuleBase
|
||||||
|
|
||||||
properties systemImageProperties
|
properties systemImageProperties
|
||||||
}
|
}
|
||||||
@@ -39,6 +40,7 @@ func systemImageFactory() android.Module {
|
|||||||
module.filesystem.buildExtraFiles = module.buildExtraFiles
|
module.filesystem.buildExtraFiles = module.buildExtraFiles
|
||||||
module.filesystem.filterPackagingSpec = module.filterPackagingSpec
|
module.filesystem.filterPackagingSpec = module.filterPackagingSpec
|
||||||
initFilesystemModule(&module.filesystem)
|
initFilesystemModule(&module.filesystem)
|
||||||
|
android.InitDefaultableModule(module)
|
||||||
return module
|
return module
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,3 +102,17 @@ func (s *systemImage) buildLinkerConfigFile(ctx android.ModuleContext, root andr
|
|||||||
func (s *systemImage) filterPackagingSpec(ps android.PackagingSpec) bool {
|
func (s *systemImage) filterPackagingSpec(ps android.PackagingSpec) bool {
|
||||||
return ps.Partition() == "system"
|
return ps.Partition() == "system"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type systemImageDefaults struct {
|
||||||
|
android.ModuleBase
|
||||||
|
android.DefaultsModuleBase
|
||||||
|
}
|
||||||
|
|
||||||
|
// android_system_image_defaults is a default module for android_system_image module.
|
||||||
|
func systemImageDefaultsFactory() android.Module {
|
||||||
|
module := &systemImageDefaults{}
|
||||||
|
module.AddProperties(&android.PackagingProperties{})
|
||||||
|
module.AddProperties(&systemImageProperties{})
|
||||||
|
android.InitDefaultsModule(module)
|
||||||
|
return module
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user