am e78893d3: am ba71aba9: Allow to run Proguard on static Java library

* commit 'e78893d3e0106f70adccac773cf08c23aa2fda3e':
  Allow to run Proguard on static Java library
This commit is contained in:
Ying Wang 2013-03-26 14:11:31 -07:00 committed by Android Git Automerger
commit 1671c74be6
2 changed files with 27 additions and 4 deletions

View file

@ -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),)

View file

@ -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 :=