From 33360dd56925276e4526f5f52c26423e2bb1a670 Mon Sep 17 00:00:00 2001 From: Ying Wang Date: Wed, 14 Jan 2015 14:23:56 -0800 Subject: 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 --- core/static_java_library.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'core/static_java_library.mk') diff --git a/core/static_java_library.mk b/core/static_java_library.mk index e1b9dd0..c692f9f 100644 --- a/core/static_java_library.mk +++ b/core/static_java_library.mk @@ -59,7 +59,7 @@ endif LOCAL_PROGUARD_FLAGS := $(addprefix -include ,$(proguard_options_file)) $(LOCAL_PROGUARD_FLAGS) -ifeq ($(strip $(LOCAL_USE_JACK)),true) +ifeq ($(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 ($(strip $(LOCAL_USE_JACK)),true) +ifeq ($(LOCAL_USE_JACK),true) $(noshrob_classes_jack): $(R_file_stamp) $(full_classes_jack): $(R_file_stamp) endif # LOCAL_USE_JACK -- cgit v1.1