Incorporate cc_library_shared into mixed builds am: bc4e734e59
am: 5ce0135bd8
am: f4718aefa7
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1826912 Change-Id: I0879a59133f3491272ad262d280c33e1f801da40
This commit is contained in:
committed by
Automerger Merge Worker
commit
406877788f
@@ -370,6 +370,7 @@ func LibrarySharedFactory() android.Module {
|
||||
module, library := NewLibrary(android.HostAndDeviceSupported)
|
||||
library.BuildOnlyShared()
|
||||
module.sdkMemberTypes = []android.SdkMemberType{sharedLibrarySdkMemberType}
|
||||
module.bazelHandler = &ccLibraryBazelHandler{module: module}
|
||||
return module.Init()
|
||||
}
|
||||
|
||||
|
@@ -320,3 +320,38 @@ func TestLibraryDynamicList(t *testing.T) {
|
||||
libfoo.Args["ldFlags"], "-Wl,--dynamic-list,foo.dynamic.txt")
|
||||
|
||||
}
|
||||
|
||||
func TestCcLibrarySharedWithBazel(t *testing.T) {
|
||||
bp := `
|
||||
cc_library_shared {
|
||||
name: "foo",
|
||||
srcs: ["foo.cc"],
|
||||
bazel_module: { label: "//foo/bar:bar" },
|
||||
}`
|
||||
config := TestConfig(t.TempDir(), android.Android, nil, bp, nil)
|
||||
config.BazelContext = android.MockBazelContext{
|
||||
OutputBaseDir: "outputbase",
|
||||
LabelToCcInfo: map[string]cquery.CcInfo{
|
||||
"//foo/bar:bar": cquery.CcInfo{
|
||||
CcObjectFiles: []string{"foo.o"},
|
||||
Includes: []string{"include"},
|
||||
SystemIncludes: []string{"system_include"},
|
||||
RootDynamicLibraries: []string{"foo.so"},
|
||||
},
|
||||
},
|
||||
}
|
||||
ctx := testCcWithConfig(t, config)
|
||||
|
||||
sharedFoo := ctx.ModuleForTests("foo", "android_arm_armv7-a-neon_shared").Module()
|
||||
outputFiles, err := sharedFoo.(android.OutputFileProducer).OutputFiles("")
|
||||
if err != nil {
|
||||
t.Errorf("Unexpected error getting cc_object outputfiles %s", err)
|
||||
}
|
||||
expectedOutputFiles := []string{"outputbase/execroot/__main__/foo.so"}
|
||||
android.AssertDeepEquals(t, "output files", expectedOutputFiles, outputFiles.Strings())
|
||||
|
||||
entries := android.AndroidMkEntriesForTest(t, ctx, sharedFoo)[0]
|
||||
expectedFlags := []string{"-Ioutputbase/execroot/__main__/include", "-isystem outputbase/execroot/__main__/system_include"}
|
||||
gotFlags := entries.EntryMap["LOCAL_EXPORT_CFLAGS"]
|
||||
android.AssertDeepEquals(t, "androidmk exported cflags", expectedFlags, gotFlags)
|
||||
}
|
||||
|
Reference in New Issue
Block a user