Merge "Generate product variants by default" into main
This commit is contained in:
commit
ce12ea8f95
11 changed files with 32 additions and 235 deletions
|
@ -1435,10 +1435,6 @@ func (c *deviceConfig) PlatformVndkVersion() string {
|
||||||
return String(c.config.productVariables.Platform_vndk_version)
|
return String(c.config.productVariables.Platform_vndk_version)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *deviceConfig) ProductVndkVersion() string {
|
|
||||||
return String(c.config.productVariables.ProductVndkVersion)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *deviceConfig) ExtraVndkVersions() []string {
|
func (c *deviceConfig) ExtraVndkVersions() []string {
|
||||||
return c.config.productVariables.ExtraVndkVersions
|
return c.config.productVariables.ExtraVndkVersions
|
||||||
}
|
}
|
||||||
|
|
|
@ -418,8 +418,6 @@ type ProductVariables struct {
|
||||||
ProductPublicSepolicyDirs []string `json:",omitempty"`
|
ProductPublicSepolicyDirs []string `json:",omitempty"`
|
||||||
ProductPrivateSepolicyDirs []string `json:",omitempty"`
|
ProductPrivateSepolicyDirs []string `json:",omitempty"`
|
||||||
|
|
||||||
ProductVndkVersion *string `json:",omitempty"`
|
|
||||||
|
|
||||||
TargetFSConfigGen []string `json:",omitempty"`
|
TargetFSConfigGen []string `json:",omitempty"`
|
||||||
|
|
||||||
EnforceProductPartitionInterface *bool `json:",omitempty"`
|
EnforceProductPartitionInterface *bool `json:",omitempty"`
|
||||||
|
|
|
@ -736,7 +736,7 @@ func (a *apexBundle) getImageVariationPair(deviceConfig android.DeviceConfig) (s
|
||||||
vndkVersion = deviceConfig.VndkVersion()
|
vndkVersion = deviceConfig.VndkVersion()
|
||||||
} else if a.ProductSpecific() {
|
} else if a.ProductSpecific() {
|
||||||
prefix = cc.ProductVariationPrefix
|
prefix = cc.ProductVariationPrefix
|
||||||
vndkVersion = deviceConfig.ProductVndkVersion()
|
vndkVersion = deviceConfig.PlatformVndkVersion()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if vndkVersion == "current" {
|
if vndkVersion == "current" {
|
||||||
|
|
|
@ -3088,10 +3088,7 @@ func TestProductVariant(t *testing.T) {
|
||||||
apex_available: ["myapex"],
|
apex_available: ["myapex"],
|
||||||
srcs: ["foo.cpp"],
|
srcs: ["foo.cpp"],
|
||||||
}
|
}
|
||||||
`, android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
|
`)
|
||||||
variables.ProductVndkVersion = proptools.StringPtr("current")
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
|
|
||||||
cflags := strings.Fields(
|
cflags := strings.Fields(
|
||||||
ctx.ModuleForTests("foo", "android_product.29_arm64_armv8-a_myapex").Rule("cc").Args["cFlags"])
|
ctx.ModuleForTests("foo", "android_product.29_arm64_armv8-a_myapex").Rule("cc").Args["cFlags"])
|
||||||
|
@ -10521,6 +10518,7 @@ func TestTrimmedApex(t *testing.T) {
|
||||||
min_sdk_version: "29",
|
min_sdk_version: "29",
|
||||||
recovery_available: true,
|
recovery_available: true,
|
||||||
vendor_available: true,
|
vendor_available: true,
|
||||||
|
product_available: true,
|
||||||
}
|
}
|
||||||
api_imports {
|
api_imports {
|
||||||
name: "api_imports",
|
name: "api_imports",
|
||||||
|
|
|
@ -115,12 +115,7 @@ func TestVndkApexUsesVendorVariant(t *testing.T) {
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("VNDK APEX gathers only vendor variants even if product variants are available", func(t *testing.T) {
|
t.Run("VNDK APEX gathers only vendor variants even if product variants are available", func(t *testing.T) {
|
||||||
ctx := testApex(t, bp,
|
ctx := testApex(t, bp)
|
||||||
android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
|
|
||||||
// Now product variant is available
|
|
||||||
variables.ProductVndkVersion = proptools.StringPtr("current")
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
|
|
||||||
files := getFiles(t, ctx, "com.android.vndk.current", "android_common")
|
files := getFiles(t, ctx, "com.android.vndk.current", "android_common")
|
||||||
ensureFileSrc(t, files, "lib/libfoo.so", "libfoo/android_vendor.29_arm_armv7-a-neon_shared/libfoo.so")
|
ensureFileSrc(t, files, "lib/libfoo.so", "libfoo/android_vendor.29_arm_armv7-a-neon_shared/libfoo.so")
|
||||||
|
|
3
cc/cc.go
3
cc/cc.go
|
@ -1895,8 +1895,7 @@ func getNameSuffixWithVndkVersion(ctx android.ModuleContext, c LinkableInterface
|
||||||
// do not add a name suffix because it is a base module.
|
// do not add a name suffix because it is a base module.
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
vndkVersion = ctx.DeviceConfig().ProductVndkVersion()
|
return ProductSuffix
|
||||||
nameSuffix = ProductSuffix
|
|
||||||
} else {
|
} else {
|
||||||
vndkVersion = ctx.DeviceConfig().VndkVersion()
|
vndkVersion = ctx.DeviceConfig().VndkVersion()
|
||||||
nameSuffix = VendorSuffix
|
nameSuffix = VendorSuffix
|
||||||
|
|
176
cc/cc_test.go
176
cc/cc_test.go
|
@ -41,7 +41,6 @@ var prepareForCcTest = android.GroupFixturePreparers(
|
||||||
PrepareForTestWithCcIncludeVndk,
|
PrepareForTestWithCcIncludeVndk,
|
||||||
android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
|
android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
|
||||||
variables.DeviceVndkVersion = StringPtr("current")
|
variables.DeviceVndkVersion = StringPtr("current")
|
||||||
variables.ProductVndkVersion = StringPtr("current")
|
|
||||||
variables.Platform_vndk_version = StringPtr("29")
|
variables.Platform_vndk_version = StringPtr("29")
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
@ -104,33 +103,6 @@ func testCc(t *testing.T, bp string) *android.TestContext {
|
||||||
return result.TestContext
|
return result.TestContext
|
||||||
}
|
}
|
||||||
|
|
||||||
// testCcNoVndk runs tests using the prepareForCcTest
|
|
||||||
//
|
|
||||||
// See testCc for an explanation as to how to stop using this deprecated method.
|
|
||||||
//
|
|
||||||
// deprecated
|
|
||||||
func testCcNoVndk(t *testing.T, bp string) *android.TestContext {
|
|
||||||
t.Helper()
|
|
||||||
config := TestConfig(t.TempDir(), android.Android, nil, bp, nil)
|
|
||||||
config.TestProductVariables.Platform_vndk_version = StringPtr("29")
|
|
||||||
|
|
||||||
return testCcWithConfig(t, config)
|
|
||||||
}
|
|
||||||
|
|
||||||
// testCcNoProductVndk runs tests using the prepareForCcTest
|
|
||||||
//
|
|
||||||
// See testCc for an explanation as to how to stop using this deprecated method.
|
|
||||||
//
|
|
||||||
// deprecated
|
|
||||||
func testCcNoProductVndk(t *testing.T, bp string) *android.TestContext {
|
|
||||||
t.Helper()
|
|
||||||
config := TestConfig(t.TempDir(), android.Android, nil, bp, nil)
|
|
||||||
config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
|
|
||||||
config.TestProductVariables.Platform_vndk_version = StringPtr("29")
|
|
||||||
|
|
||||||
return testCcWithConfig(t, config)
|
|
||||||
}
|
|
||||||
|
|
||||||
// testCcErrorWithConfig runs tests using the prepareForCcTest
|
// testCcErrorWithConfig runs tests using the prepareForCcTest
|
||||||
//
|
//
|
||||||
// See testCc for an explanation as to how to stop using this deprecated method.
|
// See testCc for an explanation as to how to stop using this deprecated method.
|
||||||
|
@ -167,7 +139,6 @@ func testCcErrorProductVndk(t *testing.T, pattern string, bp string) {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
config := TestConfig(t.TempDir(), android.Android, nil, bp, nil)
|
config := TestConfig(t.TempDir(), android.Android, nil, bp, nil)
|
||||||
config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
|
config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
|
||||||
config.TestProductVariables.ProductVndkVersion = StringPtr("current")
|
|
||||||
config.TestProductVariables.Platform_vndk_version = StringPtr("29")
|
config.TestProductVariables.Platform_vndk_version = StringPtr("29")
|
||||||
testCcErrorWithConfig(t, pattern, config)
|
testCcErrorWithConfig(t, pattern, config)
|
||||||
return
|
return
|
||||||
|
@ -523,7 +494,6 @@ func TestVndk(t *testing.T) {
|
||||||
|
|
||||||
config := TestConfig(t.TempDir(), android.Android, nil, bp, nil)
|
config := TestConfig(t.TempDir(), android.Android, nil, bp, nil)
|
||||||
config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
|
config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
|
||||||
config.TestProductVariables.ProductVndkVersion = StringPtr("current")
|
|
||||||
config.TestProductVariables.Platform_vndk_version = StringPtr("29")
|
config.TestProductVariables.Platform_vndk_version = StringPtr("29")
|
||||||
|
|
||||||
ctx := testCcWithConfig(t, config)
|
ctx := testCcWithConfig(t, config)
|
||||||
|
@ -889,63 +859,6 @@ func TestTestLibraryTestSuites(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestVndkWhenVndkVersionIsNotSet(t *testing.T) {
|
|
||||||
t.Parallel()
|
|
||||||
ctx := testCcNoVndk(t, `
|
|
||||||
cc_library {
|
|
||||||
name: "libvndk",
|
|
||||||
vendor_available: true,
|
|
||||||
product_available: true,
|
|
||||||
vndk: {
|
|
||||||
enabled: true,
|
|
||||||
},
|
|
||||||
nocrt: true,
|
|
||||||
}
|
|
||||||
cc_library {
|
|
||||||
name: "libvndk-private",
|
|
||||||
vendor_available: true,
|
|
||||||
product_available: true,
|
|
||||||
vndk: {
|
|
||||||
enabled: true,
|
|
||||||
private: true,
|
|
||||||
},
|
|
||||||
nocrt: true,
|
|
||||||
}
|
|
||||||
|
|
||||||
cc_library {
|
|
||||||
name: "libllndk",
|
|
||||||
llndk: {
|
|
||||||
symbol_file: "libllndk.map.txt",
|
|
||||||
export_llndk_headers: ["libllndk_headers"],
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
cc_library_headers {
|
|
||||||
name: "libllndk_headers",
|
|
||||||
llndk: {
|
|
||||||
symbol_file: "libllndk.map.txt",
|
|
||||||
},
|
|
||||||
export_include_dirs: ["include"],
|
|
||||||
}
|
|
||||||
`)
|
|
||||||
|
|
||||||
checkVndkOutput(t, ctx, "vndk/vndk.libraries.txt", []string{
|
|
||||||
"LLNDK: libc.so",
|
|
||||||
"LLNDK: libdl.so",
|
|
||||||
"LLNDK: libft2.so",
|
|
||||||
"LLNDK: libllndk.so",
|
|
||||||
"LLNDK: libm.so",
|
|
||||||
"VNDK-SP: libc++.so",
|
|
||||||
"VNDK-core: libvndk-private.so",
|
|
||||||
"VNDK-core: libvndk.so",
|
|
||||||
"VNDK-private: libft2.so",
|
|
||||||
"VNDK-private: libvndk-private.so",
|
|
||||||
"VNDK-product: libc++.so",
|
|
||||||
"VNDK-product: libvndk-private.so",
|
|
||||||
"VNDK-product: libvndk.so",
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestVndkModuleError(t *testing.T) {
|
func TestVndkModuleError(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
// Check the error message for vendor_available and product_available properties.
|
// Check the error message for vendor_available and product_available properties.
|
||||||
|
@ -1111,6 +1024,7 @@ func TestVndkDepError(t *testing.T) {
|
||||||
cc_library {
|
cc_library {
|
||||||
name: "libnonvndk",
|
name: "libnonvndk",
|
||||||
vendor_available: true,
|
vendor_available: true,
|
||||||
|
product_available: true,
|
||||||
nocrt: true,
|
nocrt: true,
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
@ -1132,6 +1046,7 @@ func TestVndkDepError(t *testing.T) {
|
||||||
cc_library {
|
cc_library {
|
||||||
name: "libnonvndk",
|
name: "libnonvndk",
|
||||||
vendor_available: true,
|
vendor_available: true,
|
||||||
|
product_available: true,
|
||||||
nocrt: true,
|
nocrt: true,
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
@ -1153,6 +1068,7 @@ func TestVndkDepError(t *testing.T) {
|
||||||
cc_library {
|
cc_library {
|
||||||
name: "libnonvndk",
|
name: "libnonvndk",
|
||||||
vendor_available: true,
|
vendor_available: true,
|
||||||
|
product_available: true,
|
||||||
nocrt: true,
|
nocrt: true,
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
@ -1175,6 +1091,7 @@ func TestVndkDepError(t *testing.T) {
|
||||||
cc_library {
|
cc_library {
|
||||||
name: "libnonvndk",
|
name: "libnonvndk",
|
||||||
vendor_available: true,
|
vendor_available: true,
|
||||||
|
product_available: true,
|
||||||
nocrt: true,
|
nocrt: true,
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
@ -1390,6 +1307,7 @@ func TestCheckVndkMembershipBeforeDoubleLoadable(t *testing.T) {
|
||||||
cc_library {
|
cc_library {
|
||||||
name: "libanothervndksp",
|
name: "libanothervndksp",
|
||||||
vendor_available: true,
|
vendor_available: true,
|
||||||
|
product_available: true,
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
}
|
}
|
||||||
|
@ -1467,7 +1385,6 @@ func TestVndkExt(t *testing.T) {
|
||||||
`
|
`
|
||||||
config := TestConfig(t.TempDir(), android.Android, nil, bp, nil)
|
config := TestConfig(t.TempDir(), android.Android, nil, bp, nil)
|
||||||
config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
|
config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
|
||||||
config.TestProductVariables.ProductVndkVersion = StringPtr("current")
|
|
||||||
config.TestProductVariables.Platform_vndk_version = StringPtr("29")
|
config.TestProductVariables.Platform_vndk_version = StringPtr("29")
|
||||||
|
|
||||||
ctx := testCcWithConfig(t, config)
|
ctx := testCcWithConfig(t, config)
|
||||||
|
@ -1482,70 +1399,6 @@ func TestVndkExt(t *testing.T) {
|
||||||
assertString(t, mod_product.outputFile.Path().Base(), "libvndk2-suffix.so")
|
assertString(t, mod_product.outputFile.Path().Base(), "libvndk2-suffix.so")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestVndkExtWithoutBoardVndkVersion(t *testing.T) {
|
|
||||||
t.Parallel()
|
|
||||||
// This test checks the VNDK-Ext properties when BOARD_VNDK_VERSION is not set.
|
|
||||||
ctx := testCcNoVndk(t, `
|
|
||||||
cc_library {
|
|
||||||
name: "libvndk",
|
|
||||||
vendor_available: true,
|
|
||||||
product_available: true,
|
|
||||||
vndk: {
|
|
||||||
enabled: true,
|
|
||||||
},
|
|
||||||
nocrt: true,
|
|
||||||
}
|
|
||||||
|
|
||||||
cc_library {
|
|
||||||
name: "libvndk_ext",
|
|
||||||
vendor: true,
|
|
||||||
vndk: {
|
|
||||||
enabled: true,
|
|
||||||
extends: "libvndk",
|
|
||||||
},
|
|
||||||
nocrt: true,
|
|
||||||
}
|
|
||||||
`)
|
|
||||||
|
|
||||||
// Ensures that the core variant of "libvndk_ext" can be found.
|
|
||||||
mod := ctx.ModuleForTests("libvndk_ext", coreVariant).Module().(*Module)
|
|
||||||
if extends := mod.getVndkExtendsModuleName(); extends != "libvndk" {
|
|
||||||
t.Errorf("\"libvndk_ext\" must extend from \"libvndk\" but get %q", extends)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestVndkExtWithoutProductVndkVersion(t *testing.T) {
|
|
||||||
t.Parallel()
|
|
||||||
// This test checks the VNDK-Ext properties when PRODUCT_PRODUCT_VNDK_VERSION is not set.
|
|
||||||
ctx := testCcNoProductVndk(t, `
|
|
||||||
cc_library {
|
|
||||||
name: "libvndk",
|
|
||||||
vendor_available: true,
|
|
||||||
product_available: true,
|
|
||||||
vndk: {
|
|
||||||
enabled: true,
|
|
||||||
},
|
|
||||||
nocrt: true,
|
|
||||||
}
|
|
||||||
|
|
||||||
cc_library {
|
|
||||||
name: "libvndk_ext_product",
|
|
||||||
product_specific: true,
|
|
||||||
vndk: {
|
|
||||||
enabled: true,
|
|
||||||
extends: "libvndk",
|
|
||||||
},
|
|
||||||
nocrt: true,
|
|
||||||
}
|
|
||||||
`)
|
|
||||||
|
|
||||||
// Ensures that the core variant of "libvndk_ext_product" can be found.
|
|
||||||
mod := ctx.ModuleForTests("libvndk_ext_product", coreVariant).Module().(*Module)
|
|
||||||
if extends := mod.getVndkExtendsModuleName(); extends != "libvndk" {
|
|
||||||
t.Errorf("\"libvndk_ext_product\" must extend from \"libvndk\" but get %q", extends)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestVndkExtError(t *testing.T) {
|
func TestVndkExtError(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
// This test ensures an error is emitted in ill-formed vndk-ext definition.
|
// This test ensures an error is emitted in ill-formed vndk-ext definition.
|
||||||
|
@ -1920,7 +1773,6 @@ func TestProductVndkExtDependency(t *testing.T) {
|
||||||
`
|
`
|
||||||
config := TestConfig(t.TempDir(), android.Android, nil, bp, nil)
|
config := TestConfig(t.TempDir(), android.Android, nil, bp, nil)
|
||||||
config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
|
config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
|
||||||
config.TestProductVariables.ProductVndkVersion = StringPtr("current")
|
|
||||||
config.TestProductVariables.Platform_vndk_version = StringPtr("29")
|
config.TestProductVariables.Platform_vndk_version = StringPtr("29")
|
||||||
|
|
||||||
testCcWithConfig(t, config)
|
testCcWithConfig(t, config)
|
||||||
|
@ -3034,24 +2886,6 @@ func TestExcludeRuntimeLibs(t *testing.T) {
|
||||||
checkRuntimeLibs(t, nil, module)
|
checkRuntimeLibs(t, nil, module)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRuntimeLibsNoVndk(t *testing.T) {
|
|
||||||
t.Parallel()
|
|
||||||
ctx := testCcNoVndk(t, runtimeLibAndroidBp)
|
|
||||||
|
|
||||||
// If DeviceVndkVersion is not defined, then runtime_libs are copied as-is.
|
|
||||||
|
|
||||||
variant := "android_arm64_armv8-a_shared"
|
|
||||||
|
|
||||||
module := ctx.ModuleForTests("libvendor_available1", variant).Module().(*Module)
|
|
||||||
checkRuntimeLibs(t, []string{"liball_available"}, module)
|
|
||||||
|
|
||||||
module = ctx.ModuleForTests("libvendor2", variant).Module().(*Module)
|
|
||||||
checkRuntimeLibs(t, []string{"liball_available", "libvendor1", "libproduct_vendor"}, module)
|
|
||||||
|
|
||||||
module = ctx.ModuleForTests("libproduct2", variant).Module().(*Module)
|
|
||||||
checkRuntimeLibs(t, []string{"liball_available", "libproduct1", "libproduct_vendor"}, module)
|
|
||||||
}
|
|
||||||
|
|
||||||
func checkStaticLibs(t *testing.T, expected []string, module *Module) {
|
func checkStaticLibs(t *testing.T, expected []string, module *Module) {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
actual := module.Properties.AndroidMkStaticLibs
|
actual := module.Properties.AndroidMkStaticLibs
|
||||||
|
|
|
@ -84,7 +84,7 @@ func (g *GenruleExtraProperties) CoreVariantNeeded(ctx android.BaseModuleContext
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
if ctx.DeviceConfig().ProductVndkVersion() != "" && ctx.ProductSpecific() {
|
if ctx.ProductSpecific() {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,15 +134,8 @@ func (g *GenruleExtraProperties) ExtraImageVariations(ctx android.BaseModuleCont
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ctx.DeviceConfig().ProductVndkVersion() == "" {
|
|
||||||
return variants
|
|
||||||
}
|
|
||||||
|
|
||||||
if Bool(g.Product_available) || ctx.ProductSpecific() {
|
if Bool(g.Product_available) || ctx.ProductSpecific() {
|
||||||
variants = append(variants, ProductVariationPrefix+ctx.DeviceConfig().PlatformVndkVersion())
|
variants = append(variants, ProductVariationPrefix+ctx.DeviceConfig().PlatformVndkVersion())
|
||||||
if vndkVersion := ctx.DeviceConfig().ProductVndkVersion(); vndkVersion != "current" {
|
|
||||||
variants = append(variants, ProductVariationPrefix+vndkVersion)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return variants
|
return variants
|
||||||
|
|
29
cc/image.go
29
cc/image.go
|
@ -427,7 +427,6 @@ func MutateImage(mctx android.BaseModuleContext, m ImageMutatableModule) {
|
||||||
|
|
||||||
platformVndkVersion := mctx.DeviceConfig().PlatformVndkVersion()
|
platformVndkVersion := mctx.DeviceConfig().PlatformVndkVersion()
|
||||||
boardVndkVersion := mctx.DeviceConfig().VndkVersion()
|
boardVndkVersion := mctx.DeviceConfig().VndkVersion()
|
||||||
productVndkVersion := mctx.DeviceConfig().ProductVndkVersion()
|
|
||||||
recoverySnapshotVersion := mctx.DeviceConfig().RecoverySnapshotVersion()
|
recoverySnapshotVersion := mctx.DeviceConfig().RecoverySnapshotVersion()
|
||||||
usingRecoverySnapshot := recoverySnapshotVersion != "current" &&
|
usingRecoverySnapshot := recoverySnapshotVersion != "current" &&
|
||||||
recoverySnapshotVersion != ""
|
recoverySnapshotVersion != ""
|
||||||
|
@ -444,9 +443,6 @@ func MutateImage(mctx android.BaseModuleContext, m ImageMutatableModule) {
|
||||||
if boardVndkVersion == "current" {
|
if boardVndkVersion == "current" {
|
||||||
boardVndkVersion = platformVndkVersion
|
boardVndkVersion = platformVndkVersion
|
||||||
}
|
}
|
||||||
if productVndkVersion == "current" {
|
|
||||||
productVndkVersion = platformVndkVersion
|
|
||||||
}
|
|
||||||
|
|
||||||
if m.NeedsLlndkVariants() {
|
if m.NeedsLlndkVariants() {
|
||||||
// This is an LLNDK library. The implementation of the library will be on /system,
|
// This is an LLNDK library. The implementation of the library will be on /system,
|
||||||
|
@ -462,9 +458,6 @@ func MutateImage(mctx android.BaseModuleContext, m ImageMutatableModule) {
|
||||||
if needVndkVersionVendorVariantForLlndk {
|
if needVndkVersionVendorVariantForLlndk {
|
||||||
vendorVariants = append(vendorVariants, boardVndkVersion)
|
vendorVariants = append(vendorVariants, boardVndkVersion)
|
||||||
}
|
}
|
||||||
if productVndkVersion != "" {
|
|
||||||
productVariants = append(productVariants, productVndkVersion)
|
|
||||||
}
|
|
||||||
} else if m.NeedsVendorPublicLibraryVariants() {
|
} else if m.NeedsVendorPublicLibraryVariants() {
|
||||||
// A vendor public library has the implementation on /vendor, with stub variants
|
// A vendor public library has the implementation on /vendor, with stub variants
|
||||||
// for system and product.
|
// for system and product.
|
||||||
|
@ -473,9 +466,6 @@ func MutateImage(mctx android.BaseModuleContext, m ImageMutatableModule) {
|
||||||
if platformVndkVersion != "" {
|
if platformVndkVersion != "" {
|
||||||
productVariants = append(productVariants, platformVndkVersion)
|
productVariants = append(productVariants, platformVndkVersion)
|
||||||
}
|
}
|
||||||
if productVndkVersion != "" {
|
|
||||||
productVariants = append(productVariants, productVndkVersion)
|
|
||||||
}
|
|
||||||
} else if boardVndkVersion == "" {
|
} else if boardVndkVersion == "" {
|
||||||
// If the device isn't compiling against the VNDK, we always
|
// If the device isn't compiling against the VNDK, we always
|
||||||
// use the core mode.
|
// use the core mode.
|
||||||
|
@ -507,10 +497,6 @@ func MutateImage(mctx android.BaseModuleContext, m ImageMutatableModule) {
|
||||||
// product_available modules are available to /product.
|
// product_available modules are available to /product.
|
||||||
if m.HasProductVariant() {
|
if m.HasProductVariant() {
|
||||||
productVariants = append(productVariants, platformVndkVersion)
|
productVariants = append(productVariants, platformVndkVersion)
|
||||||
// VNDK is always PLATFORM_VNDK_VERSION
|
|
||||||
if !m.IsVndk() {
|
|
||||||
productVariants = append(productVariants, productVndkVersion)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else if vendorSpecific && m.SdkVersion() == "" {
|
} else if vendorSpecific && m.SdkVersion() == "" {
|
||||||
// This will be available in /vendor (or /odm) only
|
// This will be available in /vendor (or /odm) only
|
||||||
|
@ -538,17 +524,10 @@ func MutateImage(mctx android.BaseModuleContext, m ImageMutatableModule) {
|
||||||
coreVariantNeeded = true
|
coreVariantNeeded = true
|
||||||
}
|
}
|
||||||
|
|
||||||
if boardVndkVersion != "" && productVndkVersion != "" {
|
if coreVariantNeeded && productSpecific && m.SdkVersion() == "" {
|
||||||
if coreVariantNeeded && productSpecific && m.SdkVersion() == "" {
|
// The module has "product_specific: true" that does not create core variant.
|
||||||
// The module has "product_specific: true" that does not create core variant.
|
coreVariantNeeded = false
|
||||||
coreVariantNeeded = false
|
productVariants = append(productVariants, platformVndkVersion)
|
||||||
productVariants = append(productVariants, productVndkVersion)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// Unless PRODUCT_PRODUCT_VNDK_VERSION is set, product partition has no
|
|
||||||
// restriction to use system libs.
|
|
||||||
// No product variants defined in this case.
|
|
||||||
productVariants = []string{}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if m.RamdiskAvailable() {
|
if m.RamdiskAvailable() {
|
||||||
|
|
|
@ -40,7 +40,6 @@ var prepareForRustTest = android.GroupFixturePreparers(
|
||||||
PrepareForTestWithRustIncludeVndk,
|
PrepareForTestWithRustIncludeVndk,
|
||||||
android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
|
android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
|
||||||
variables.DeviceVndkVersion = StringPtr("current")
|
variables.DeviceVndkVersion = StringPtr("current")
|
||||||
variables.ProductVndkVersion = StringPtr("current")
|
|
||||||
variables.Platform_vndk_version = StringPtr("29")
|
variables.Platform_vndk_version = StringPtr("29")
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
@ -105,7 +104,6 @@ func testRustVndkFsVersions(t *testing.T, bp string, fs android.MockFS, device_v
|
||||||
android.FixtureModifyProductVariables(
|
android.FixtureModifyProductVariables(
|
||||||
func(variables android.FixtureProductVariables) {
|
func(variables android.FixtureProductVariables) {
|
||||||
variables.DeviceVndkVersion = StringPtr(device_version)
|
variables.DeviceVndkVersion = StringPtr(device_version)
|
||||||
variables.ProductVndkVersion = StringPtr(product_version)
|
|
||||||
variables.Platform_vndk_version = StringPtr(vndk_version)
|
variables.Platform_vndk_version = StringPtr(vndk_version)
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
@ -173,7 +171,6 @@ func testRustVndkFsError(t *testing.T, pattern string, bp string, fs android.Moc
|
||||||
android.FixtureModifyProductVariables(
|
android.FixtureModifyProductVariables(
|
||||||
func(variables android.FixtureProductVariables) {
|
func(variables android.FixtureProductVariables) {
|
||||||
variables.DeviceVndkVersion = StringPtr("current")
|
variables.DeviceVndkVersion = StringPtr("current")
|
||||||
variables.ProductVndkVersion = StringPtr("current")
|
|
||||||
variables.Platform_vndk_version = StringPtr("VER")
|
variables.Platform_vndk_version = StringPtr("VER")
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|
|
@ -42,6 +42,7 @@ func test(t *testing.T, bp string) *android.TestResult {
|
||||||
cc_library_headers {
|
cc_library_headers {
|
||||||
name: "libbase_headers",
|
name: "libbase_headers",
|
||||||
vendor_available: true,
|
vendor_available: true,
|
||||||
|
product_available: true,
|
||||||
recovery_available: true,
|
recovery_available: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -250,6 +251,16 @@ func TestSyspropLibrary(t *testing.T) {
|
||||||
result.ModuleForTests("libsysprop-odm", variant)
|
result.ModuleForTests("libsysprop-odm", variant)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// product variant of vendor-owned sysprop_library
|
||||||
|
for _, variant := range []string{
|
||||||
|
"android_product.29_arm_armv7-a-neon_shared",
|
||||||
|
"android_product.29_arm_armv7-a-neon_static",
|
||||||
|
"android_product.29_arm64_armv8-a_shared",
|
||||||
|
"android_product.29_arm64_armv8-a_static",
|
||||||
|
} {
|
||||||
|
result.ModuleForTests("libsysprop-vendor-on-product", variant)
|
||||||
|
}
|
||||||
|
|
||||||
for _, variant := range []string{
|
for _, variant := range []string{
|
||||||
"android_arm_armv7-a-neon_shared",
|
"android_arm_armv7-a-neon_shared",
|
||||||
"android_arm_armv7-a-neon_static",
|
"android_arm_armv7-a-neon_static",
|
||||||
|
@ -259,9 +270,6 @@ func TestSyspropLibrary(t *testing.T) {
|
||||||
library := result.ModuleForTests("libsysprop-platform", variant).Module().(*cc.Module)
|
library := result.ModuleForTests("libsysprop-platform", variant).Module().(*cc.Module)
|
||||||
expectedApexAvailableOnLibrary := []string{"//apex_available:platform"}
|
expectedApexAvailableOnLibrary := []string{"//apex_available:platform"}
|
||||||
android.AssertDeepEquals(t, "apex available property on libsysprop-platform", expectedApexAvailableOnLibrary, library.ApexProperties.Apex_available)
|
android.AssertDeepEquals(t, "apex available property on libsysprop-platform", expectedApexAvailableOnLibrary, library.ApexProperties.Apex_available)
|
||||||
|
|
||||||
// product variant of vendor-owned sysprop_library
|
|
||||||
result.ModuleForTests("libsysprop-vendor-on-product", variant)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
result.ModuleForTests("sysprop-platform", "android_common")
|
result.ModuleForTests("sysprop-platform", "android_common")
|
||||||
|
@ -272,15 +280,15 @@ func TestSyspropLibrary(t *testing.T) {
|
||||||
// Check for exported includes
|
// Check for exported includes
|
||||||
coreVariant := "android_arm64_armv8-a_static"
|
coreVariant := "android_arm64_armv8-a_static"
|
||||||
vendorVariant := "android_vendor.29_arm64_armv8-a_static"
|
vendorVariant := "android_vendor.29_arm64_armv8-a_static"
|
||||||
|
productVariant := "android_product.29_arm64_armv8-a_static"
|
||||||
|
|
||||||
platformInternalPath := "libsysprop-platform/android_arm64_armv8-a_static/gen/sysprop/include"
|
platformInternalPath := "libsysprop-platform/android_arm64_armv8-a_static/gen/sysprop/include"
|
||||||
platformPublicCorePath := "libsysprop-platform/android_arm64_armv8-a_static/gen/sysprop/public/include"
|
|
||||||
platformPublicVendorPath := "libsysprop-platform/android_vendor.29_arm64_armv8-a_static/gen/sysprop/public/include"
|
platformPublicVendorPath := "libsysprop-platform/android_vendor.29_arm64_armv8-a_static/gen/sysprop/public/include"
|
||||||
|
|
||||||
platformOnProductPath := "libsysprop-platform-on-product/android_arm64_armv8-a_static/gen/sysprop/public/include"
|
platformOnProductPath := "libsysprop-platform-on-product/android_product.29_arm64_armv8-a_static/gen/sysprop/public/include"
|
||||||
|
|
||||||
vendorInternalPath := "libsysprop-vendor/android_vendor.29_arm64_armv8-a_static/gen/sysprop/include"
|
vendorInternalPath := "libsysprop-vendor/android_vendor.29_arm64_armv8-a_static/gen/sysprop/include"
|
||||||
vendorPublicPath := "libsysprop-vendor-on-product/android_arm64_armv8-a_static/gen/sysprop/public/include"
|
vendorOnProductPath := "libsysprop-vendor-on-product/android_product.29_arm64_armv8-a_static/gen/sysprop/public/include"
|
||||||
|
|
||||||
platformClient := result.ModuleForTests("cc-client-platform", coreVariant)
|
platformClient := result.ModuleForTests("cc-client-platform", coreVariant)
|
||||||
platformFlags := platformClient.Rule("cc").Args["cFlags"]
|
platformFlags := platformClient.Rule("cc").Args["cFlags"]
|
||||||
|
@ -294,14 +302,14 @@ func TestSyspropLibrary(t *testing.T) {
|
||||||
// platform-static should use platform's internal header
|
// platform-static should use platform's internal header
|
||||||
android.AssertStringDoesContain(t, "flags for platform-static", platformStaticFlags, platformInternalPath)
|
android.AssertStringDoesContain(t, "flags for platform-static", platformStaticFlags, platformInternalPath)
|
||||||
|
|
||||||
productClient := result.ModuleForTests("cc-client-product", coreVariant)
|
productClient := result.ModuleForTests("cc-client-product", productVariant)
|
||||||
productFlags := productClient.Rule("cc").Args["cFlags"]
|
productFlags := productClient.Rule("cc").Args["cFlags"]
|
||||||
|
|
||||||
// Product should use platform's and vendor's public headers
|
// Product should use platform's and vendor's public headers
|
||||||
if !strings.Contains(productFlags, platformOnProductPath) ||
|
if !strings.Contains(productFlags, platformOnProductPath) ||
|
||||||
!strings.Contains(productFlags, vendorPublicPath) {
|
!strings.Contains(productFlags, vendorOnProductPath) {
|
||||||
t.Errorf("flags for product must contain %#v and %#v, but was %#v.",
|
t.Errorf("flags for product must contain %#v and %#v, but was %#v.",
|
||||||
platformPublicCorePath, vendorPublicPath, productFlags)
|
platformOnProductPath, vendorOnProductPath, productFlags)
|
||||||
}
|
}
|
||||||
|
|
||||||
vendorClient := result.ModuleForTests("cc-client-vendor", vendorVariant)
|
vendorClient := result.ModuleForTests("cc-client-vendor", vendorVariant)
|
||||||
|
|
Loading…
Reference in a new issue