diff options
author | TreeHugger Robot <treehugger-gerrit@google.com> | 2017-04-11 07:22:19 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2017-04-11 07:22:26 +0000 |
commit | 316f26c081617c15e5d15147b32a5c61417c4c34 (patch) | |
tree | be20cd74f7058f66e3055e7dd7834a7088985ca7 /cc | |
parent | 12b3117e2bd881e4f5996f6ef8016454174d325e (diff) | |
parent | 8ecfbadcc3fb1d1bd29a36e4e9dd6417399adaf3 (diff) | |
download | build_soong-316f26c081617c15e5d15147b32a5c61417c4c34.tar.gz build_soong-316f26c081617c15e5d15147b32a5c61417c4c34.tar.bz2 build_soong-316f26c081617c15e5d15147b32a5c61417c4c34.zip |
Merge "Remove explicit suffixes from (ll)ndk_library" into oc-dev
Diffstat (limited to 'cc')
-rw-r--r-- | cc/androidmk.go | 3 | ||||
-rw-r--r-- | cc/cc.go | 4 | ||||
-rw-r--r-- | cc/llndk_library.go | 15 | ||||
-rw-r--r-- | cc/ndk_library.go | 24 |
4 files changed, 21 insertions, 25 deletions
diff --git a/cc/androidmk.go b/cc/androidmk.go index b0313231..cb408972 100644 --- a/cc/androidmk.go +++ b/cc/androidmk.go @@ -279,7 +279,7 @@ func (installer *baseInstaller) AndroidMk(ctx AndroidMkContext, ret *android.And } func (c *stubDecorator) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkData) { - ret.SubName = "." + c.properties.ApiLevel + ret.SubName = ndkLibrarySuffix + "." + c.properties.ApiLevel ret.Class = "SHARED_LIBRARIES" ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) error { @@ -301,6 +301,7 @@ func (c *stubDecorator) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkDa func (c *llndkStubDecorator) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkData) { ret.Class = "SHARED_LIBRARIES" + ret.SubName = llndkLibrarySuffix ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) error { c.libraryDecorator.androidMkWriteExportedFlags(w) @@ -430,7 +430,9 @@ func (c *Module) Prebuilt() *android.Prebuilt { func (c *Module) Name() string { name := c.ModuleBase.Name() - if p, ok := c.linker.(prebuiltLinkerInterface); ok { + if p, ok := c.linker.(interface { + Name(string) string + }); ok { name = p.Name(name) } return name diff --git a/cc/llndk_library.go b/cc/llndk_library.go index 60efc57c..cde1bc79 100644 --- a/cc/llndk_library.go +++ b/cc/llndk_library.go @@ -29,15 +29,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 ".llndk" suffix from the module name. Module names must end with ".llndk" -// (as a convention to allow soong to guess the LL-NDK name of a dependency when -// needed). "libfoo.llndk" will generate "libfoo.so". -// // Example: // // llndk_library { -// name: "libfoo.llndk", +// name: "libfoo", // symbol_file: "libfoo.map.txt", // export_include_dirs: ["include_vndk"], // } @@ -69,10 +64,6 @@ type llndkStubDecorator struct { } func (stub *llndkStubDecorator) compile(ctx ModuleContext, flags Flags, deps PathDeps) Objects { - if !strings.HasSuffix(ctx.ModuleName(), llndkLibrarySuffix) { - ctx.ModuleErrorf("llndk_library modules names must be suffixed with %q\n", - llndkLibrarySuffix) - } objs, versionScript := compileStubLibrary(ctx, flags, stub.Properties.Symbol_file, "current", "--vndk") stub.versionScriptPath = versionScript return objs @@ -82,6 +73,10 @@ func (stub *llndkStubDecorator) linkerDeps(ctx DepsContext, deps Deps) Deps { return Deps{} } +func (stub *llndkStubDecorator) Name(name string) string { + return name + llndkLibrarySuffix +} + func (stub *llndkStubDecorator) linkerFlags(ctx ModuleContext, flags Flags) Flags { stub.libraryDecorator.libName = strings.TrimSuffix(ctx.ModuleName(), llndkLibrarySuffix) diff --git a/cc/ndk_library.go b/cc/ndk_library.go index 299ffa19..84fc60dc 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", // } @@ -226,7 +221,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 { @@ -272,10 +271,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 @@ -285,9 +280,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) } |