Work-around for crt objects with sdk: current

Test: convert libcups from Android.mk->Android.bp, mm -j64.

Change-Id: I4fddcfa5806d0ce27a229c37a078b0d93e9082a8
This commit is contained in:
Jayant Chowdhary
2017-05-09 10:21:52 -07:00
parent 9707116867
commit 6e8115acb1
4 changed files with 11 additions and 2 deletions

View File

@@ -122,7 +122,7 @@ func (binary *binaryDecorator) linkerDeps(ctx DepsContext, deps Deps) Deps {
// version.
version := ctx.sdkVersion()
if version == "current" {
version = ctx.AConfig().PlatformSdkVersion()
version = getCurrentNdkPrebuiltVersion(ctx)
}
if binary.static() {

View File

@@ -1193,4 +1193,11 @@ func lastUniqueElements(list []string) []string {
return list[totalSkip:]
}
func getCurrentNdkPrebuiltVersion(ctx DepsContext) string {
if ctx.AConfig().PlatformSdkVersionInt() > config.NdkMaxPrebuiltVersionInt {
return strconv.Itoa(config.NdkMaxPrebuiltVersionInt)
}
return ctx.AConfig().PlatformSdkVersion()
}
var Bool = proptools.Bool

View File

@@ -71,6 +71,8 @@ var (
GccCppStdVersion = "gnu++11"
ExperimentalCStdVersion = "gnu11"
ExperimentalCppStdVersion = "gnu++1z"
NdkMaxPrebuiltVersionInt = 24
)
var pctx = android.NewPackageContext("android/soong/cc/config")

View File

@@ -424,7 +424,7 @@ func (library *libraryDecorator) linkerDeps(ctx DepsContext, deps Deps) Deps {
// version.
version := ctx.sdkVersion()
if version == "current" {
version = ctx.AConfig().PlatformSdkVersion()
version = getCurrentNdkPrebuiltVersion(ctx)
}
deps.CrtBegin = "ndk_crtbegin_so." + version
deps.CrtEnd = "ndk_crtend_so." + version