apex_vndk doen't need stub variants
This was revealed by the new check added in Ib3c6efd16bdf13b59f79be66d4f9dba49100f6cc. This was okay since the old implementation relied on the fact that impl variant comes before stub variants. To make the new check happy and keep the intention explicit, stub variants are not added to VNDK apex. Bug: 191770320 Test: m (apex_test) Change-Id: I455f2c9b6bc471c579379286c0198f36d325adf6
This commit is contained in:
@@ -3420,11 +3420,34 @@ type fileInApex struct {
|
||||
isLink bool
|
||||
}
|
||||
|
||||
func (f fileInApex) String() string {
|
||||
return f.src + ":" + f.path
|
||||
}
|
||||
|
||||
func (f fileInApex) match(expectation string) bool {
|
||||
parts := strings.Split(expectation, ":")
|
||||
if len(parts) == 1 {
|
||||
match, _ := path.Match(parts[0], f.path)
|
||||
return match
|
||||
}
|
||||
if len(parts) == 2 {
|
||||
matchSrc, _ := path.Match(parts[0], f.src)
|
||||
matchDst, _ := path.Match(parts[1], f.path)
|
||||
return matchSrc && matchDst
|
||||
}
|
||||
panic("invalid expected file specification: " + expectation)
|
||||
}
|
||||
|
||||
func getFiles(t *testing.T, ctx *android.TestContext, moduleName, variant string) []fileInApex {
|
||||
t.Helper()
|
||||
apexRule := ctx.ModuleForTests(moduleName, variant).Rule("apexRule")
|
||||
module := ctx.ModuleForTests(moduleName, variant)
|
||||
apexRule := module.MaybeRule("apexRule")
|
||||
apexDir := "/image.apex/"
|
||||
if apexRule.Rule == nil {
|
||||
apexRule = module.Rule("zipApexRule")
|
||||
apexDir = "/image.zipapex/"
|
||||
}
|
||||
copyCmds := apexRule.Args["copy_commands"]
|
||||
imageApexDir := "/image.apex/"
|
||||
var ret []fileInApex
|
||||
for _, cmd := range strings.Split(copyCmds, "&&") {
|
||||
cmd = strings.TrimSpace(cmd)
|
||||
@@ -3455,11 +3478,11 @@ func getFiles(t *testing.T, ctx *android.TestContext, moduleName, variant string
|
||||
t.Fatalf("copyCmds should contain mkdir/cp commands only: %q", cmd)
|
||||
}
|
||||
if dst != "" {
|
||||
index := strings.Index(dst, imageApexDir)
|
||||
index := strings.Index(dst, apexDir)
|
||||
if index == -1 {
|
||||
t.Fatal("copyCmds should copy a file to image.apex/", cmd)
|
||||
t.Fatal("copyCmds should copy a file to "+apexDir, cmd)
|
||||
}
|
||||
dstFile := dst[index+len(imageApexDir):]
|
||||
dstFile := dst[index+len(apexDir):]
|
||||
ret = append(ret, fileInApex{path: dstFile, src: src, isLink: isLink})
|
||||
}
|
||||
}
|
||||
@@ -3472,16 +3495,16 @@ 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
|
||||
matchFound := false
|
||||
for _, expected := range files {
|
||||
if matched, _ := path.Match(expected, file.path); matched {
|
||||
if file.match(expected) {
|
||||
matchFound = true
|
||||
filesMatched[expected] = true
|
||||
mactchFound = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !mactchFound {
|
||||
surplus = append(surplus, file.path)
|
||||
if !matchFound {
|
||||
surplus = append(surplus, file.String())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3974,6 +3997,11 @@ func TestVndkApexShouldNotProvideNativeLibs(t *testing.T) {
|
||||
apexManifestRule := ctx.ModuleForTests("com.android.vndk.current", "android_common_image").Rule("apexManifestRule")
|
||||
provideNativeLibs := names(apexManifestRule.Args["provideNativeLibs"])
|
||||
ensureListEmpty(t, provideNativeLibs)
|
||||
ensureExactContents(t, ctx, "com.android.vndk.current", "android_common_image", []string{
|
||||
"out/soong/.intermediates/libz/android_vendor.29_arm64_armv8-a_shared/libz.so:lib64/libz.so",
|
||||
"out/soong/.intermediates/libz/android_vendor.29_arm_armv7-a-neon_shared/libz.so:lib/libz.so",
|
||||
"*/*",
|
||||
})
|
||||
}
|
||||
|
||||
func TestDependenciesInApexManifest(t *testing.T) {
|
||||
|
@@ -368,7 +368,10 @@ func IsForVndkApex(mctx android.BottomUpMutatorContext, m *Module) bool {
|
||||
}
|
||||
return m.ImageVariation().Variation == android.CoreVariation && lib.shared() && m.IsVndkSp() && !m.IsVndkExt()
|
||||
}
|
||||
|
||||
// VNDK APEX doesn't need stub variants
|
||||
if lib.buildStubs() {
|
||||
return false
|
||||
}
|
||||
useCoreVariant := m.VndkVersion() == mctx.DeviceConfig().PlatformVndkVersion() &&
|
||||
mctx.DeviceConfig().VndkUseCoreVariant() && !m.MustUseVendorVariant()
|
||||
return lib.shared() && m.InVendor() && m.IsVndk() && !m.IsVndkExt() && !useCoreVariant
|
||||
|
Reference in New Issue
Block a user