Support prebuilt shared libs end with versions

This commit changes how `cc/androidmk.go` generates LOCAL_MODULE_STEM,
LOCAL_MODULE_SUFFIX, and LOCAL_BUILT_MODULE_STEM.  Now, `splitFileExt()`
takes a file name and a list of expected file extensions.
`splitFileExt()` searches the first occurrence of expected file
extensions in the file name.  If it can not find any, it will simply
return the last file extension.

Before this commit, `cc/androidmk.go` simply extracts the last file
extension (e.g. `.so`).  However, if the prebuilt shared libs end with
version numbers (e.g. `libc++.so.1`), it will use `$(LOCAL_MODULE).1` as
LOCAL_BUILT_MODULE_STEM and this will lead to missing target ninja
error.

Bug: 111579848
Test: Build a program that links libc++_host (from prebuilts/clang)
Change-Id: Id96726c69705d518ea725bb6abd8ff4527ca0cbc
This commit is contained in:
Logan Chien
2018-07-26 00:19:50 +08:00
parent 7a127f97b6
commit 031d2b32e3
4 changed files with 112 additions and 11 deletions

View File

@@ -174,6 +174,7 @@ bootstrap_go_package {
"cc/gen_test.go",
"cc/library_test.go",
"cc/test_data_test.go",
"cc/util_test.go",
],
pluginFor: ["soong_build"],
}