Merge "Use Jack to check build"
am: 6a9d0f9718
* commit '6a9d0f9718f127475d702ae6831a2bec3be976b6':
Use Jack to check build
This commit is contained in:
commit
4fd0463191
|
@ -2000,6 +2000,38 @@ $(if $(PRIVATE_JAR_EXCLUDE_PACKAGES), $(hide) echo unsupported options JAR_EXCLU
|
|||
$(if $(PRIVATE_JAR_MANIFEST), $(hide) echo unsupported options JAR_MANIFEST in $@; exit 53)
|
||||
endef
|
||||
|
||||
# Invoke Jack to compile java source just to check it compiles correctly.
|
||||
#
|
||||
# Some historical notes:
|
||||
# - below we write the list of java files to java-source-list to avoid argument
|
||||
# list length problems with Cygwin
|
||||
# - we filter out duplicate java file names because Jack doesn't like them.
|
||||
define jack-check-java
|
||||
$(hide) rm -f $@
|
||||
$(hide) rm -f $@.java-source-list
|
||||
$(hide) rm -f $@.java-source-list-uniq
|
||||
$(hide) mkdir -p $(dir $@)
|
||||
$(if $(PRIVATE_JACK_INCREMENTAL_DIR),$(hide) mkdir -p $(PRIVATE_JACK_INCREMENTAL_DIR))
|
||||
$(call dump-words-to-file,$(PRIVATE_JAVA_SOURCES),$@.java-source-list)
|
||||
$(hide) if [ -d "$(PRIVATE_SOURCE_INTERMEDIATES_DIR)" ]; then \
|
||||
find $(PRIVATE_SOURCE_INTERMEDIATES_DIR) -name '*.java' >> $@.java-source-list; \
|
||||
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)) \
|
||||
$(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 \
|
||||
-D jack.import.type.policy=keep-first \
|
||||
$(if $(PRIVATE_JACK_INCREMENTAL_DIR),--incremental-folder $(PRIVATE_JACK_INCREMENTAL_DIR)) \
|
||||
@$@.java-source-list-uniq; \
|
||||
fi
|
||||
touch $@
|
||||
endef
|
||||
|
||||
define transform-jar-to-jack
|
||||
$(hide) mkdir -p $(dir $@)
|
||||
$(hide) mkdir -p $@.tmpjill.res
|
||||
|
|
|
@ -36,6 +36,7 @@ full_classes_compiled_jar := $(intermediates.COMMON)/classes-full-debug.jar
|
|||
full_classes_jarjar_jar := $(intermediates.COMMON)/classes-jarjar.jar
|
||||
full_classes_jar := $(intermediates.COMMON)/classes.jar
|
||||
full_classes_jack := $(intermediates.COMMON)/classes.jack
|
||||
jack_check_timestamp := $(intermediates.COMMON)/jack.check.timestamp
|
||||
built_dex := $(intermediates.COMMON)/classes.dex
|
||||
|
||||
LOCAL_INTERMEDIATE_TARGETS += \
|
||||
|
@ -43,12 +44,17 @@ LOCAL_INTERMEDIATE_TARGETS += \
|
|||
$(full_classes_jarjar_jar) \
|
||||
$(full_classes_jack) \
|
||||
$(full_classes_jar) \
|
||||
$(jack_check_timestamp) \
|
||||
$(built_dex)
|
||||
|
||||
# See comment in java.mk
|
||||
ifndef LOCAL_CHECKED_MODULE
|
||||
ifdef LOCAL_JACK_ENABLED
|
||||
LOCAL_CHECKED_MODULE := $(jack_check_timestamp)
|
||||
else
|
||||
LOCAL_CHECKED_MODULE := $(full_classes_compiled_jar)
|
||||
endif
|
||||
endif
|
||||
|
||||
#######################################
|
||||
include $(BUILD_SYSTEM)/base_rules.mk
|
||||
|
@ -120,16 +126,21 @@ else
|
|||
$(LOCAL_INTERMEDIATE_TARGETS): \
|
||||
PRIVATE_JACK_INCREMENTAL_DIR :=
|
||||
endif
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_FLAGS := $(GLOBAL_JAVAC_DEBUG_FLAGS) $(LOCAL_JACK_FLAGS)
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_VERSION := $(LOCAL_JACK_VERSION)
|
||||
|
||||
$(built_dex): PRIVATE_CLASSES_JACK := $(full_classes_jack)
|
||||
$(built_dex): PRIVATE_JACK_FLAGS := $(GLOBAL_JAVAC_DEBUG_FLAGS) $(LOCAL_JACK_FLAGS)
|
||||
$(built_dex): PRIVATE_JACK_VERSION := $(LOCAL_JACK_VERSION)
|
||||
$(built_dex): $(java_sources) $(java_resource_sources) $(full_jack_deps) \
|
||||
jack_all_deps := $(java_sources) $(java_resource_sources) $(full_jack_deps) \
|
||||
$(jar_manifest_file) $(proto_java_sources_file_stamp) \
|
||||
$(LOCAL_ADDITIONAL_DEPENDENCIES) $(JACK) | setup-jack-server
|
||||
$(LOCAL_ADDITIONAL_DEPENDENCIES) $(JACK)
|
||||
$(built_dex): PRIVATE_CLASSES_JACK := $(full_classes_jack)
|
||||
$(built_dex): $(jack_all_deps) | setup-jack-server
|
||||
@echo Building with Jack: $@
|
||||
$(jack-java-to-dex)
|
||||
|
||||
$(jack_check_timestamp): $(jack_all_deps) | setup-jack-server
|
||||
@echo Checking build with Jack: $@
|
||||
$(jack-check-java)
|
||||
|
||||
# $(full_classes_jack) is just by-product of $(built_dex).
|
||||
# The dummy command was added because, without it, make misses the fact the $(built_dex) also
|
||||
# change $(full_classes_jack).
|
||||
|
|
|
@ -35,8 +35,9 @@ LOCAL_INTERMEDIATE_TARGETS += \
|
|||
include $(BUILD_SYSTEM)/host_java_library.mk
|
||||
# proguard is not supported
|
||||
# *.proto files are not supported
|
||||
$(full_classes_jack): PRIVATE_JACK_FLAGS := $(GLOBAL_JAVAC_DEBUG_FLAGS) $(LOCAL_JACK_FLAGS)
|
||||
$(full_classes_jack): PRIVATE_JACK_VERSION := $(LOCAL_JACK_VERSION)
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_FLAGS := $(GLOBAL_JAVAC_DEBUG_FLAGS) $(LOCAL_JACK_FLAGS)
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_VERSION := $(LOCAL_JACK_VERSION)
|
||||
|
||||
$(full_classes_jack): PRIVATE_JARJAR_RULES := $(LOCAL_JARJAR_RULES)
|
||||
$(full_classes_jack): \
|
||||
PRIVATE_JACK_INTERMEDIATES_DIR := $(intermediates.COMMON)/jack-rsc
|
||||
|
|
19
core/java.mk
19
core/java.mk
|
@ -119,6 +119,7 @@ endif
|
|||
full_classes_jack := $(intermediates.COMMON)/classes.jack
|
||||
# intermediate Jack library without shrink and obfuscation
|
||||
noshrob_classes_jack := $(intermediates.COMMON)/classes.noshrob.jack
|
||||
jack_check_timestamp := $(intermediates.COMMON)/jack.check.timestamp
|
||||
|
||||
LOCAL_INTERMEDIATE_TARGETS += \
|
||||
$(full_classes_compiled_jar) \
|
||||
|
@ -129,6 +130,7 @@ LOCAL_INTERMEDIATE_TARGETS += \
|
|||
$(built_dex_intermediate) \
|
||||
$(full_classes_jack) \
|
||||
$(noshrob_classes_jack) \
|
||||
$(jack_check_timestamp) \
|
||||
$(built_dex) \
|
||||
$(full_classes_stubs_jar)
|
||||
|
||||
|
@ -323,9 +325,13 @@ 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
|
||||
|
||||
#######################################
|
||||
include $(BUILD_SYSTEM)/base_rules.mk
|
||||
|
@ -630,9 +636,13 @@ $(LOCAL_INTERMEDIATE_TARGETS): \
|
|||
ifeq ($(LOCAL_JACK_ENABLED),incremental)
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): \
|
||||
PRIVATE_JACK_INCREMENTAL_DIR := $(intermediates.COMMON)/jack-incremental
|
||||
$(noshrob_classes_jack): PRIVATE_JACK_INCREMENTAL_DIR := $(intermediates.COMMON)/jack-noshrob-incremental
|
||||
$(jack_check_timestamp): PRIVATE_JACK_INCREMENTAL_DIR := $(intermediates.COMMON)/jack-check-incremental
|
||||
else
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): \
|
||||
PRIVATE_JACK_INCREMENTAL_DIR :=
|
||||
$(noshrob_classes_jack): PRIVATE_JACK_INCREMENTAL_DIR :=
|
||||
$(jack_check_timestamp): PRIVATE_JACK_INCREMENTAL_DIR :=
|
||||
endif
|
||||
|
||||
ifdef full_classes_jar
|
||||
|
@ -665,6 +675,10 @@ jack_all_deps := $(java_sources) $(java_resource_sources) $(full_jack_deps) \
|
|||
$(proto_java_sources_file_stamp) $(LOCAL_ADDITIONAL_DEPENDENCIES) $(LOCAL_JARJAR_RULES) \
|
||||
$(JACK)
|
||||
|
||||
$(jack_check_timestamp): $(jack_all_deps)
|
||||
@echo Checking build with Jack: $@
|
||||
$(jack-check-java)
|
||||
|
||||
ifeq ($(LOCAL_IS_STATIC_JAVA_LIBRARY),true)
|
||||
$(full_classes_jack): $(jack_all_deps) | setup-jack-server
|
||||
@echo Building with Jack: $@
|
||||
|
@ -702,11 +716,6 @@ $(call define-dex-to-toc-rule, $(intermediates.COMMON))
|
|||
endif #LOCAL_IS_STATIC_JAVA_LIBRARY
|
||||
|
||||
$(noshrob_classes_jack): PRIVATE_JACK_INTERMEDIATES_DIR := $(intermediates.COMMON)/jack-noshrob-rsc
|
||||
ifeq ($(LOCAL_JACK_ENABLED),incremental)
|
||||
$(noshrob_classes_jack): PRIVATE_JACK_INCREMENTAL_DIR := $(intermediates.COMMON)/jack-noshrob-incremental
|
||||
else
|
||||
$(noshrob_classes_jack): PRIVATE_JACK_INCREMENTAL_DIR :=
|
||||
endif
|
||||
$(noshrob_classes_jack): PRIVATE_JACK_PROGUARD_FLAGS :=
|
||||
$(noshrob_classes_jack): $(jack_all_deps) | setup-jack-server
|
||||
@echo Building with Jack: $@
|
||||
|
|
|
@ -304,6 +304,7 @@ $(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
|
||||
|
||||
|
|
|
@ -130,6 +130,7 @@ $(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)
|
||||
|
||||
|
|
Loading…
Reference in New Issue