summaryrefslogtreecommitdiffstats
path: root/core/host_dalvik_java_library.mk
diff options
context:
space:
mode:
authorYing Wang <wangying@google.com>2015-01-14 14:23:56 -0800
committerYing Wang <wangying@google.com>2015-01-21 11:54:13 -0800
commit33360dd56925276e4526f5f52c26423e2bb1a670 (patch)
tree8f5f1f80febcc28c2f72cbf2dcd2ebcf835a50d5 /core/host_dalvik_java_library.mk
parent350c662aafb6f899af60722d38ac5ec8f6479886 (diff)
downloadbuild-33360dd56925276e4526f5f52c26423e2bb1a670.zip
build-33360dd56925276e4526f5f52c26423e2bb1a670.tar.gz
build-33360dd56925276e4526f5f52c26423e2bb1a670.tar.bz2
Running jarjar on Java resources.
Before this change, Java resources are added as a separate step (add-java-resources-to-package) after dex is run, so jarjar isn't run on the resource files. With this change, we add Java resources immediately after we call javac, so jarjar is run on the resource files (the module's own resource, as well as resources carried by static Java libraries). When we generate the final apk/jar, we use the jarjar'ed jar as the inital pacakge file, with class files and empty folders removed. When jack is enabled, in jack-java-to-dex we add the Java resources to a temp jar using the PRIVATE_EXTRA_JAR_ARGS, and extrac the files in a temp dir. Jack will process the resource files and output the result to PRIVATE_JACK_INTERMEDIATES_DIR. When we package the final apk/jar, we need to call add-carried-jack-resources to readd the resources. (TODO: if jack can output all resources to a jar/zip file, we can use that file as the initial package file as well.) Bug: 18837479 Change-Id: I8d7296e30ec8d005054cf04c4f2aed6d7a0d823b
Diffstat (limited to 'core/host_dalvik_java_library.mk')
-rw-r--r--core/host_dalvik_java_library.mk12
1 files changed, 3 insertions, 9 deletions
diff --git a/core/host_dalvik_java_library.mk b/core/host_dalvik_java_library.mk
index 772245e..e8823be 100644
--- a/core/host_dalvik_java_library.mk
+++ b/core/host_dalvik_java_library.mk
@@ -97,21 +97,18 @@ $(full_classes_jar): $(full_classes_jarjar_jar) | $(ACP)
@echo Copying: $@
$(hide) $(ACP) -fp $< $@
-ifneq ($(strip $(LOCAL_USE_JACK)),true)
+ifneq ($(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) ($@)"
- $(create-empty-package)
+ $(call initialize-package-file,$(PRIVATE_SOURCE_ARCHIVE),$@)
$(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): \
@@ -134,9 +131,6 @@ $(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