Store ndkKnownLibs in the config
Storing ndkKnownLibs prevents multiple tests from running in parallel
as one may be writing to the list while another is reading from it.
Store it in the config so each test has its own copy.
Test: go test -race ./apex
Change-Id: Iba57c9494012c9e0ae9e5ffaa63b9b2bd2c77492
diff --git a/cc/cc.go b/cc/cc.go
index e887fcf..26742fb 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -368,7 +368,7 @@
useSdk() bool
sdkVersion() string
useVndk() bool
- isNdk() bool
+ isNdk(config android.Config) bool
isLlndk(config android.Config) bool
isLlndkPublic(config android.Config) bool
isVndkPrivate(config android.Config) bool
@@ -938,8 +938,8 @@
return c.coverage.Properties.IsCoverageVariant
}
-func (c *Module) IsNdk() bool {
- return inList(c.BaseModuleName(), ndkKnownLibs)
+func (c *Module) IsNdk(config android.Config) bool {
+ return inList(c.BaseModuleName(), *getNDKKnownLibs(config))
}
func (c *Module) isLlndk(config android.Config) bool {
@@ -1140,8 +1140,8 @@
return ctx.mod.UseVndk()
}
-func (ctx *moduleContextImpl) isNdk() bool {
- return ctx.mod.IsNdk()
+func (ctx *moduleContextImpl) isNdk(config android.Config) bool {
+ return ctx.mod.IsNdk(config)
}
func (ctx *moduleContextImpl) isLlndk(config android.Config) bool {
@@ -1761,7 +1761,7 @@
for _, entry := range list {
// strip #version suffix out
name, _ := StubsLibNameAndVersion(entry)
- if ctx.useSdk() && inList(name, ndkKnownLibs) {
+ if ctx.useSdk() && inList(name, *getNDKKnownLibs(ctx.Config())) {
variantLibs = append(variantLibs, name+ndkLibrarySuffix)
} else if ctx.useVndk() {
nonvariantLibs = append(nonvariantLibs, rewriteVendorLibs(entry))