From 858657366fa6a1f2ce14941f22b82a8dbb3f9349 Mon Sep 17 00:00:00 2001 From: Ying Wang Date: Mon, 28 Mar 2016 18:39:42 -0700 Subject: [PATCH] Remove support of disabling Jack. We removed code and variables related to running dx on classes.jar in this change. Also removed target emma rules (but kept the emma rules for host java libraries), for it's now done by Jack. We still support to build classes.jar (and javalib.jar for static Java libraries) using javac, because tools like javadoc need class files as input. Removed the obsolete install-dex-debug. Bug: 27400061 Change-Id: If0bcdfe62cb181a98754fb0dbe1c12c92e38d3e8 --- core/clear_vars.mk | 6 +-- core/combo/javac.mk | 5 --- core/config.mk | 5 --- core/configure_local_jack.mk | 9 +--- core/definitions.mk | 27 +---------- core/dpi_specific_apk.mk | 14 +----- core/java.mk | 86 +++--------------------------------- core/java_common.mk | 2 - core/java_library.mk | 22 --------- core/package_internal.mk | 70 +++++------------------------ core/prebuilt_internal.mk | 3 -- core/static_java_library.mk | 13 ++---- 12 files changed, 27 insertions(+), 235 deletions(-) diff --git a/core/clear_vars.mk b/core/clear_vars.mk index dc44a1a1a7..46e6ca8142 100644 --- a/core/clear_vars.mk +++ b/core/clear_vars.mk @@ -106,10 +106,9 @@ LOCAL_AIDL_INCLUDES:= LOCAL_JARJAR_RULES:= LOCAL_ADDITIONAL_JAVA_DIR:= LOCAL_ALLOW_UNDEFINED_SYMBOLS:= -LOCAL_DX_FLAGS:= -LOCAL_JACK_ENABLED:=$(DEFAULT_JACK_ENABLED) # '' (ie disabled), disabled, full, incremental +# full or incremental +LOCAL_JACK_ENABLED:=full LOCAL_JACK_FLAGS:= -LOCAL_JILL_FLAGS:= LOCAL_CERTIFICATE:= LOCAL_SDK_VERSION:= LOCAL_SDK_RES_VERSION:= @@ -153,7 +152,6 @@ LOCAL_JAR_EXCLUDE_PACKAGES:= LOCAL_SOURCE_FILES_ALL_GENERATED:= # '',true # Don't delete the META_INF dir when merging static Java libraries. LOCAL_DONT_DELETE_JAR_META_INF:= -LOCAL_DONT_DELETE_JAR_DIRS:= LOCAL_ADDITIONAL_CERTIFICATES:= LOCAL_PREBUILT_MODULE_FILE:= LOCAL_POST_LINK_CMD:= diff --git a/core/combo/javac.mk b/core/combo/javac.mk index 7f66ea83a9..9042d836e3 100644 --- a/core/combo/javac.mk +++ b/core/combo/javac.mk @@ -9,11 +9,6 @@ # COMMON_JAVAC -- Java compiler command with common arguments # -ifndef ANDROID_COMPILE_WITH_JACK -# Defines if compilation with jack is enabled by default. -ANDROID_COMPILE_WITH_JACK := true -endif - common_jdk_flags := -Xmaxerrs 9999999 # Use the indexer wrapper to index the codebase instead of the javac compiler diff --git a/core/config.mk b/core/config.mk index d2a593d368..5328072907 100644 --- a/core/config.mk +++ b/core/config.mk @@ -545,11 +545,6 @@ MKTARBALL := build/tools/mktarball.sh TUNE2FS := $(HOST_OUT_EXECUTABLES)/tune2fs$(HOST_EXECUTABLE_SUFFIX) JARJAR := $(HOST_OUT_JAVA_LIBRARIES)/jarjar.jar -ifeq ($(ANDROID_COMPILE_WITH_JACK),true) -DEFAULT_JACK_ENABLED:=full -else -DEFAULT_JACK_ENABLED:= -endif ifneq ($(ANDROID_JACK_EXTRA_ARGS),) DEFAULT_JACK_EXTRA_ARGS := $(ANDROID_JACK_EXTRA_ARGS) else diff --git a/core/configure_local_jack.mk b/core/configure_local_jack.mk index 2270c88c46..446bab78df 100644 --- a/core/configure_local_jack.mk +++ b/core/configure_local_jack.mk @@ -21,16 +21,9 @@ endif LOCAL_JACK_ENABLED := $(strip $(LOCAL_JACK_ENABLED)) LOCAL_MODULE := $(strip $(LOCAL_MODULE)) -ifneq ($(LOCAL_JACK_ENABLED),full) -ifneq ($(LOCAL_JACK_ENABLED),incremental) -ifdef LOCAL_JACK_ENABLED -ifneq ($(LOCAL_JACK_ENABLED),disabled) +ifeq ($(filter full incremental,$(LOCAL_JACK_ENABLED)),) $(error $(LOCAL_PATH): invalid LOCAL_JACK_ENABLED "$(LOCAL_JACK_ENABLED)" for $(LOCAL_MODULE)) endif -endif -LOCAL_JACK_ENABLED := -endif -endif ifdef $(LOCAL_MODULE).JACK_VERSION LOCAL_JACK_VERSION := $($(LOCAL_MODULE).JACK_VERSION) diff --git a/core/definitions.mk b/core/definitions.mk index ce71f453a0..00ba9350af 100644 --- a/core/definitions.mk +++ b/core/definitions.mk @@ -2043,9 +2043,8 @@ fi $(hide) tr ' ' '\n' < $@.java-source-list \ | sort -u > $@.java-source-list-uniq $(hide) if [ -s $@.java-source-list-uniq ] ; then \ - $(call call-jack,$(PRIVATE_JACK_EXTRA_ARGS)) \ + $(call call-jack) \ $(strip $(PRIVATE_JACK_FLAGS)) \ - $(strip $(PRIVATE_JACK_DEBUG_FLAGS)) \ $(addprefix --classpath ,$(strip \ $(call normalize-path-list,$(call reverse-list,$(PRIVATE_STATIC_JACK_LIBRARIES)) $(PRIVATE_BOOTCLASSPATH_JAVA_LIBRARIES) $(PRIVATE_ALL_JACK_LIBRARIES)))) \ -D jack.import.resource.policy=keep-first \ @@ -2214,17 +2213,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" \ - $(if $(strip $(PRIVATE_DONT_DELETE_JAR_DIRS)),,"*/") \ - || true # Ignore the error when nothing to delete. -endef - #TODO: we kinda want to build different asset packages for # different configurations, then combine them later (or something). # Per-locale, etc. @@ -2372,19 +2360,6 @@ $(hide) if unzip -l $@ $(PRIVATE_EMBEDDED_JNI_LIBS) >/dev/null ; then \ fi endef -define install-dex-debug -$(hide) if [ -f "$(PRIVATE_INTERMEDIATES_DIR)/classes.dex" ]; then \ - mkdir -p $(TOP)/dalvik/DEBUG-FILES; \ - $(ACP) $(PRIVATE_INTERMEDIATES_DIR)/classes.dex \ - $(TOP)/dalvik/DEBUG-FILES/$(PRIVATE_MODULE).dex; \ - fi -$(hide) if [ -f "$(PRIVATE_INTERMEDIATES_DIR)/classes.lst" ]; then \ - mkdir -p $(TOP)/dalvik/DEBUG-FILES; \ - $(ACP) $(PRIVATE_INTERMEDIATES_DIR)/classes.lst \ - $(TOP)/dalvik/DEBUG-FILES/$(PRIVATE_MODULE).lst; \ - fi -endef - # TODO(joeo): If we can ever upgrade to post 3.81 make and get the # new prebuilt rules to work, we should change this to copy the # resources to the out directory and then copy the resources. diff --git a/core/dpi_specific_apk.mk b/core/dpi_specific_apk.mk index b2a3d64b20..dfd55cd55c 100644 --- a/core/dpi_specific_apk.mk +++ b/core/dpi_specific_apk.mk @@ -30,15 +30,9 @@ $(built_dpi_apk): PRIVATE_CERTIFICATE := $(certificate) $(built_dpi_apk): PRIVATE_ADDITIONAL_CERTIFICATES := $(foreach c,\ $(LOCAL_ADDITIONAL_CERTIFICATES), $(c).x509.pem $(c).pk8) -$(built_dpi_apk): PRIVATE_SOURCE_ARCHIVE := ifneq ($(full_classes_jar),) -$(built_dpi_apk): PRIVATE_DEX_FILE := $(built_dex) -ifndef LOCAL_JACK_ENABLED -# Use the jarjar processed arhive as the initial package file. -$(built_dpi_apk): PRIVATE_SOURCE_ARCHIVE := $(full_classes_jarjar_jar) -else $(built_dpi_apk): PRIVATE_JACK_INTERMEDIATES_DIR := $(intermediates.COMMON)/jack-rsc -endif # LOCAL_JACK_ENABLED +$(built_dpi_apk): PRIVATE_DEX_FILE := $(built_dex) $(built_dpi_apk): $(built_dex) else $(built_dpi_apk): PRIVATE_DEX_FILE := @@ -51,9 +45,7 @@ $(built_dpi_apk) : $(private_key) $(certificate) $(SIGNAPK_JAR) $(built_dpi_apk) : $(AAPT) $(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) @@ -63,9 +55,7 @@ ifeq ($(full_classes_jar),) $(if $(PRIVATE_EXTRA_JAR_ARGS),$(call add-java-resources-to,$@)) else $(add-dex-to-package) -ifdef LOCAL_JACK_ENABLED $(add-carried-jack-resources) -endif endif $(sign-package) diff --git a/core/java.mk b/core/java.mk index fcfb0dd1b9..189d13f273 100644 --- a/core/java.mk +++ b/core/java.mk @@ -86,34 +86,14 @@ endif intermediates := $(call local-intermediates-dir) intermediates.COMMON := $(call local-intermediates-dir,COMMON) -# Choose leaf name for the compiled jar file. -ifeq ($(LOCAL_EMMA_INSTRUMENT),true) -full_classes_compiled_jar_leaf := classes-no-debug-var.jar -built_dex_intermediate_leaf := no-local -else -full_classes_compiled_jar_leaf := classes-full-debug.jar -built_dex_intermediate_leaf := with-local -endif - ifeq ($(LOCAL_PROGUARD_ENABLED),disabled) LOCAL_PROGUARD_ENABLED := endif -ifdef LOCAL_PROGUARD_ENABLED -proguard_jar_leaf := proguard.classes.jar -else -proguard_jar_leaf := noproguard.classes.jar -endif - -full_classes_compiled_jar := $(intermediates.COMMON)/$(full_classes_compiled_jar_leaf) -jarjar_leaf := classes-jarjar.jar -full_classes_jarjar_jar := $(intermediates.COMMON)/$(jarjar_leaf) -emma_intermediates_dir := $(intermediates.COMMON)/emma_out -# emma is hardcoded to use the leaf name of its input for the output file -- -# only the output directory can be changed -full_classes_emma_jar := $(emma_intermediates_dir)/lib/$(jarjar_leaf) -full_classes_proguard_jar := $(intermediates.COMMON)/$(proguard_jar_leaf) -built_dex_intermediate := $(intermediates.COMMON)/$(built_dex_intermediate_leaf)/classes.dex +full_classes_compiled_jar := $(intermediates.COMMON)/classes-full-debug.jar +full_classes_jarjar_jar := $(intermediates.COMMON)/classes-jarjar.jar +full_classes_proguard_jar := $(intermediates.COMMON)/proguard.classes.jar +built_dex_intermediate := $(intermediates.COMMON)/dex-dir/classes.dex full_classes_stubs_jar := $(intermediates.COMMON)/stubs.jar ifeq ($(LOCAL_MODULE_CLASS)$(LOCAL_SRC_FILES)$(LOCAL_STATIC_JAVA_LIBRARIES)$(LOCAL_SOURCE_FILES_ALL_GENERATED),APPS) @@ -133,7 +113,6 @@ jack_check_timestamp := $(intermediates.COMMON)/jack.check.timestamp LOCAL_INTERMEDIATE_TARGETS += \ $(full_classes_compiled_jar) \ $(full_classes_jarjar_jar) \ - $(full_classes_emma_jar) \ $(full_classes_jar) \ $(full_classes_proguard_jar) \ $(built_dex_intermediate) \ @@ -334,11 +313,7 @@ endif # command line. ifndef LOCAL_CHECKED_MODULE ifdef full_classes_jar -ifdef LOCAL_JACK_ENABLED LOCAL_CHECKED_MODULE := $(jack_check_timestamp) -else -LOCAL_CHECKED_MODULE := $(full_classes_compiled_jar) -endif endif endif @@ -444,31 +419,8 @@ $(full_classes_jarjar_jar): $(full_classes_compiled_jar) | $(ACP) $(hide) $(ACP) -fp $< $@ endif -ifeq ($(LOCAL_EMMA_INSTRUMENT),true) -$(full_classes_emma_jar): PRIVATE_EMMA_COVERAGE_FILE := $(intermediates.COMMON)/coverage.emma.ignore -$(full_classes_emma_jar): PRIVATE_EMMA_INTERMEDIATES_DIR := $(emma_intermediates_dir) -# module level coverage filter can be defined using LOCAL_EMMA_COVERAGE_FILTER -# in Android.mk -ifdef LOCAL_EMMA_COVERAGE_FILTER -$(full_classes_emma_jar): PRIVATE_EMMA_COVERAGE_FILTER := $(LOCAL_EMMA_COVERAGE_FILTER) -else -# by default, avoid applying emma instrumentation onto emma classes itself, -# otherwise there will be exceptions thrown -$(full_classes_emma_jar): PRIVATE_EMMA_COVERAGE_FILTER := *,-emma,-emmarun,-com.vladium.* -endif -# this rule will generate both $(PRIVATE_EMMA_COVERAGE_FILE) and -# $(full_classes_emma_jar) -$(full_classes_emma_jar): $(full_classes_jarjar_jar) | $(EMMA_JAR) - $(transform-classes.jar-to-emma) - -else -$(full_classes_emma_jar): $(full_classes_jarjar_jar) - @echo Copying: $@ - $(copy-file-to-target) -endif - # Keep a copy of the jar just before proguard processing. -$(full_classes_jar): $(full_classes_emma_jar) | $(ACP) +$(full_classes_jar): $(full_classes_jarjar_jar) | $(ACP) @echo Copying: $@ $(hide) $(ACP) -fp $< $@ @@ -514,11 +466,7 @@ common_proguard_flags := -forceprocessing ifeq ($(filter nosystem,$(LOCAL_PROGUARD_ENABLED)),) common_proguard_flags += -include $(BUILD_SYSTEM)/proguard.flags ifeq ($(LOCAL_EMMA_INSTRUMENT),true) -ifdef LOCAL_JACK_ENABLED common_proguard_flags += -include $(BUILD_SYSTEM)/proguard.jacoco.flags -else -common_proguard_flags += -include $(BUILD_SYSTEM)/proguard.emma.flags -endif # LOCAL_JACK_ENABLED endif # If this is a test package, add proguard keep flags for tests. ifneq ($(LOCAL_INSTRUMENTATION_FOR)$(filter tests,$(LOCAL_MODULE_TAGS)),) @@ -552,10 +500,9 @@ legacy_proguard_flags := -injars $(link_instr_classes_jar) \ -applymapping $(link_instr_intermediates_dir.COMMON)/proguard_dictionary \ -verbose \ $(legacy_proguard_flags) -ifdef LOCAL_JACK_ENABLED + jack_proguard_flags += -applymapping $(link_instr_intermediates_dir.COMMON)/jack_dictionary full_jack_deps += $(link_instr_intermediates_dir.COMMON)/jack_dictionary -endif # Sometimes (test + main app) uses different keep rules from the main app - # apply the main app's dictionary anyway. @@ -588,30 +535,11 @@ $(full_classes_proguard_jar) : $(full_classes_jar) | $(ACP) endif # LOCAL_PROGUARD_ENABLED defined -ifndef LOCAL_JACK_ENABLED -# Override PRIVATE_INTERMEDIATES_DIR so that install-dex-debug -# will work even when intermediates != intermediates.COMMON. -$(built_dex_intermediate): PRIVATE_INTERMEDIATES_DIR := $(intermediates.COMMON) -$(built_dex_intermediate): PRIVATE_DX_FLAGS := $(LOCAL_DX_FLAGS) -# If you instrument class files that have local variable debug information in -# them emma does not correctly maintain the local variable table. -# This will cause an error when you try to convert the class files for Android. -# The workaround here is to build different dex file here based on emma switch -# then later copy into classes.dex. When emma is on, dx is run with --no-locals -# option to remove local variable information -ifeq ($(LOCAL_EMMA_INSTRUMENT),true) -$(built_dex_intermediate): PRIVATE_DX_FLAGS += --no-locals -endif -endif # LOCAL_JACK_ENABLED is disabled - $(built_dex): $(built_dex_intermediate) | $(ACP) @echo Copying: $@ $(hide) mkdir -p $(dir $@) $(hide) rm -f $(dir $@)/classes*.dex $(hide) $(ACP) -fp $(dir $<)/classes*.dex $(dir $@) -ifneq ($(GENERATE_DEX_DEBUG),) - $(install-dex-debug) -endif findbugs_xml := $(intermediates.COMMON)/findbugs.xml $(findbugs_xml) : PRIVATE_AUXCLASSPATH := $(addprefix -auxclasspath ,$(strip \ @@ -639,7 +567,6 @@ $(LOCAL_MODULE)-findbugs : $(findbugs_html) endif # full_classes_jar is defined -ifdef LOCAL_JACK_ENABLED $(LOCAL_INTERMEDIATE_TARGETS): \ PRIVATE_JACK_INTERMEDIATES_DIR := $(intermediates.COMMON)/jack-rsc ifeq ($(LOCAL_JACK_ENABLED),incremental) @@ -730,4 +657,3 @@ $(noshrob_classes_jack): $(jack_all_deps) | setup-jack-server @echo Building with Jack: $@ $(java-to-jack) endif # full_classes_jar is defined -endif # LOCAL_JACK_ENABLED diff --git a/core/java_common.mk b/core/java_common.mk index 44dfc51e0f..f9839352f6 100644 --- a/core/java_common.mk +++ b/core/java_common.mk @@ -295,7 +295,6 @@ ALL_MODULES.$(my_register_name).INTERMEDIATE_SOURCE_DIR := \ ########################################################### # JACK ########################################################### -ifdef LOCAL_JACK_ENABLED ifdef need_compile_java LOCAL_JACK_FLAGS += -D jack.java.source.version=$(LOCAL_JAVA_LANGUAGE_VERSION) @@ -386,4 +385,3 @@ $(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_ALL_JACK_LIBRARIES:= $(full_jack_libs) $(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_JARJAR_RULES := $(LOCAL_JARJAR_RULES) endif # need_compile_java -endif # LOCAL_JACK_ENABLED diff --git a/core/java_library.mk b/core/java_library.mk index 8edba552f2..283e9adfef 100644 --- a/core/java_library.mk +++ b/core/java_library.mk @@ -28,11 +28,9 @@ LOCAL_BUILT_MODULE_STEM := javalib.jar include $(BUILD_SYSTEM)/configure_local_jack.mk ################################# -ifdef LOCAL_JACK_ENABLED ifdef LOCAL_IS_STATIC_JAVA_LIBRARY LOCAL_BUILT_MODULE_STEM := classes.jack endif -endif intermediates.COMMON := $(call local-intermediates-dir,COMMON) @@ -47,12 +45,8 @@ endif ifeq (true,$(EMMA_INSTRUMENT)) ifeq (true,$(LOCAL_EMMA_INSTRUMENT)) ifeq (true,$(EMMA_INSTRUMENT_STATIC)) -ifdef LOCAL_JACK_ENABLED # Jack supports coverage with Jacoco LOCAL_STATIC_JAVA_LIBRARIES += jacocoagent -else -LOCAL_STATIC_JAVA_LIBRARIES += emma -endif # LOCAL_JACK_ENABLED endif # LOCAL_EMMA_INSTRUMENT endif # EMMA_INSTRUMENT_STATIC else @@ -66,37 +60,21 @@ 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) : $(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) -ifdef LOCAL_JACK_ENABLED $(LOCAL_BUILT_MODULE) : $(full_classes_jack) -else -$(LOCAL_BUILT_MODULE) : $(common_javalib.jar) -endif $(copy-file-to-target) 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): PRIVATE_DONT_DELETE_JAR_DIRS := $(LOCAL_DONT_DELETE_JAR_DIRS) $(common_javalib.jar) : $(built_dex) $(java_resource_sources) | $(ZIPTIME) @echo "target Jar: $(PRIVATE_MODULE) ($@)" -ifdef LOCAL_JACK_ENABLED $(create-empty-package) -else - $(call initialize-package-file,$(PRIVATE_SOURCE_ARCHIVE),$@) -endif $(add-dex-to-package) -ifdef LOCAL_JACK_ENABLED $(add-carried-jack-resources) -endif $(remove-timestamps-from-package) ifdef LOCAL_DEX_PREOPT diff --git a/core/package_internal.mk b/core/package_internal.mk index 1ab2cf88b3..65b65be364 100644 --- a/core/package_internal.mk +++ b/core/package_internal.mk @@ -166,12 +166,10 @@ endif # need_compile_res endif # !custom LOCAL_PROGUARD_FLAGS := $(addprefix -include ,$(proguard_options_file)) $(LOCAL_PROGUARD_FLAGS) -ifdef LOCAL_JACK_ENABLED ifndef LOCAL_JACK_PROGUARD_FLAGS LOCAL_JACK_PROGUARD_FLAGS := $(LOCAL_PROGUARD_FLAGS) endif LOCAL_JACK_PROGUARD_FLAGS := $(addprefix -include ,$(proguard_options_file)) $(LOCAL_JACK_PROGUARD_FLAGS) -endif # LOCAL_JACK_ENABLED ifeq (true,$(EMMA_INSTRUMENT)) ifndef LOCAL_EMMA_INSTRUMENT @@ -184,39 +182,22 @@ else LOCAL_EMMA_INSTRUMENT := false endif # EMMA_INSTRUMENT is true +ifneq ($(LOCAL_SRC_FILES)$(LOCAL_STATIC_JAVA_LIBRARIES)$(LOCAL_SOURCE_FILES_ALL_GENERATED),) +# Only add jacocoagent if the package contains some java code ifeq (true,$(LOCAL_EMMA_INSTRUMENT)) ifeq (true,$(EMMA_INSTRUMENT_STATIC)) -ifdef LOCAL_JACK_ENABLED # Jack supports coverage with Jacoco -ifneq ($(LOCAL_SRC_FILES)$(LOCAL_STATIC_JAVA_LIBRARIES)$(LOCAL_SOURCE_FILES_ALL_GENERATED),) -# Only add jacocoagent if the package contains some java code LOCAL_STATIC_JAVA_LIBRARIES += jacocoagent -endif # Contains java code -else -LOCAL_STATIC_JAVA_LIBRARIES += emma -endif # LOCAL_JACK_ENABLED -else +else # ! EMMA_INSTRUMENT_STATIC ifdef LOCAL_SDK_VERSION ifdef TARGET_BUILD_APPS -# In unbundled build merge the emma library into the apk. -ifdef LOCAL_JACK_ENABLED # Jack supports coverage with Jacoco -ifneq ($(LOCAL_SRC_FILES)$(LOCAL_STATIC_JAVA_LIBRARIES)$(LOCAL_SOURCE_FILES_ALL_GENERATED),) -# Only add jacocoagent if the package contains some java code LOCAL_STATIC_JAVA_LIBRARIES += jacocoagent -endif # Contains java code -else -LOCAL_STATIC_JAVA_LIBRARIES += emma -endif # LOCAL_JACK_ENABLED -else -# If build against the SDK in full build, core.jar is not used, -# we have to use prebiult emma.jar to make Proguard happy; -# Otherwise emma classes are included in core.jar. -LOCAL_PROGUARD_FLAGS += -libraryjars $(EMMA_JAR) -endif # full build +endif # TARGET_BUILD_APPS endif # LOCAL_SDK_VERSION -endif # EMMA_INSTRUMENT_STATIC +endif # ! EMMA_INSTRUMENT_STATIC endif # LOCAL_EMMA_INSTRUMENT +endif # Contains java code rs_compatibility_jni_libs := @@ -297,30 +278,13 @@ $(resource_export_package): $(all_res_assets) $(full_android_manifest) $(RenderS $(add-assets-to-package) endif +# Make sure to generate R.java before compiling. # Other modules should depend on the BUILT module if # they want to use this module's R.java file. -$(LOCAL_BUILT_MODULE): $(R_file_stamp) - -ifdef LOCAL_JACK_ENABLED -ifneq ($(built_dex_intermediate),) -$(built_dex_intermediate): $(R_file_stamp) -endif -ifneq ($(noshrob_classes_jack),) -$(noshrob_classes_jack): $(R_file_stamp) -endif -ifneq ($(full_classes_jack),) -$(full_classes_jack): $(R_file_stamp) -$(jack_check_timestamp): $(R_file_stamp) -endif -endif # LOCAL_JACK_ENABLED - -ifneq ($(full_classes_jar),) -# If full_classes_jar is non-empty, we're building sources. -# If we're building sources, the initial javac step (which -# produces full_classes_compiled_jar) needs to ensure the -# R.java and Manifest.java files have been generated first. -$(full_classes_compiled_jar): $(R_file_stamp) -endif +$(LOCAL_BUILT_MODULE) \ +$(full_classes_compiled_jar) \ +$(built_dex_intermediate) $(noshrob_classes_jack) $(full_classes_jack) $(jack_check_timestamp) \ + : $(R_file_stamp) endif # need_compile_res @@ -363,12 +327,9 @@ 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 @@ -427,16 +388,9 @@ else $(LOCAL_BUILT_MODULE): PRIVATE_PRODUCT_AAPT_PREF_CONFIG := $(PRODUCT_AAPT_PREF_CONFIG) endif endif -$(LOCAL_BUILT_MODULE): PRIVATE_DONT_DELETE_JAR_DIRS := $(LOCAL_DONT_DELETE_JAR_DIRS) $(LOCAL_BUILT_MODULE): $(all_res_assets) $(jni_shared_libraries) $(full_android_manifest) @echo "target Package: $(PRIVATE_MODULE) ($@)" -ifdef LOCAL_JACK_ENABLED $(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) @@ -447,9 +401,7 @@ ifeq ($(full_classes_jar),) else # full_classes_jar $(add-dex-to-package) endif # full_classes_jar -ifdef LOCAL_JACK_ENABLED $(add-carried-jack-resources) -endif ifdef LOCAL_DEX_PREOPT ifneq ($(BUILD_PLATFORM_ZIP),) @# Keep a copy of apk with classes.dex unstripped diff --git a/core/prebuilt_internal.mk b/core/prebuilt_internal.mk index e826755164..a1a19e5c1a 100644 --- a/core/prebuilt_internal.mk +++ b/core/prebuilt_internal.mk @@ -392,9 +392,6 @@ endif # ! prebuilt_module_is_dex_javalib endif # LOCAL_IS_HOST_MODULE is not set ifneq ($(prebuilt_module_is_dex_javalib),true) -ifneq ($(LOCAL_JILL_FLAGS),) -$(error LOCAL_JILL_FLAGS is not supported any more, please use jack options in LOCAL_JACK_FLAGS instead) -endif # We may be building classes.jack from a host jar for host dalvik Java library. $(intermediates.COMMON)/classes.jack : PRIVATE_JACK_FLAGS:=$(LOCAL_JACK_FLAGS) diff --git a/core/static_java_library.mk b/core/static_java_library.mk index 8913ee4868..d3324f80bc 100644 --- a/core/static_java_library.mk +++ b/core/static_java_library.mk @@ -63,12 +63,10 @@ endif LOCAL_PROGUARD_FLAGS := $(addprefix -include ,$(proguard_options_file)) $(LOCAL_PROGUARD_FLAGS) -ifdef LOCAL_JACK_ENABLED ifndef LOCAL_JACK_PROGUARD_FLAGS LOCAL_JACK_PROGUARD_FLAGS := $(LOCAL_PROGUARD_FLAGS) endif LOCAL_JACK_PROGUARD_FLAGS := $(addprefix -include ,$(proguard_options_file)) $(LOCAL_JACK_PROGUARD_FLAGS) -endif # LOCAL_JACK_ENABLED endif # LOCAL_RESOURCE_DIR @@ -126,13 +124,10 @@ $(R_file_stamp) : $(all_resources) $(full_android_manifest) $(AAPT) $(framework_ $(create-resource-java-files) $(hide) find $(PRIVATE_SOURCE_INTERMEDIATES_DIR) -name R.java | xargs cat > $@ -$(LOCAL_BUILT_MODULE): $(R_file_stamp) -ifdef LOCAL_JACK_ENABLED -$(noshrob_classes_jack): $(R_file_stamp) -$(full_classes_jack): $(R_file_stamp) -$(jack_check_timestamp): $(R_file_stamp) -endif # LOCAL_JACK_ENABLED -$(full_classes_compiled_jar): $(R_file_stamp) +$(LOCAL_BUILT_MODULE) \ +$(full_classes_compiled_jar) \ +$(noshrob_classes_jack) $(full_classes_jack) $(jack_check_timestamp) \ + : $(R_file_stamp) # Rule to build AAR, archive including classes.jar, resource, etc. built_aar := $(intermediates.COMMON)/javalib.aar