Generate "current" API level.
Support for using this coming in an upcoming patch.
Test: nose2
readelf to check the following:
* bsd_signal unversioned before current
* bsd_signal versioned in current
* catclose missing before current
* catclose present and versioned in current
Bug: None
Change-Id: I861862161426d3ec5b530e3156d3a8ae96fed468
diff --git a/cc/ndk_library.go b/cc/ndk_library.go
index 94be17c..d603ad0 100644
--- a/cc/ndk_library.go
+++ b/cc/ndk_library.go
@@ -88,7 +88,7 @@
First_version string
// Private property for use by the mutator that splits per-API level.
- ApiLevel int `blueprint:"mutated"`
+ ApiLevel string `blueprint:"mutated"`
}
type stubDecorator struct {
@@ -147,14 +147,15 @@
mctx.PropertyErrorf("first_version", err.Error())
}
- versionStrs := make([]string, maxVersion-firstVersion+1)
+ var versionStrs []string
for version := firstVersion; version <= maxVersion; version++ {
- versionStrs[version-firstVersion] = strconv.Itoa(version)
+ versionStrs = append(versionStrs, strconv.Itoa(version))
}
+ versionStrs = append(versionStrs, "current")
modules := mctx.CreateVariations(versionStrs...)
for i, module := range modules {
- module.(*Module).compiler.(*stubDecorator).properties.ApiLevel = firstVersion + i
+ module.(*Module).compiler.(*stubDecorator).properties.ApiLevel = versionStrs[i]
}
}
@@ -188,7 +189,7 @@
ndkLibrarySuffix)
}
libName := strings.TrimSuffix(ctx.ModuleName(), ndkLibrarySuffix)
- fileBase := fmt.Sprintf("%s.%s.%d", libName, arch, c.properties.ApiLevel)
+ fileBase := fmt.Sprintf("%s.%s.%s", libName, arch, c.properties.ApiLevel)
stubSrcName := fileBase + ".c"
stubSrcPath := android.PathForModuleGen(ctx, stubSrcName)
versionScriptName := fileBase + ".map"
@@ -201,7 +202,7 @@
Input: symbolFilePath,
Args: map[string]string{
"arch": arch,
- "apiLevel": strconv.Itoa(c.properties.ApiLevel),
+ "apiLevel": c.properties.ApiLevel,
},
})
@@ -252,7 +253,7 @@
}
installDir := getNdkInstallBase(ctx).Join(ctx, fmt.Sprintf(
- "platforms/android-%d/arch-%s/usr/%s", apiLevel, arch, libDir))
+ "platforms/android-%s/arch-%s/usr/%s", apiLevel, arch, libDir))
stub.installPath = ctx.InstallFile(installDir, path).String()
}