Loading apex/apex_test.go +5 −0 Original line number Diff line number Diff line Loading @@ -6559,6 +6559,11 @@ func TestPrebuiltStubLibDep(t *testing.T) { if entry.mkEntries.EntryMap["LOCAL_NOT_AVAILABLE_FOR_PLATFORM"] != nil { t.Errorf("AndroidMk entry for \"stublib\" has LOCAL_NOT_AVAILABLE_FOR_PLATFORM set: %+v", entry.mkEntries) } cflags := entry.mkEntries.EntryMap["LOCAL_EXPORT_CFLAGS"] expected := "-D__STUBLIB_API__=1" if !android.InList(expected, cflags) { t.Errorf("LOCAL_EXPORT_CFLAGS expected to have %q, but got %q", expected, cflags) } } }) } Loading cc/library.go +9 −3 Original line number Diff line number Diff line Loading @@ -1237,9 +1237,7 @@ func (library *libraryDecorator) link(ctx ModuleContext, } // Add stub-related flags if this library is a stub library. if library.buildStubs() && !library.skipAPIDefine { library.reexportFlags("-D" + versioningMacroName(ctx.Module().(*Module).ImplementationModuleName(ctx)) + "=" + library.stubsVersion()) } library.exportVersioningMacroIfNeeded(ctx) // Propagate a Provider containing information about exported flags, deps, and include paths. library.flagExporter.setProvider(ctx) Loading @@ -1247,6 +1245,14 @@ func (library *libraryDecorator) link(ctx ModuleContext, return out } func (library *libraryDecorator) exportVersioningMacroIfNeeded(ctx android.BaseModuleContext) { if library.buildStubs() && !library.skipAPIDefine { name := versioningMacroName(ctx.Module().(*Module).ImplementationModuleName(ctx)) ver := library.stubsVersion() library.reexportFlags("-D" + name + "=" + ver) } } // buildStatic returns true if this library should be built as a static library. func (library *libraryDecorator) buildStatic() bool { return library.MutatedProperties.BuildStatic && Loading cc/prebuilt.go +8 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package cc import ( "android/soong/android" "path/filepath" "strings" ) func init() { Loading Loading @@ -117,6 +118,8 @@ func (p *prebuiltLibraryLinker) link(ctx ModuleContext, return nil } p.libraryDecorator.exportVersioningMacroIfNeeded(ctx) in := android.PathForModuleSrc(ctx, srcs[0]) if p.static() { Loading Loading @@ -226,6 +229,11 @@ func (p *prebuiltLibraryLinker) disablePrebuilt() { p.properties.Srcs = nil } // Implements versionedInterface func (p *prebuiltLibraryLinker) implementationModuleName(name string) string { return strings.TrimPrefix(name, "prebuilt_") } func NewPrebuiltLibrary(hod android.HostOrDeviceSupported) (*Module, *libraryDecorator) { module, library := NewLibrary(hod) module.compiler = nil Loading Loading
apex/apex_test.go +5 −0 Original line number Diff line number Diff line Loading @@ -6559,6 +6559,11 @@ func TestPrebuiltStubLibDep(t *testing.T) { if entry.mkEntries.EntryMap["LOCAL_NOT_AVAILABLE_FOR_PLATFORM"] != nil { t.Errorf("AndroidMk entry for \"stublib\" has LOCAL_NOT_AVAILABLE_FOR_PLATFORM set: %+v", entry.mkEntries) } cflags := entry.mkEntries.EntryMap["LOCAL_EXPORT_CFLAGS"] expected := "-D__STUBLIB_API__=1" if !android.InList(expected, cflags) { t.Errorf("LOCAL_EXPORT_CFLAGS expected to have %q, but got %q", expected, cflags) } } }) } Loading
cc/library.go +9 −3 Original line number Diff line number Diff line Loading @@ -1237,9 +1237,7 @@ func (library *libraryDecorator) link(ctx ModuleContext, } // Add stub-related flags if this library is a stub library. if library.buildStubs() && !library.skipAPIDefine { library.reexportFlags("-D" + versioningMacroName(ctx.Module().(*Module).ImplementationModuleName(ctx)) + "=" + library.stubsVersion()) } library.exportVersioningMacroIfNeeded(ctx) // Propagate a Provider containing information about exported flags, deps, and include paths. library.flagExporter.setProvider(ctx) Loading @@ -1247,6 +1245,14 @@ func (library *libraryDecorator) link(ctx ModuleContext, return out } func (library *libraryDecorator) exportVersioningMacroIfNeeded(ctx android.BaseModuleContext) { if library.buildStubs() && !library.skipAPIDefine { name := versioningMacroName(ctx.Module().(*Module).ImplementationModuleName(ctx)) ver := library.stubsVersion() library.reexportFlags("-D" + name + "=" + ver) } } // buildStatic returns true if this library should be built as a static library. func (library *libraryDecorator) buildStatic() bool { return library.MutatedProperties.BuildStatic && Loading
cc/prebuilt.go +8 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package cc import ( "android/soong/android" "path/filepath" "strings" ) func init() { Loading Loading @@ -117,6 +118,8 @@ func (p *prebuiltLibraryLinker) link(ctx ModuleContext, return nil } p.libraryDecorator.exportVersioningMacroIfNeeded(ctx) in := android.PathForModuleSrc(ctx, srcs[0]) if p.static() { Loading Loading @@ -226,6 +229,11 @@ func (p *prebuiltLibraryLinker) disablePrebuilt() { p.properties.Srcs = nil } // Implements versionedInterface func (p *prebuiltLibraryLinker) implementationModuleName(name string) string { return strings.TrimPrefix(name, "prebuilt_") } func NewPrebuiltLibrary(hod android.HostOrDeviceSupported) (*Module, *libraryDecorator) { module, library := NewLibrary(hod) module.compiler = nil Loading