Revert "Running jarjar on Java resources."
This reverts commit 140274707e
.
Breaks the build on uiautomator_compat.
Change-Id: I6d14f39e3432bf5e691027bbb8e7260e4bec8e8d
This commit is contained in:
parent
140274707e
commit
c1ed9796bb
|
@ -409,6 +409,7 @@ endif # TARGET_
|
|||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_RESOURCE_DIR := $(LOCAL_RESOURCE_DIR)
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ASSET_DIR := $(LOCAL_ASSET_DIR)
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_STATIC_JAVA_LIBRARIES := $(full_static_java_libs)
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_STATIC_JACK_LIBRARIES := $(full_static_jack_libs)
|
||||
|
||||
# full_java_libs: The list of files that should be used as the classpath.
|
||||
# Using this list as a dependency list WILL NOT WORK.
|
||||
|
@ -681,7 +682,7 @@ endif
|
|||
###########################################################
|
||||
# JACK
|
||||
###########################################################
|
||||
ifeq ($(LOCAL_USE_JACK),true)
|
||||
ifeq ($(strip $(LOCAL_USE_JACK)),true)
|
||||
ifdef need_compile_java
|
||||
|
||||
full_static_jack_libs := \
|
||||
|
|
|
@ -1702,7 +1702,6 @@ $(if $(PRIVATE_JAR_MANIFEST), \
|
|||
jar -cfm $@ $(dir $@)/manifest.mf \
|
||||
-C $(PRIVATE_CLASS_INTERMEDIATES_DIR) ., \
|
||||
$(hide) jar -cf $@ -C $(PRIVATE_CLASS_INTERMEDIATES_DIR) .)
|
||||
$(if $(PRIVATE_EXTRA_JAR_ARGS),$(call add-java-resources-to,$@))
|
||||
endef
|
||||
|
||||
define transform-java-to-classes.jar
|
||||
|
@ -1734,12 +1733,6 @@ $(if $(PRIVATE_JACK_PROGUARD_FLAGS), \
|
|||
$(hide) echo -basedirectory $(CURDIR) > $@.flags; \
|
||||
echo $(PRIVATE_JACK_PROGUARD_FLAGS) >> $@.flags; \
|
||||
)
|
||||
$(if $(PRIVATE_EXTRA_JAR_ARGS),
|
||||
$(hide) mkdir -p $@.res.tmp
|
||||
$(hide) $(call create-empty-package-at,$@.res.tmp.zip)
|
||||
$(hide) $(call add-java-resources-to,$@.res.tmp.zip)
|
||||
$(hide) $(call unzip-jar-files,$@.res.tmp.zip,$@.res.tmp)
|
||||
$(hide) rm $@.res.tmp.zip)
|
||||
$(hide) if [ -s $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list-uniq ] ; then \
|
||||
export tmpEcjArg="@$(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list-uniq"; \
|
||||
else \
|
||||
|
@ -1753,7 +1746,6 @@ $(call call-jack,$(PRIVATE_JACK_VM),$(PRIVATE_JACK_VM_ARGS),$(PRIVATE_JACK_EXTRA
|
|||
$(addprefix --classpath ,$(strip \
|
||||
$(call normalize-path-list,$(PRIVATE_BOOTCLASSPATH_JAVA_LIBRARIES) $(PRIVATE_ALL_JACK_LIBRARIES)))) \
|
||||
$(addprefix --import ,$(call reverse-list,$(PRIVATE_STATIC_JACK_LIBRARIES))) \
|
||||
$(if $(PRIVATE_EXTRA_JAR_ARGS),--import-resource $@.res.tmp) \
|
||||
-D jack.import.resource.policy=keep-first \
|
||||
-D jack.import.type.policy=keep-first \
|
||||
--output-jack $(PRIVATE_CLASSES_JACK) \
|
||||
|
@ -1765,7 +1757,6 @@ $(call call-jack,$(PRIVATE_JACK_VM),$(PRIVATE_JACK_VM_ARGS),$(PRIVATE_JACK_EXTRA
|
|||
|| ( rm -rf $(PRIVATE_CLASSES_JACK); rm -rf $(PRIVATE_JACK_INTERMEDIATES_DIR); exit 41 )
|
||||
$(hide) mv $(PRIVATE_JACK_INTERMEDIATES_DIR)/classes*.dex $(dir $@)
|
||||
$(hide) rm -f $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list
|
||||
$(if $(PRIVATE_EXTRA_JAR_ARGS),$(hide) rm -rf $@.res.tmp)
|
||||
$(hide) mv $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list-uniq $(PRIVATE_JACK_INTERMEDIATES_DIR).java-source-list
|
||||
$(if $(PRIVATE_JAR_PACKAGES), $(hide) echo unsupported options PRIVATE_JAR_PACKAGES in $@; exit 53)
|
||||
$(if $(PRIVATE_JAR_EXCLUDE_PACKAGES), $(hide) echo unsupported options JAR_EXCLUDE_PACKAGES in $@; exit 53)
|
||||
|
@ -1899,7 +1890,6 @@ $(if $(PRIVATE_JAR_MANIFEST), \
|
|||
jar -cfm $@ $(dir $@)/manifest.mf \
|
||||
-C $(PRIVATE_CLASS_INTERMEDIATES_DIR) ., \
|
||||
$(hide) jar -cf $@ -C $(PRIVATE_CLASS_INTERMEDIATES_DIR) .)
|
||||
$(if $(PRIVATE_EXTRA_JAR_ARGS),$(call add-java-resources-to,$@))
|
||||
$(hide) mv $(PRIVATE_CLASS_INTERMEDIATES_DIR)/newstamp $(PRIVATE_CLASS_INTERMEDIATES_DIR)/stamp
|
||||
endef
|
||||
|
||||
|
@ -1955,15 +1945,6 @@ define create-empty-package
|
|||
$(call create-empty-package-at,$@)
|
||||
endef
|
||||
|
||||
# Copy an arhchive file and delete any class files and empty folders inside.
|
||||
# $(1): the source archive file.
|
||||
# $(2): the destination archive file.
|
||||
define initialize-package-file
|
||||
@mkdir -p $(dir $(2))
|
||||
$(hide) cp -f $(1) $(2)
|
||||
$(hide) zip -qd $(2) "*.class" && zip -qd $(2) "*/"
|
||||
endef
|
||||
|
||||
#TODO: we kinda want to build different asset packages for
|
||||
# different configurations, then combine them later (or something).
|
||||
# Per-locale, etc.
|
||||
|
@ -2023,6 +2004,25 @@ $(hide) jar uf $(1) @$(1).jar-arg-list
|
|||
@rm -f $(1).jar-arg-list
|
||||
endef
|
||||
|
||||
# Add java resources added by the current module.
|
||||
#
|
||||
define add-java-resources-to-package
|
||||
$(call add-java-resources-to,$@)
|
||||
endef
|
||||
|
||||
# Add java resources carried by static Java libraries.
|
||||
#
|
||||
define add-carried-java-resources
|
||||
$(hide) if [ -d $(PRIVATE_CLASS_INTERMEDIATES_DIR) ] ; then \
|
||||
java_res_jar_flags=$$(find $(PRIVATE_CLASS_INTERMEDIATES_DIR) -type f -a -not -name "*.class" \
|
||||
| sed -e "s?^$(PRIVATE_CLASS_INTERMEDIATES_DIR)/? -C $(PRIVATE_CLASS_INTERMEDIATES_DIR) ?"); \
|
||||
if [ -n "$$java_res_jar_flags" ] ; then \
|
||||
echo $$java_res_jar_flags >$(dir $@)java_res_jar_flags; \
|
||||
jar uf $@ $$java_res_jar_flags; \
|
||||
fi; \
|
||||
fi
|
||||
endef
|
||||
|
||||
# Add resources carried by static Jack libraries.
|
||||
#
|
||||
define add-carried-jack-resources
|
||||
|
@ -2036,6 +2036,7 @@ define add-carried-jack-resources
|
|||
fi
|
||||
endef
|
||||
|
||||
|
||||
# Sign a package using the specified key/cert.
|
||||
#
|
||||
define sign-package
|
||||
|
@ -2077,6 +2078,7 @@ endef
|
|||
define transform-host-java-to-package
|
||||
@echo "host Java: $(PRIVATE_MODULE) ($(PRIVATE_CLASS_INTERMEDIATES_DIR))"
|
||||
$(call compile-java,$(HOST_JAVAC),$(PRIVATE_BOOTCLASSPATH))
|
||||
$(if $(PRIVATE_EXTRA_JAR_ARGS), $(call add-java-resources-to-package))
|
||||
endef
|
||||
|
||||
###########################################################
|
||||
|
|
|
@ -25,37 +25,34 @@ $(built_dpi_apk): PRIVATE_MANIFEST_PACKAGE_NAME := $(LOCAL_MANIFEST_PACKAGE_NAME
|
|||
$(built_dpi_apk): PRIVATE_MANIFEST_INSTRUMENTATION_FOR := $(LOCAL_INSTRUMENTATION_FOR)
|
||||
$(built_dpi_apk): PRIVATE_JNI_SHARED_LIBRARIES := $(jni_shared_libraries_with_abis)
|
||||
$(built_dpi_apk): PRIVATE_JNI_SHARED_LIBRARIES_ABI := $(jni_shared_libraries_abis)
|
||||
$(built_dpi_apk): PRIVATE_DEX_FILE := $(built_dex)
|
||||
# Note that PRIVATE_CLASS_INTERMEDIATES_DIR points to the base apk's intermediate dir.
|
||||
$(built_dpi_apk): PRIVATE_CLASS_INTERMEDIATES_DIR := $(intermediates)/classes
|
||||
$(built_dpi_apk): PRIVATE_EXTRA_JAR_ARGS := $(extra_jar_args)
|
||||
$(built_dpi_apk): PRIVATE_PRIVATE_KEY := $(private_key)
|
||||
$(built_dpi_apk): PRIVATE_CERTIFICATE := $(certificate)
|
||||
$(built_dpi_apk): PRIVATE_ADDITIONAL_CERTIFICATES := $(foreach c,\
|
||||
$(LOCAL_ADDITIONAL_CERTIFICATES), $(c).x509.pem $(c).pk8)
|
||||
|
||||
ifneq ($(full_classes_jar),)
|
||||
$(built_dpi_apk): PRIVATE_DEX_FILE := $(built_dex)
|
||||
# Use the jarjar processed arhive as the initial package file.
|
||||
$(built_dpi_apk): PRIVATE_SOURCE_ARCHIVE := $(full_classes_jarjar_jar)
|
||||
$(built_dpi_apk): $(built_dex)
|
||||
else
|
||||
$(built_dpi_apk): PRIVATE_DEX_FILE :=
|
||||
$(built_dpi_apk): PRIVATE_SOURCE_ARCHIVE :=
|
||||
endif # full_classes_jar
|
||||
|
||||
# Set up dependenncies and the build recipe.
|
||||
$(built_dpi_apk) : $(R_file_stamp)
|
||||
$(built_dpi_apk) : $(all_library_res_package_export_deps)
|
||||
$(built_dpi_apk) : $(built_dex)
|
||||
$(built_dpi_apk) : $(private_key) $(certificate) $(SIGNAPK_JAR)
|
||||
$(built_dpi_apk) : $(AAPT) | $(ZIPALIGN)
|
||||
$(built_dpi_apk) : $(all_res_assets) $(jni_shared_libraries) $(full_android_manifest)
|
||||
@echo "target Package: $(PRIVATE_MODULE) ($@)"
|
||||
$(if $(PRIVATE_SOURCE_ARCHIVE),\
|
||||
$(call initialize-package-file,$(PRIVATE_SOURCE_ARCHIVE),$@),\
|
||||
$(create-empty-package))
|
||||
$(create-empty-package)
|
||||
$(add-assets-to-package)
|
||||
ifneq ($(jni_shared_libraries),)
|
||||
$(add-jni-shared-libs-to-package)
|
||||
endif
|
||||
ifneq ($(full_classes_jar),)
|
||||
$(add-dex-to-package)
|
||||
endif
|
||||
$(add-carried-java-resources)
|
||||
ifneq ($(extra_jar_args),)
|
||||
$(add-java-resources-to-package)
|
||||
endif
|
||||
$(sign-package)
|
||||
$(align-package)
|
||||
|
|
|
@ -101,18 +101,21 @@ $(full_classes_jar): $(full_classes_jarjar_jar) | $(ACP)
|
|||
@echo Copying: $@
|
||||
$(hide) $(ACP) -fp $< $@
|
||||
|
||||
ifneq ($(LOCAL_USE_JACK),true)
|
||||
ifneq ($(strip $(LOCAL_USE_JACK)),true)
|
||||
$(built_dex): PRIVATE_INTERMEDIATES_DIR := $(intermediates.COMMON)
|
||||
$(built_dex): PRIVATE_DX_FLAGS := $(LOCAL_DX_FLAGS)
|
||||
$(built_dex): $(full_classes_jar) $(DX)
|
||||
$(transform-classes.jar-to-dex)
|
||||
|
||||
$(LOCAL_BUILT_MODULE): PRIVATE_DEX_FILE := $(built_dex)
|
||||
$(LOCAL_BUILT_MODULE): PRIVATE_SOURCE_ARCHIVE := $(full_classes_jarjar_jar)
|
||||
$(LOCAL_BUILT_MODULE): $(built_dex) $(java_resource_sources)
|
||||
@echo "Host Jar: $(PRIVATE_MODULE) ($@)"
|
||||
$(call initialize-package-file,$(PRIVATE_SOURCE_ARCHIVE),$@)
|
||||
$(create-empty-package)
|
||||
$(add-dex-to-package)
|
||||
$(add-carried-java-resources)
|
||||
ifneq ($(extra_jar_args),)
|
||||
$(add-java-resources-to-package)
|
||||
endif
|
||||
|
||||
else # LOCAL_USE_JACK
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): \
|
||||
|
@ -135,6 +138,9 @@ $(LOCAL_BUILT_MODULE): $(built_dex) $(java_resource_sources)
|
|||
$(create-empty-package)
|
||||
$(add-dex-to-package)
|
||||
$(add-carried-jack-resources)
|
||||
ifneq ($(extra_jar_args),)
|
||||
$(add-java-resources-to-package)
|
||||
endif
|
||||
|
||||
endif # LOCAL_USE_JACK
|
||||
|
||||
|
|
|
@ -474,7 +474,7 @@ legacy_proguard_flags := -injars $(link_instr_classes_jar) \
|
|||
-verbose \
|
||||
$(legacy_proguard_flags)
|
||||
# not supported with jack
|
||||
ifeq ($(LOCAL_USE_JACK),true)
|
||||
ifeq ($(strip $(LOCAL_USE_JACK)),true)
|
||||
$(error $(LOCAL_MODULE): Build with jack of instrumentation when obfuscating is not yet supported)
|
||||
endif
|
||||
|
||||
|
@ -565,7 +565,7 @@ $(LOCAL_MODULE)-findbugs : $(findbugs_html)
|
|||
|
||||
endif # full_classes_jar is defined
|
||||
|
||||
ifeq ($(LOCAL_USE_JACK),true)
|
||||
ifeq ($(strip $(LOCAL_USE_JACK)),true)
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): \
|
||||
PRIVATE_JACK_INTERMEDIATES_DIR := $(intermediates.COMMON)/jack
|
||||
|
||||
|
|
|
@ -58,6 +58,9 @@ $(common_javalib.jar) : $(full_classes_jar)
|
|||
endif
|
||||
@echo "target Static Jar: $(PRIVATE_MODULE) ($@)"
|
||||
$(copy-file-to-target)
|
||||
ifneq ($(extra_jar_args),)
|
||||
$(add-java-resources-to-package)
|
||||
endif
|
||||
|
||||
$(LOCAL_BUILT_MODULE): $(common_javalib.jar)
|
||||
$(copy-file-to-target)
|
||||
|
@ -65,18 +68,18 @@ $(LOCAL_BUILT_MODULE): $(common_javalib.jar)
|
|||
else # !LOCAL_IS_STATIC_JAVA_LIBRARY
|
||||
|
||||
$(common_javalib.jar): PRIVATE_DEX_FILE := $(built_dex)
|
||||
$(common_javalib.jar): PRIVATE_SOURCE_ARCHIVE := $(full_classes_jarjar_jar)
|
||||
$(common_javalib.jar) : $(built_dex) $(java_resource_sources)
|
||||
@echo "target Jar: $(PRIVATE_MODULE) ($@)"
|
||||
ifeq ($(LOCAL_USE_JACK),true)
|
||||
$(create-empty-package)
|
||||
else
|
||||
$(call initialize-package-file,$(PRIVATE_SOURCE_ARCHIVE),$@)
|
||||
endif
|
||||
$(add-dex-to-package)
|
||||
ifeq ($(LOCAL_USE_JACK),true)
|
||||
ifneq ($(strip $(LOCAL_USE_JACK)),true)
|
||||
$(add-carried-java-resources)
|
||||
else
|
||||
$(add-carried-jack-resources)
|
||||
endif
|
||||
ifneq ($(extra_jar_args),)
|
||||
$(add-java-resources-to-package)
|
||||
endif
|
||||
|
||||
ifdef LOCAL_DEX_PREOPT
|
||||
ifneq ($(dexpreopt_boot_jar_module),) # boot jar
|
||||
|
|
|
@ -162,7 +162,7 @@ endif # need_compile_res
|
|||
endif # !custom
|
||||
LOCAL_PROGUARD_FLAGS := $(addprefix -include ,$(proguard_options_file)) $(LOCAL_PROGUARD_FLAGS)
|
||||
|
||||
ifeq ($(LOCAL_USE_JACK),true)
|
||||
ifeq ($(strip $(LOCAL_USE_JACK)),true)
|
||||
ifndef LOCAL_JACK_PROGUARD_FLAGS
|
||||
LOCAL_JACK_PROGUARD_FLAGS := $(LOCAL_PROGUARD_FLAGS)
|
||||
endif
|
||||
|
@ -278,7 +278,7 @@ endif
|
|||
# they want to use this module's R.java file.
|
||||
$(LOCAL_BUILT_MODULE): $(R_file_stamp)
|
||||
|
||||
ifeq ($(LOCAL_USE_JACK),true)
|
||||
ifeq ($(strip $(LOCAL_USE_JACK)),true)
|
||||
ifneq ($(built_dex_intermediate),)
|
||||
$(built_dex_intermediate): $(R_file_stamp)
|
||||
endif
|
||||
|
@ -339,12 +339,7 @@ endif # LOCAL_NO_STANDARD_LIBRARIES
|
|||
|
||||
ifneq ($(full_classes_jar),)
|
||||
$(LOCAL_BUILT_MODULE): PRIVATE_DEX_FILE := $(built_dex)
|
||||
# Use the jarjar processed arhive as the initial package file.
|
||||
$(LOCAL_BUILT_MODULE): PRIVATE_SOURCE_ARCHIVE := $(full_classes_jarjar_jar)
|
||||
$(LOCAL_BUILT_MODULE): $(built_dex)
|
||||
else
|
||||
$(LOCAL_BUILT_MODULE): PRIVATE_DEX_FILE :=
|
||||
$(LOCAL_BUILT_MODULE): PRIVATE_SOURCE_ARCHIVE :=
|
||||
endif # full_classes_jar
|
||||
|
||||
include $(BUILD_SYSTEM)/install_jni_libs.mk
|
||||
|
@ -405,13 +400,7 @@ endif
|
|||
endif
|
||||
$(LOCAL_BUILT_MODULE): $(all_res_assets) $(jni_shared_libraries) $(full_android_manifest)
|
||||
@echo "target Package: $(PRIVATE_MODULE) ($@)"
|
||||
ifeq ($(LOCAL_USE_JACK),true)
|
||||
$(create-empty-package)
|
||||
else
|
||||
$(if $(PRIVATE_SOURCE_ARCHIVE),\
|
||||
$(call initialize-package-file,$(PRIVATE_SOURCE_ARCHIVE),$@),\
|
||||
$(create-empty-package))
|
||||
endif
|
||||
$(add-assets-to-package)
|
||||
ifneq ($(jni_shared_libraries),)
|
||||
$(add-jni-shared-libs-to-package)
|
||||
|
@ -419,8 +408,13 @@ endif
|
|||
ifneq ($(full_classes_jar),)
|
||||
$(add-dex-to-package)
|
||||
endif
|
||||
ifeq ($(LOCAL_USE_JACK),true)
|
||||
ifneq ($(strip $(LOCAL_USE_JACK)),true)
|
||||
$(add-carried-java-resources)
|
||||
else
|
||||
$(add-carried-jack-resources)
|
||||
endif
|
||||
ifneq ($(extra_jar_args),)
|
||||
$(add-java-resources-to-package)
|
||||
endif
|
||||
$(sign-package)
|
||||
ifdef LOCAL_DEX_PREOPT
|
||||
|
|
|
@ -59,7 +59,7 @@ endif
|
|||
|
||||
LOCAL_PROGUARD_FLAGS := $(addprefix -include ,$(proguard_options_file)) $(LOCAL_PROGUARD_FLAGS)
|
||||
|
||||
ifeq ($(LOCAL_USE_JACK),true)
|
||||
ifeq ($(strip $(LOCAL_USE_JACK)),true)
|
||||
ifndef LOCAL_JACK_PROGUARD_FLAGS
|
||||
LOCAL_JACK_PROGUARD_FLAGS := $(LOCAL_PROGUARD_FLAGS)
|
||||
endif
|
||||
|
@ -123,7 +123,7 @@ $(R_file_stamp) : $(all_resources) $(full_android_manifest) $(AAPT) $(framework_
|
|||
$(hide) find $(PRIVATE_SOURCE_INTERMEDIATES_DIR) -name R.java | xargs cat > $@
|
||||
|
||||
$(LOCAL_BUILT_MODULE): $(R_file_stamp)
|
||||
ifeq ($(LOCAL_USE_JACK),true)
|
||||
ifeq ($(strip $(LOCAL_USE_JACK)),true)
|
||||
$(noshrob_classes_jack): $(R_file_stamp)
|
||||
$(full_classes_jack): $(R_file_stamp)
|
||||
endif # LOCAL_USE_JACK
|
||||
|
|
Loading…
Reference in New Issue