Fix: duplicated definition of llndk_headers module

A llndk_headers module was double defined; one as a header lib and the
other as a static lib. Since llndk_headers is a header lib, the static
lib is now deleted.

Bug: 70617292
Test: build. (TestLlndkHeaders added)
Change-Id: I1a3e9d1a73616ea4faf03664a7a4b03bd5955629
This commit is contained in:
Jiyong Park 2017-12-14 19:54:34 +09:00
parent 7dd8778e48
commit a46a4d5a13
3 changed files with 33 additions and 2 deletions

View file

@ -1422,7 +1422,9 @@ func vendorMutator(mctx android.BottomUpMutatorContext) {
mctx.CreateVariations(vendorMode) mctx.CreateVariations(vendorMode)
} else if _, ok := m.linker.(*llndkHeadersDecorator); ok { } else if _, ok := m.linker.(*llndkHeadersDecorator); ok {
// ... and LL-NDK headers as well // ... and LL-NDK headers as well
mctx.CreateVariations(vendorMode) mod := mctx.CreateVariations(vendorMode)
vendor := mod[0].(*Module)
vendor.Properties.UseVndk = true
} else if _, ok := m.linker.(*vndkPrebuiltLibraryDecorator); ok { } else if _, ok := m.linker.(*vndkPrebuiltLibraryDecorator); ok {
// Make vendor variants only for the versions in BOARD_VNDK_VERSION and // Make vendor variants only for the versions in BOARD_VNDK_VERSION and
// PRODUCT_EXTRA_VNDK_VERSIONS. // PRODUCT_EXTRA_VNDK_VERSIONS.

View file

@ -61,6 +61,7 @@ func testCc(t *testing.T, bp string) *android.TestContext {
ctx.RegisterModuleType("cc_library_shared", android.ModuleFactoryAdaptor(LibrarySharedFactory)) ctx.RegisterModuleType("cc_library_shared", android.ModuleFactoryAdaptor(LibrarySharedFactory))
ctx.RegisterModuleType("toolchain_library", android.ModuleFactoryAdaptor(toolchainLibraryFactory)) ctx.RegisterModuleType("toolchain_library", android.ModuleFactoryAdaptor(toolchainLibraryFactory))
ctx.RegisterModuleType("llndk_library", android.ModuleFactoryAdaptor(llndkLibraryFactory)) ctx.RegisterModuleType("llndk_library", android.ModuleFactoryAdaptor(llndkLibraryFactory))
ctx.RegisterModuleType("llndk_headers", android.ModuleFactoryAdaptor(llndkHeadersFactory))
ctx.RegisterModuleType("cc_object", android.ModuleFactoryAdaptor(objectFactory)) ctx.RegisterModuleType("cc_object", android.ModuleFactoryAdaptor(objectFactory))
ctx.RegisterModuleType("filegroup", android.ModuleFactoryAdaptor(genrule.FileGroupFactory)) ctx.RegisterModuleType("filegroup", android.ModuleFactoryAdaptor(genrule.FileGroupFactory))
ctx.PreDepsMutators(func(ctx android.RegisterMutatorsContext) { ctx.PreDepsMutators(func(ctx android.RegisterMutatorsContext) {
@ -138,6 +139,7 @@ func testCc(t *testing.T, bp string) *android.TestContext {
"bar.c": nil, "bar.c": nil,
"a.proto": nil, "a.proto": nil,
"b.aidl": nil, "b.aidl": nil,
"my_include": nil,
}) })
_, errs := ctx.ParseFileList(".", []string{"Android.bp"}) _, errs := ctx.ParseFileList(".", []string{"Android.bp"})
@ -583,6 +585,34 @@ func TestStaticLibDepReorderingWithShared(t *testing.T) {
} }
} }
func TestLlndkHeaders(t *testing.T) {
ctx := testCc(t, `
llndk_headers {
name: "libllndk_headers",
export_include_dirs: ["my_include"],
}
llndk_library {
name: "libllndk",
export_llndk_headers: ["libllndk_headers"],
}
cc_library {
name: "libvendor",
shared_libs: ["libllndk"],
vendor: true,
srcs: ["foo.c"],
no_libgcc : true,
nocrt : true,
}
`)
// _static variant is used since _shared reuses *.o from the static variant
cc := ctx.ModuleForTests("libvendor", "android_arm_armv7-a-neon_vendor_static").Rule("cc")
cflags := cc.Args["cFlags"]
if !strings.Contains(cflags, "-Imy_include") {
t.Errorf("cflags for libvendor must contain -Imy_include, but was %#v.", cflags)
}
}
var compilerFlagsTestCases = []struct { var compilerFlagsTestCases = []struct {
in string in string
out bool out bool

View file

@ -191,7 +191,6 @@ func (headers *llndkHeadersDecorator) Name(name string) string {
func llndkHeadersFactory() android.Module { func llndkHeadersFactory() android.Module {
module, library := NewLibrary(android.DeviceSupported) module, library := NewLibrary(android.DeviceSupported)
library.HeaderOnly() library.HeaderOnly()
library.setStatic()
decorator := &llndkHeadersDecorator{ decorator := &llndkHeadersDecorator{
libraryDecorator: library, libraryDecorator: library,