Allow to run Proguard on static Java library
1. Let aapt output the proguard_options file 2. If proguard is enabled, switch the dependency from $(full_classes_jar) to $(full_classes_proguard_jar). Change-Id: Idc641a1515b8899a4623a2aeec5cd494f6c1c1c5
This commit is contained in:
parent
68b1d3b077
commit
ba71aba939
2 changed files with 27 additions and 4 deletions
|
@ -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),)
|
||||
|
|
|
@ -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 :=
|
||||
|
||||
|
|
Loading…
Reference in a new issue