Simplify the *-lib-* functions
Simplify the java-lib-* type functions, three layers of abstraction is a bit much for a single line function, and isn't reducing enough duplication to be worth the complexity. Add app-lib-* functions and use them. Test: m -j checkbuild Change-Id: Ia47ebc95e4af2073396233416f14fdee7d856844
This commit is contained in:
@@ -671,25 +671,12 @@ endef
|
|||||||
## $(2): Non-empty if IS_HOST_MODULE
|
## $(2): Non-empty if IS_HOST_MODULE
|
||||||
###########################################################
|
###########################################################
|
||||||
|
|
||||||
# $(1): library name
|
|
||||||
# $(2): Non-empty if IS_HOST_MODULE
|
|
||||||
define _java-lib-dir
|
|
||||||
$(call intermediates-dir-for, \
|
|
||||||
JAVA_LIBRARIES,$(1),$(2),COMMON)
|
|
||||||
endef
|
|
||||||
|
|
||||||
# $(1): library name
|
|
||||||
# $(2): Non-empty if IS_HOST_MODULE
|
|
||||||
define _java-lib-full-classes.jar
|
|
||||||
$(call _java-lib-dir,$(1),$(2))/classes.jar
|
|
||||||
endef
|
|
||||||
|
|
||||||
# Get the jar files (you can pass to "javac -classpath") of static or shared
|
# Get the jar files (you can pass to "javac -classpath") of static or shared
|
||||||
# Java libraries that you want to link against.
|
# Java libraries that you want to link against.
|
||||||
# $(1): library name list
|
# $(1): library name list
|
||||||
# $(2): Non-empty if IS_HOST_MODULE
|
# $(2): Non-empty if IS_HOST_MODULE
|
||||||
define java-lib-files
|
define java-lib-files
|
||||||
$(foreach lib,$(1),$(call _java-lib-full-classes.jar,$(lib),$(2)))
|
$(foreach lib,$(1),$(call intermediates-dir-for,JAVA_LIBRARIES,$(lib),$(2),COMMON)/classes.jar)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
# Get the header jar files (you can pass to "javac -classpath") of static or shared
|
# Get the header jar files (you can pass to "javac -classpath") of static or shared
|
||||||
@@ -712,6 +699,19 @@ define java-lib-deps
|
|||||||
$(call java-lib-files,$(1),$(2))
|
$(call java-lib-files,$(1),$(2))
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
# Get the jar files (you can pass to "javac -classpath") of static or shared
|
||||||
|
# APK libraries that you want to link against.
|
||||||
|
# $(1): library name list
|
||||||
|
define app-lib-files
|
||||||
|
$(foreach lib,$(1),$(call intermediates-dir-for,APPS,$(lib),,COMMON)/classes.jar)
|
||||||
|
endef
|
||||||
|
|
||||||
|
# Get the header jar files (you can pass to "javac -classpath") of static or shared
|
||||||
|
# APK libraries that you want to link against.
|
||||||
|
# $(1): library name list
|
||||||
|
define app-lib-header-files
|
||||||
|
$(foreach lib,$(1),$(call intermediates-dir-for,APPS,$(lib),,COMMON)/classes-header.jar)
|
||||||
|
endef
|
||||||
|
|
||||||
###########################################################
|
###########################################################
|
||||||
## Convert "core ext framework" to "out/.../classes.jack ..."
|
## Convert "core ext framework" to "out/.../classes.jack ..."
|
||||||
@@ -719,16 +719,10 @@ endef
|
|||||||
## $(2): Non-empty if IS_HOST_MODULE
|
## $(2): Non-empty if IS_HOST_MODULE
|
||||||
###########################################################
|
###########################################################
|
||||||
|
|
||||||
# $(1): library name
|
|
||||||
# $(2): Non-empty if IS_HOST_MODULE
|
|
||||||
define _jack-lib-full-classes
|
|
||||||
$(call _java-lib-dir,$(1),$(2))/classes.jack
|
|
||||||
endef
|
|
||||||
|
|
||||||
# $(1): library name list
|
# $(1): library name list
|
||||||
# $(2): Non-empty if IS_HOST_MODULE
|
# $(2): Non-empty if IS_HOST_MODULE
|
||||||
define jack-lib-files
|
define jack-lib-files
|
||||||
$(foreach lib,$(1),$(call _jack-lib-full-classes,$(lib),$(2)))
|
$(foreach lib,$(1),$(call intermediates-dir-for,JAVA_LIBRARIES,$(lib),$(2),COMMON)/classes.jack)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
###########################################################
|
###########################################################
|
||||||
|
@@ -174,15 +174,8 @@ ifdef LOCAL_ANNOTATION_PROCESSORS
|
|||||||
annotation_processor_jars :=
|
annotation_processor_jars :=
|
||||||
endif
|
endif
|
||||||
|
|
||||||
full_static_java_libs := \
|
full_static_java_libs := $(call java-lib-files,$(LOCAL_STATIC_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
|
||||||
$(foreach lib,$(LOCAL_STATIC_JAVA_LIBRARIES), \
|
full_static_java_header_libs := $(call java-lib-header-files,$(LOCAL_STATIC_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
|
||||||
$(call intermediates-dir-for, \
|
|
||||||
JAVA_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE),COMMON)/classes.jar)
|
|
||||||
|
|
||||||
full_static_java_header_libs := \
|
|
||||||
$(foreach lib,$(LOCAL_STATIC_JAVA_LIBRARIES), \
|
|
||||||
$(call intermediates-dir-for, \
|
|
||||||
JAVA_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE),COMMON)/classes-header.jar)
|
|
||||||
|
|
||||||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_STATIC_JAVA_LIBRARIES := $(full_static_java_libs)
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_STATIC_JAVA_LIBRARIES := $(full_static_java_libs)
|
||||||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_STATIC_JAVA_HEADER_LIBRARIES := $(full_static_java_header_libs)
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_STATIC_JAVA_HEADER_LIBRARIES := $(full_static_java_header_libs)
|
||||||
@@ -284,14 +277,8 @@ ifndef LOCAL_IS_HOST_MODULE
|
|||||||
# shared libraries, allowing them to make use of the code in the linked apk.
|
# shared libraries, allowing them to make use of the code in the linked apk.
|
||||||
apk_libraries := $(sort $(LOCAL_APK_LIBRARIES) $(LOCAL_RES_LIBRARIES))
|
apk_libraries := $(sort $(LOCAL_APK_LIBRARIES) $(LOCAL_RES_LIBRARIES))
|
||||||
ifneq ($(apk_libraries),)
|
ifneq ($(apk_libraries),)
|
||||||
link_apk_libraries := \
|
link_apk_libraries := $(call app-lib-files,$(apk_libraries))
|
||||||
$(foreach lib,$(apk_libraries), \
|
link_apk_header_libs := $(call app-lib-header-files,$(apk_libraries))
|
||||||
$(call intermediates-dir-for, \
|
|
||||||
APPS,$(lib),,COMMON)/classes-pre-proguard.jar)
|
|
||||||
link_apk_header_libs := \
|
|
||||||
$(foreach lib,$(apk_libraries), \
|
|
||||||
$(call intermediates-dir-for, \
|
|
||||||
APPS,$(lib),,COMMON)/classes-header.jar)
|
|
||||||
|
|
||||||
# link against the jar with full original names (before proguard processing).
|
# link against the jar with full original names (before proguard processing).
|
||||||
full_shared_java_libs += $(link_apk_libraries)
|
full_shared_java_libs += $(link_apk_libraries)
|
||||||
|
Reference in New Issue
Block a user