androidbp: Optimize cc_library builds, share static lib
If the cflags are identical, and there aren't extra sources in the static version of a cc_library, then we can re-use the static library in the build of the shared library. Change-Id: I54c59aa3edcc47bc777132461b8e6a84cef0587e
This commit is contained in:
@@ -76,13 +76,17 @@ var moduleTestCases = []struct {
|
||||
},
|
||||
// Static and Shared
|
||||
{
|
||||
blueprint: `cc_library { name: "test", }`,
|
||||
blueprint: `cc_library { name: "test", srcs: ["a"], }`,
|
||||
androidmk: `include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := test
|
||||
LOCAL_WHOLE_STATIC_LIBRARIES := \
|
||||
test
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := test
|
||||
LOCAL_SRC_FILES := \
|
||||
a
|
||||
include $(BUILD_STATIC_LIBRARY)`,
|
||||
},
|
||||
// Static and Shared / Target and Host
|
||||
@@ -90,6 +94,8 @@ var moduleTestCases = []struct {
|
||||
blueprint: `cc_library { name: "test", host_supported: true, }`,
|
||||
androidmk: `include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := test
|
||||
LOCAL_WHOLE_STATIC_LIBRARIES := \
|
||||
test
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
@@ -98,6 +104,8 @@ var moduleTestCases = []struct {
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := test
|
||||
LOCAL_WHOLE_STATIC_LIBRARIES := \
|
||||
test
|
||||
include $(BUILD_HOST_SHARED_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
@@ -131,6 +139,27 @@ var moduleTestCases = []struct {
|
||||
l
|
||||
include $(BUILD_STATIC_LIBRARY)`,
|
||||
},
|
||||
// Static and Shared properties, use whole static lib, but add extra shared srcs
|
||||
{
|
||||
blueprint: `cc_library {
|
||||
name: "test",
|
||||
srcs: ["a"],
|
||||
shared: { srcs: ["b"], },
|
||||
}`,
|
||||
androidmk: `include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := test
|
||||
LOCAL_WHOLE_STATIC_LIBRARIES := \
|
||||
test
|
||||
LOCAL_SRC_FILES := \
|
||||
b
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := test
|
||||
LOCAL_SRC_FILES := \
|
||||
a
|
||||
include $(BUILD_STATIC_LIBRARY)`,
|
||||
},
|
||||
// Manual translation
|
||||
{
|
||||
blueprint: `/* Android.mk:start
|
||||
|
Reference in New Issue
Block a user