Support sdk_version: "current"
for the NDK.
We need to fall back to the old CRT objects since we aren't generating those yet. Test: Created a test module using "current", checked that it linked the libs from current. Bug: None Change-Id: I5fe170d7b26154da8877672ac2acb7da0262fe38
This commit is contained in:
parent
90f7a4dcab
commit
ebedf678de
3 changed files with 28 additions and 7 deletions
17
cc/binary.go
17
cc/binary.go
|
@ -101,15 +101,24 @@ func (binary *binaryDecorator) linkerDeps(ctx BaseModuleContext, deps Deps) Deps
|
||||||
}
|
}
|
||||||
deps.CrtEnd = "crtend_android"
|
deps.CrtEnd = "crtend_android"
|
||||||
} else {
|
} else {
|
||||||
|
// TODO(danalbert): Add generation of crt objects.
|
||||||
|
// For `sdk_version: "current"`, we don't actually have a
|
||||||
|
// freshly generated set of CRT objects. Use the last stable
|
||||||
|
// version.
|
||||||
|
version := ctx.sdkVersion()
|
||||||
|
if version == "current" {
|
||||||
|
version = ctx.AConfig().PlatformSdkVersion()
|
||||||
|
}
|
||||||
|
|
||||||
if binary.static() {
|
if binary.static() {
|
||||||
deps.CrtBegin = "ndk_crtbegin_static." + ctx.sdkVersion()
|
deps.CrtBegin = "ndk_crtbegin_static." + version
|
||||||
} else {
|
} else {
|
||||||
if binary.static() {
|
if binary.static() {
|
||||||
deps.CrtBegin = "ndk_crtbegin_static." + ctx.sdkVersion()
|
deps.CrtBegin = "ndk_crtbegin_static." + version
|
||||||
} else {
|
} else {
|
||||||
deps.CrtBegin = "ndk_crtbegin_dynamic." + ctx.sdkVersion()
|
deps.CrtBegin = "ndk_crtbegin_dynamic." + version
|
||||||
}
|
}
|
||||||
deps.CrtEnd = "ndk_crtend_android." + ctx.sdkVersion()
|
deps.CrtEnd = "ndk_crtend_android." + version
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -183,8 +183,12 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags) Flag
|
||||||
// Traditionally this has come from android/api-level.h, but with the
|
// Traditionally this has come from android/api-level.h, but with the
|
||||||
// libc headers unified it must be set by the build system since we
|
// libc headers unified it must be set by the build system since we
|
||||||
// don't have per-API level copies of that header now.
|
// don't have per-API level copies of that header now.
|
||||||
|
version := ctx.sdkVersion()
|
||||||
|
if version == "current" {
|
||||||
|
version = "__ANDROID_API_FUTURE__"
|
||||||
|
}
|
||||||
flags.GlobalFlags = append(flags.GlobalFlags,
|
flags.GlobalFlags = append(flags.GlobalFlags,
|
||||||
"-D__ANDROID_API__="+ctx.sdkVersion())
|
"-D__ANDROID_API__="+version)
|
||||||
|
|
||||||
// Until the full NDK has been migrated to using ndk_headers, we still
|
// Until the full NDK has been migrated to using ndk_headers, we still
|
||||||
// need to add the legacy sysroot includes to get the full set of
|
// need to add the legacy sysroot includes to get the full set of
|
||||||
|
|
|
@ -335,8 +335,16 @@ func (library *libraryDecorator) linkerDeps(ctx BaseModuleContext, deps Deps) De
|
||||||
deps.CrtBegin = "crtbegin_so"
|
deps.CrtBegin = "crtbegin_so"
|
||||||
deps.CrtEnd = "crtend_so"
|
deps.CrtEnd = "crtend_so"
|
||||||
} else {
|
} else {
|
||||||
deps.CrtBegin = "ndk_crtbegin_so." + ctx.sdkVersion()
|
// TODO(danalbert): Add generation of crt objects.
|
||||||
deps.CrtEnd = "ndk_crtend_so." + ctx.sdkVersion()
|
// For `sdk_version: "current"`, we don't actually have a
|
||||||
|
// freshly generated set of CRT objects. Use the last stable
|
||||||
|
// version.
|
||||||
|
version := ctx.sdkVersion()
|
||||||
|
if version == "current" {
|
||||||
|
version = ctx.AConfig().PlatformSdkVersion()
|
||||||
|
}
|
||||||
|
deps.CrtBegin = "ndk_crtbegin_so." + version
|
||||||
|
deps.CrtEnd = "ndk_crtend_so." + version
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
deps.WholeStaticLibs = append(deps.WholeStaticLibs, library.Properties.Shared.Whole_static_libs...)
|
deps.WholeStaticLibs = append(deps.WholeStaticLibs, library.Properties.Shared.Whole_static_libs...)
|
||||||
|
|
Loading…
Reference in a new issue