diff --git a/core/java_library.mk b/core/java_library.mk index d65a3ca6a6..67c1bcb5a0 100644 --- a/core/java_library.mk +++ b/core/java_library.mk @@ -31,6 +31,10 @@ intermediates.COMMON := $(call local-intermediates-dir,COMMON) common_javalib.jar := $(intermediates.COMMON)/$(LOCAL_BUILT_MODULE_STEM) LOCAL_INTERMEDIATE_TARGETS += $(common_javalib.jar) +ifeq ($(LOCAL_PROGUARD_ENABLED),disabled) + LOCAL_PROGUARD_ENABLED := +endif + ifneq (true,$(WITH_DEXPREOPT)) LOCAL_DEX_PREOPT := else @@ -62,7 +66,12 @@ include $(BUILD_SYSTEM)/java.mk ifeq ($(LOCAL_IS_STATIC_JAVA_LIBRARY),true) # No dex; all we want are the .class files with resources. -$(common_javalib.jar) : $(full_classes_jar) $(java_resource_sources) +$(common_javalib.jar) : $(java_resource_sources) +ifdef LOCAL_PROGUARD_ENABLED +$(common_javalib.jar) : $(full_classes_proguard_jar) +else +$(common_javalib.jar) : $(full_classes_jar) +endif @echo "target Static Jar: $(PRIVATE_MODULE) ($@)" $(copy-file-to-target) ifneq ($(extra_jar_args),) diff --git a/core/static_java_library.mk b/core/static_java_library.mk index eaa74aa5cc..c3c5c86881 100644 --- a/core/static_java_library.mk +++ b/core/static_java_library.mk @@ -21,6 +21,7 @@ LOCAL_UNINSTALLABLE_MODULE := true LOCAL_IS_STATIC_JAVA_LIBRARY := true +LOCAL_MODULE_CLASS := JAVA_LIBRARIES # Hack to build static Java library with Android resource # See bug 5714516 @@ -46,6 +47,15 @@ endif ifeq (none,$(LOCAL_JAR_EXCLUDE_FILES)) LOCAL_JAR_EXCLUDE_FILES := endif + +proguard_options_file := + +intermediates.COMMON := $(call local-intermediates-dir,COMMON) +ifneq ($(LOCAL_PROGUARD_ENABLED),custom) + proguard_options_file := $(intermediates.COMMON)/proguard_options +endif +LOCAL_PROGUARD_FLAGS := $(addprefix -include ,$(proguard_options_file)) $(LOCAL_PROGUARD_FLAGS) + endif # all_resources endif # LOCAL_RESOURCE_DIR @@ -55,9 +65,13 @@ ifneq (,$(all_resources)) R_file_stamp := $(LOCAL_INTERMEDIATE_SOURCE_DIR)/R.stamp ifeq ($(strip $(LOCAL_MANIFEST_FILE)),) -LOCAL_MANIFEST_FILE := AndroidManifest.xml + LOCAL_MANIFEST_FILE := AndroidManifest.xml +endif +ifdef LOCAL_FULL_MANIFEST_FILE + full_android_manifest := $(LOCAL_FULL_MANIFEST_FILE) +else + full_android_manifest := $(LOCAL_PATH)/$(LOCAL_MANIFEST_FILE) endif -full_android_manifest := $(LOCAL_PATH)/$(LOCAL_MANIFEST_FILE) LOCAL_SDK_RES_VERSION:=$(strip $(LOCAL_SDK_RES_VERSION)) ifeq ($(LOCAL_SDK_RES_VERSION),) @@ -94,7 +108,7 @@ else $(R_file_stamp): PRIVATE_DEFAULT_APP_TARGET_SDK := $(DEFAULT_APP_TARGET_SDK) endif $(R_file_stamp): PRIVATE_ASSET_DIR := -$(R_file_stamp): PRIVATE_PROGUARD_OPTIONS_FILE := +$(R_file_stamp): PRIVATE_PROGUARD_OPTIONS_FILE := $(proguard_options_file) $(R_file_stamp): PRIVATE_MANIFEST_PACKAGE_NAME := $(R_file_stamp): PRIVATE_MANIFEST_INSTRUMENTATION_FOR :=