aboutsummaryrefslogtreecommitdiffstats
path: root/cc/ndk_library.go
diff options
context:
space:
mode:
authorDan Willemsen <dwillemsen@google.com>2017-04-07 15:21:13 -0700
committerSteven Moreland <smoreland@google.com>2017-04-11 15:14:11 +0000
commit01a90597bcab97c4dace82a13a32da76875883cb (patch)
tree383c3dc3d2f3478a6ac8857d737914801f3fe467 /cc/ndk_library.go
parent2ce95652a867ca3613e54a28b4c3b6ad6278b8aa (diff)
downloadbuild_soong-01a90597bcab97c4dace82a13a32da76875883cb.tar.gz
build_soong-01a90597bcab97c4dace82a13a32da76875883cb.tar.bz2
build_soong-01a90597bcab97c4dace82a13a32da76875883cb.zip
Remove explicit suffixes from (ll)ndk_library
Soong can rename these automatically for internal use, so don't require users to set these. Bug: 33241851 Test: Android-aosp_arm.mk is the same before/after Test: build.ninja is the same before/after Test: build-aosp_arm.ninja is the same before/after Merged-In: Ia92356a0ec079f908fd49812231228046783e50d Change-Id: Ia92356a0ec079f908fd49812231228046783e50d
Diffstat (limited to 'cc/ndk_library.go')
-rw-r--r--cc/ndk_library.go24
1 files changed, 11 insertions, 13 deletions
diff --git a/cc/ndk_library.go b/cc/ndk_library.go
index 75785f9f..f5499dd1 100644
--- a/cc/ndk_library.go
+++ b/cc/ndk_library.go
@@ -65,15 +65,10 @@ var (
// Creates a stub shared library based on the provided version file.
//
-// The name of the generated file will be based on the module name by stripping
-// the ".ndk" suffix from the module name. Module names must end with ".ndk"
-// (as a convention to allow soong to guess the NDK name of a dependency when
-// needed). "libfoo.ndk" will generate "libfoo.so.
-//
// Example:
//
// ndk_library {
-// name: "libfoo.ndk",
+// name: "libfoo",
// symbol_file: "libfoo.map.txt",
// first_version: "9",
// }
@@ -230,7 +225,11 @@ func ndkApiMutator(mctx android.BottomUpMutatorContext) {
func (c *stubDecorator) compilerInit(ctx BaseModuleContext) {
c.baseCompiler.compilerInit(ctx)
- name := strings.TrimSuffix(ctx.ModuleName(), ".ndk")
+ name := ctx.baseModuleName()
+ if strings.HasSuffix(name, ndkLibrarySuffix) {
+ ctx.PropertyErrorf("name", "Do not append %q manually, just use the base name", ndkLibrarySuffix)
+ }
+
ndkMigratedLibsLock.Lock()
defer ndkMigratedLibsLock.Unlock()
for _, lib := range ndkMigratedLibs {
@@ -276,10 +275,6 @@ func compileStubLibrary(ctx ModuleContext, flags Flags, symbolFile, apiLevel, vn
}
func (c *stubDecorator) compile(ctx ModuleContext, flags Flags, deps PathDeps) Objects {
- if !strings.HasSuffix(ctx.ModuleName(), ndkLibrarySuffix) {
- ctx.ModuleErrorf("ndk_library modules names must be suffixed with %q\n",
- ndkLibrarySuffix)
- }
objs, versionScript := compileStubLibrary(ctx, flags, c.properties.Symbol_file, c.properties.ApiLevel, "")
c.versionScriptPath = versionScript
return objs
@@ -289,9 +284,12 @@ func (linker *stubDecorator) linkerDeps(ctx DepsContext, deps Deps) Deps {
return Deps{}
}
+func (linker *stubDecorator) Name(name string) string {
+ return name + ndkLibrarySuffix
+}
+
func (stub *stubDecorator) linkerFlags(ctx ModuleContext, flags Flags) Flags {
- stub.libraryDecorator.libName = strings.TrimSuffix(ctx.ModuleName(),
- ndkLibrarySuffix)
+ stub.libraryDecorator.libName = ctx.baseModuleName()
return stub.libraryDecorator.linkerFlags(ctx, flags)
}