Export proguard flags from static android libraries and aar prebuilts
Test: m Contacts, classes-proguard.jar has same contents Test: rm -rf out; tapas Contacts; m Change-Id: Id7a92fb2c44913bccbfcbeae127355b4de588e4d
This commit is contained in:
@@ -80,6 +80,7 @@ LOCAL_EXPORT_C_INCLUDE_DEPS:=
|
|||||||
LOCAL_EXPORT_C_INCLUDE_DIRS:=
|
LOCAL_EXPORT_C_INCLUDE_DIRS:=
|
||||||
LOCAL_EXPORT_HEADER_LIBRARY_HEADERS:=
|
LOCAL_EXPORT_HEADER_LIBRARY_HEADERS:=
|
||||||
LOCAL_EXPORT_PACKAGE_RESOURCES:=
|
LOCAL_EXPORT_PACKAGE_RESOURCES:=
|
||||||
|
LOCAL_EXPORT_PROGUARD_FLAG_FILES:=
|
||||||
LOCAL_EXPORT_SHARED_LIBRARY_HEADERS:=
|
LOCAL_EXPORT_SHARED_LIBRARY_HEADERS:=
|
||||||
LOCAL_EXPORT_STATIC_LIBRARY_HEADERS:=
|
LOCAL_EXPORT_STATIC_LIBRARY_HEADERS:=
|
||||||
LOCAL_EXTRACT_APK:=
|
LOCAL_EXTRACT_APK:=
|
||||||
|
@@ -648,6 +648,12 @@ ifeq ($(filter shrinktests,$(LOCAL_PROGUARD_ENABLED)),)
|
|||||||
common_proguard_flags += -dontshrink # don't shrink tests by default
|
common_proguard_flags += -dontshrink # don't shrink tests by default
|
||||||
endif # shrinktests
|
endif # shrinktests
|
||||||
endif # test package
|
endif # test package
|
||||||
|
ifneq ($(LOCAL_PROGUARD_ENABLED),custom)
|
||||||
|
ifdef LOCAL_USE_AAPT2
|
||||||
|
common_proguard_flag_files += $(foreach l,$(LOCAL_STATIC_ANDROID_LIBRARIES),\
|
||||||
|
$(call intermediates-dir-for,JAVA_LIBRARIES,$(l),,COMMON)/export_proguard_flags)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
ifneq ($(common_proguard_flag_files),)
|
ifneq ($(common_proguard_flag_files),)
|
||||||
common_proguard_flags += $(addprefix -include , $(common_proguard_flag_files))
|
common_proguard_flags += $(addprefix -include , $(common_proguard_flag_files))
|
||||||
# This is included from $(BUILD_SYSTEM)/proguard.flags
|
# This is included from $(BUILD_SYSTEM)/proguard.flags
|
||||||
|
@@ -564,12 +564,16 @@ my_src_aar := $(filter %.aar, $(my_prebuilt_src_file))
|
|||||||
ifneq ($(my_src_aar),)
|
ifneq ($(my_src_aar),)
|
||||||
# This is .aar file, archive of classes.jar and Android resources.
|
# This is .aar file, archive of classes.jar and Android resources.
|
||||||
my_src_jar := $(intermediates.COMMON)/aar/classes.jar
|
my_src_jar := $(intermediates.COMMON)/aar/classes.jar
|
||||||
|
my_src_proguard_options := $(intermediates.COMMON)/aar/proguard.txt
|
||||||
|
|
||||||
|
$(my_src_jar) : .KATI_IMPLICIT_OUTPUTS := $(my_src_proguard_options)
|
||||||
$(my_src_jar) : $(my_src_aar)
|
$(my_src_jar) : $(my_src_aar)
|
||||||
$(hide) rm -rf $(dir $@) && mkdir -p $(dir $@) $(dir $@)/res
|
$(hide) rm -rf $(dir $@) && mkdir -p $(dir $@) $(dir $@)/res
|
||||||
$(hide) unzip -qo -d $(dir $@) $<
|
$(hide) unzip -qo -d $(dir $@) $<
|
||||||
# Make sure the extracted classes.jar has a new timestamp.
|
# Make sure the extracted classes.jar has a new timestamp.
|
||||||
$(hide) touch $@
|
$(hide) touch $@
|
||||||
|
# Make sure the proguard file exists and has a new timestamp.
|
||||||
|
$(hide) touch $(dir $@)/proguard.txt
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -589,6 +593,10 @@ $(common_javalib_jar) : $(common_classes_jar)
|
|||||||
|
|
||||||
ifdef LOCAL_USE_AAPT2
|
ifdef LOCAL_USE_AAPT2
|
||||||
ifneq ($(my_src_aar),)
|
ifneq ($(my_src_aar),)
|
||||||
|
|
||||||
|
$(intermediates.COMMON)/export_proguard_flags : $(my_src_proguard_options)
|
||||||
|
$(transform-prebuilt-to-target)
|
||||||
|
|
||||||
LOCAL_SDK_RES_VERSION:=$(strip $(LOCAL_SDK_RES_VERSION))
|
LOCAL_SDK_RES_VERSION:=$(strip $(LOCAL_SDK_RES_VERSION))
|
||||||
ifeq ($(LOCAL_SDK_RES_VERSION),)
|
ifeq ($(LOCAL_SDK_RES_VERSION),)
|
||||||
LOCAL_SDK_RES_VERSION:=$(LOCAL_SDK_VERSION)
|
LOCAL_SDK_RES_VERSION:=$(LOCAL_SDK_VERSION)
|
||||||
|
@@ -114,6 +114,13 @@ framework_res_package_export_deps := \
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifdef LOCAL_USE_AAPT2
|
||||||
|
$(intermediates.COMMON)/export_proguard_flags: $(addprefix $(LOCAL_PATH)/,$(LOCAL_EXPORT_PROGUARD_FLAG_FILES))
|
||||||
|
@echo "Export proguard flags: $@"
|
||||||
|
rm -f $@
|
||||||
|
cat $+ >$@
|
||||||
|
endif
|
||||||
|
|
||||||
# add --non-constant-id to prevent inlining constants.
|
# add --non-constant-id to prevent inlining constants.
|
||||||
# AAR needs text symbol file R.txt.
|
# AAR needs text symbol file R.txt.
|
||||||
ifdef LOCAL_USE_AAPT2
|
ifdef LOCAL_USE_AAPT2
|
||||||
|
Reference in New Issue
Block a user