android_app stl property bug fix

When it is set to c++_shared, the added dependency should be
libc++_shared, not libc++.

Fixes: 130891985
Test: app_test.go, atest 'CtsNdkBinderTestCases' w/ conversion CL
Change-Id: I0e50e0d5bf511aa6e52d16cd715a185721011255
This commit is contained in:
Jaewoong Jung 2019-06-04 11:53:47 -07:00
parent 22d3d6ba5c
commit 710756a6ff
4 changed files with 11 additions and 4 deletions

View File

@ -25,7 +25,7 @@ import (
func init() {
android.RegisterModuleType("ndk_prebuilt_object", ndkPrebuiltObjectFactory)
android.RegisterModuleType("ndk_prebuilt_static_stl", ndkPrebuiltStaticStlFactory)
android.RegisterModuleType("ndk_prebuilt_shared_stl", ndkPrebuiltSharedStlFactory)
android.RegisterModuleType("ndk_prebuilt_shared_stl", NdkPrebuiltSharedStlFactory)
}
// NDK prebuilt libraries.
@ -107,7 +107,7 @@ func (*ndkPrebuiltStlLinker) linkerDeps(ctx DepsContext, deps Deps) Deps {
// library (stl) library for linking operation. The soong's module name format
// is ndk_<NAME>.so where the library is located under
// ./prebuilts/ndk/current/sources/cxx-stl/llvm-libc++/libs/$(HOST_ARCH)/<NAME>.so.
func ndkPrebuiltSharedStlFactory() android.Module {
func NdkPrebuiltSharedStlFactory() android.Module {
module, library := NewLibrary(android.DeviceSupported)
library.BuildOnlyShared()
module.compiler = nil

View File

@ -175,7 +175,7 @@ func (a *AndroidApp) DepsMutator(ctx android.BottomUpMutatorContext) {
ctx.AddFarVariationDependencies(variation, tag, a.appProperties.Jni_libs...)
if String(a.appProperties.Stl) == "c++_shared" {
if embedJni {
ctx.AddFarVariationDependencies(variation, tag, "libc++")
ctx.AddFarVariationDependencies(variation, tag, "ndk_libc++_shared")
}
}
}

View File

@ -1199,6 +1199,10 @@ func TestStl(t *testing.T) {
compile_multilib: "both",
sdk_version: "current",
}
ndk_prebuilt_shared_stl {
name: "ndk_libc++_shared",
}
`)
testCases := []struct {
@ -1208,7 +1212,7 @@ func TestStl(t *testing.T) {
{"stl",
[]string{
"libjni.so",
"libc++.so",
"libc++_shared.so",
},
},
{"system",

View File

@ -105,6 +105,7 @@ func testContext(config android.Config, bp string,
ctx.RegisterModuleType("cc_object", android.ModuleFactoryAdaptor(cc.ObjectFactory))
ctx.RegisterModuleType("toolchain_library", android.ModuleFactoryAdaptor(cc.ToolchainLibraryFactory))
ctx.RegisterModuleType("llndk_library", android.ModuleFactoryAdaptor(cc.LlndkLibraryFactory))
ctx.RegisterModuleType("ndk_prebuilt_shared_stl", android.ModuleFactoryAdaptor(cc.NdkPrebuiltSharedStlFactory))
ctx.PreDepsMutators(func(ctx android.RegisterMutatorsContext) {
ctx.BottomUp("link", cc.LinkageMutator).Parallel()
ctx.BottomUp("begin", cc.BeginMutator).Parallel()
@ -134,6 +135,8 @@ func testContext(config android.Config, bp string,
"api/test-removed.txt": nil,
"framework/aidl/a.aidl": nil,
"prebuilts/ndk/current/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libc++_shared.so": nil,
"prebuilts/sdk/14/public/android.jar": nil,
"prebuilts/sdk/14/public/framework.aidl": nil,
"prebuilts/sdk/14/system/android.jar": nil,