Merge changes I789b526c,Ie15c811f am: 6e147e4f54 am: 450510faa7

Change-Id: I5e1d927f6f586010ef59d5f3ff1c14b6273bf8f4
This commit is contained in:
Automerger Merge Worker 2020-02-28 17:32:35 +00:00
commit eed20ed32a
2 changed files with 48 additions and 57 deletions

View File

@ -1160,7 +1160,7 @@ func setUseVendorWhitelistForTest(config android.Config, whitelist []string) {
})
}
type apexNativeDependencies struct {
type ApexNativeDependencies struct {
// List of native libraries
Native_shared_libs []string
@ -1173,19 +1173,19 @@ type apexNativeDependencies struct {
type apexMultilibProperties struct {
// Native dependencies whose compile_multilib is "first"
First apexNativeDependencies
First ApexNativeDependencies
// Native dependencies whose compile_multilib is "both"
Both apexNativeDependencies
Both ApexNativeDependencies
// Native dependencies whose compile_multilib is "prefer32"
Prefer32 apexNativeDependencies
Prefer32 ApexNativeDependencies
// Native dependencies whose compile_multilib is "32"
Lib32 apexNativeDependencies
Lib32 ApexNativeDependencies
// Native dependencies whose compile_multilib is "64"
Lib64 apexNativeDependencies
Lib64 ApexNativeDependencies
}
type apexBundleProperties struct {
@ -1207,11 +1207,7 @@ type apexBundleProperties struct {
// Default: /system/sepolicy/apex/<module_name>_file_contexts.
File_contexts *string `android:"path"`
// List of native shared libs that are embedded inside this APEX bundle
Native_shared_libs []string
// List of executables that are embedded inside this APEX bundle
Binaries []string
ApexNativeDependencies
// List of java libraries that are embedded inside this APEX bundle
Java_libs []string
@ -1219,9 +1215,6 @@ type apexBundleProperties struct {
// List of prebuilt files that are embedded inside this APEX bundle
Prebuilts []string
// List of tests that are embedded inside this APEX bundle
Tests []string
// Name of the apex_key module that provides the private key to sign APEX
Key *string
@ -1536,7 +1529,7 @@ type apexBundle struct {
}
func addDependenciesForNativeModules(ctx android.BottomUpMutatorContext,
native_shared_libs []string, binaries []string, tests []string,
nativeModules ApexNativeDependencies,
target android.Target, imageVariation string) {
// Use *FarVariation* to be able to depend on modules having
// conflicting variations with this module. This is required since
@ -1546,16 +1539,16 @@ func addDependenciesForNativeModules(ctx android.BottomUpMutatorContext,
{Mutator: "image", Variation: imageVariation},
{Mutator: "link", Variation: "shared"},
{Mutator: "version", Variation: ""}, // "" is the non-stub variant
}...), sharedLibTag, native_shared_libs...)
}...), sharedLibTag, nativeModules.Native_shared_libs...)
ctx.AddFarVariationDependencies(append(target.Variations(),
blueprint.Variation{Mutator: "image", Variation: imageVariation}),
executableTag, binaries...)
executableTag, nativeModules.Binaries...)
ctx.AddFarVariationDependencies(append(target.Variations(), []blueprint.Variation{
{Mutator: "image", Variation: imageVariation},
{Mutator: "test_per_src", Variation: ""}, // "" is the all-tests variant
}...), testTag, tests...)
}...), testTag, nativeModules.Tests...)
}
func (a *apexBundle) combineProperties(ctx android.BottomUpMutatorContext) {
@ -1588,41 +1581,37 @@ func (a *apexBundle) DepsMutator(ctx android.BottomUpMutatorContext) {
}
}
for i, target := range targets {
// When multilib.* is omitted for native_shared_libs, it implies
// multilib.both.
ctx.AddFarVariationDependencies(append(target.Variations(), []blueprint.Variation{
{Mutator: "image", Variation: a.getImageVariation(config)},
{Mutator: "link", Variation: "shared"},
}...), sharedLibTag, a.properties.Native_shared_libs...)
// When multilib.* is omitted for tests, it implies
// multilib.both.
ctx.AddFarVariationDependencies(append(target.Variations(), []blueprint.Variation{
{Mutator: "image", Variation: a.getImageVariation(config)},
{Mutator: "test_per_src", Variation: ""}, // "" is the all-tests variant
}...), testTag, a.properties.Tests...)
// When multilib.* is omitted for native_shared_libs/tests, it implies
// multilib.both
addDependenciesForNativeModules(ctx,
ApexNativeDependencies{
Native_shared_libs: a.properties.Native_shared_libs,
Tests: a.properties.Tests,
Binaries: nil,
},
target, a.getImageVariation(config))
// Add native modules targetting both ABIs
addDependenciesForNativeModules(ctx,
a.properties.Multilib.Both.Native_shared_libs,
a.properties.Multilib.Both.Binaries,
a.properties.Multilib.Both.Tests,
a.properties.Multilib.Both,
target,
a.getImageVariation(config))
isPrimaryAbi := i == 0
if isPrimaryAbi {
// When multilib.* is omitted for binaries, it implies
// multilib.first.
ctx.AddFarVariationDependencies(append(target.Variations(),
blueprint.Variation{Mutator: "image", Variation: a.getImageVariation(config)}),
executableTag, a.properties.Binaries...)
// multilib.first
addDependenciesForNativeModules(ctx,
ApexNativeDependencies{
Native_shared_libs: nil,
Tests: nil,
Binaries: a.properties.Binaries,
},
target, a.getImageVariation(config))
// Add native modules targetting the first ABI
addDependenciesForNativeModules(ctx,
a.properties.Multilib.First.Native_shared_libs,
a.properties.Multilib.First.Binaries,
a.properties.Multilib.First.Tests,
a.properties.Multilib.First,
target,
a.getImageVariation(config))
}
@ -1631,32 +1620,24 @@ func (a *apexBundle) DepsMutator(ctx android.BottomUpMutatorContext) {
case "lib32":
// Add native modules targetting 32-bit ABI
addDependenciesForNativeModules(ctx,
a.properties.Multilib.Lib32.Native_shared_libs,
a.properties.Multilib.Lib32.Binaries,
a.properties.Multilib.Lib32.Tests,
a.properties.Multilib.Lib32,
target,
a.getImageVariation(config))
addDependenciesForNativeModules(ctx,
a.properties.Multilib.Prefer32.Native_shared_libs,
a.properties.Multilib.Prefer32.Binaries,
a.properties.Multilib.Prefer32.Tests,
a.properties.Multilib.Prefer32,
target,
a.getImageVariation(config))
case "lib64":
// Add native modules targetting 64-bit ABI
addDependenciesForNativeModules(ctx,
a.properties.Multilib.Lib64.Native_shared_libs,
a.properties.Multilib.Lib64.Binaries,
a.properties.Multilib.Lib64.Tests,
a.properties.Multilib.Lib64,
target,
a.getImageVariation(config))
if !has32BitTarget {
addDependenciesForNativeModules(ctx,
a.properties.Multilib.Prefer32.Native_shared_libs,
a.properties.Multilib.Prefer32.Binaries,
a.properties.Multilib.Prefer32.Tests,
a.properties.Multilib.Prefer32,
target,
a.getImageVariation(config))
}
@ -1665,8 +1646,8 @@ func (a *apexBundle) DepsMutator(ctx android.BottomUpMutatorContext) {
for _, sanitizer := range ctx.Config().SanitizeDevice() {
if sanitizer == "hwaddress" {
addDependenciesForNativeModules(ctx,
[]string{"libclang_rt.hwasan-aarch64-android"},
nil, nil, target, a.getImageVariation(config))
ApexNativeDependencies{[]string{"libclang_rt.hwasan-aarch64-android"}, nil, nil},
target, a.getImageVariation(config))
break
}
}

View File

@ -1532,13 +1532,17 @@ func ensureExactContents(t *testing.T, ctx *android.TestContext, moduleName, var
var surplus []string
filesMatched := make(map[string]bool)
for _, file := range getFiles(t, ctx, moduleName, variant) {
mactchFound := false
for _, expected := range files {
if matched, _ := path.Match(expected, file.path); matched {
filesMatched[expected] = true
return
mactchFound = true
break
}
}
surplus = append(surplus, file.path)
if !mactchFound {
surplus = append(surplus, file.path)
}
}
if len(surplus) > 0 {
@ -1605,8 +1609,10 @@ func TestVndkApexCurrent(t *testing.T) {
ensureExactContents(t, ctx, "myapex", "android_common_image", []string{
"lib/libvndk.so",
"lib/libvndksp.so",
"lib/libc++.so",
"lib64/libvndk.so",
"lib64/libvndksp.so",
"lib64/libc++.so",
"etc/llndk.libraries.VER.txt",
"etc/vndkcore.libraries.VER.txt",
"etc/vndksp.libraries.VER.txt",
@ -1666,6 +1672,8 @@ func TestVndkApexWithPrebuilt(t *testing.T) {
"lib/libvndk.so",
"lib/libvndk.arm.so",
"lib64/libvndk.so",
"lib/libc++.so",
"lib64/libc++.so",
"etc/*",
})
}
@ -1877,6 +1885,8 @@ func TestVndkApexSkipsNativeBridgeSupportedModules(t *testing.T) {
ensureExactContents(t, ctx, "myapex", "android_common_image", []string{
"lib/libvndk.so",
"lib64/libvndk.so",
"lib/libc++.so",
"lib64/libc++.so",
"etc/*",
})
}