Merge "Add modifier goal incrementaljavac"
This commit is contained in:
commit
3d85bbd288
4 changed files with 76 additions and 11 deletions
|
@ -416,12 +416,14 @@ $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_STATIC_JAVA_LIBRARIES := $(full_static_ja
|
||||||
# to guarantee that the files in full_java_libs will
|
# to guarantee that the files in full_java_libs will
|
||||||
# be up-to-date.
|
# be up-to-date.
|
||||||
ifdef LOCAL_IS_HOST_MODULE
|
ifdef LOCAL_IS_HOST_MODULE
|
||||||
# TODO: make prebuilt java libraries use the same
|
|
||||||
# intermediates path pattern as target java libraries.
|
|
||||||
ifeq ($(LOCAL_BUILD_HOST_DEX),true)
|
ifeq ($(LOCAL_BUILD_HOST_DEX),true)
|
||||||
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := -bootclasspath $(call java-lib-files,core-hostdex,$(LOCAL_IS_HOST_MODULE))
|
||||||
|
|
||||||
full_java_libs := $(call java-lib-files,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
|
full_java_libs := $(call java-lib-files,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
|
||||||
full_java_lib_deps := $(call java-lib-deps,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
|
full_java_lib_deps := $(call java-lib-deps,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
|
||||||
else
|
else
|
||||||
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH :=
|
||||||
|
|
||||||
full_java_libs := $(addprefix $(HOST_OUT_JAVA_LIBRARIES)/,$(addsuffix $(COMMON_JAVA_PACKAGE_SUFFIX),$(LOCAL_JAVA_LIBRARIES)))
|
full_java_libs := $(addprefix $(HOST_OUT_JAVA_LIBRARIES)/,$(addsuffix $(COMMON_JAVA_PACKAGE_SUFFIX),$(LOCAL_JAVA_LIBRARIES)))
|
||||||
full_java_lib_deps := $(full_java_libs)
|
full_java_lib_deps := $(full_java_libs)
|
||||||
endif # LOCAL_BUILD_HOST_DEX
|
endif # LOCAL_BUILD_HOST_DEX
|
||||||
|
|
|
@ -1418,12 +1418,12 @@ $(hide) rm -rf $(PRIVATE_CLASS_INTERMEDIATES_DIR)
|
||||||
$(hide) mkdir -p $(dir $@)
|
$(hide) mkdir -p $(dir $@)
|
||||||
$(hide) mkdir -p $(PRIVATE_CLASS_INTERMEDIATES_DIR)
|
$(hide) mkdir -p $(PRIVATE_CLASS_INTERMEDIATES_DIR)
|
||||||
$(call unzip-jar-files,$(PRIVATE_STATIC_JAVA_LIBRARIES),$(PRIVATE_CLASS_INTERMEDIATES_DIR))
|
$(call unzip-jar-files,$(PRIVATE_STATIC_JAVA_LIBRARIES),$(PRIVATE_CLASS_INTERMEDIATES_DIR))
|
||||||
$(call dump-words-to-file,$(PRIVATE_JAVA_SOURCES),$(dir $(PRIVATE_CLASS_INTERMEDIATES_DIR))/java-source-list)
|
$(call dump-words-to-file,$(PRIVATE_JAVA_SOURCES),$(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list)
|
||||||
$(hide) if [ -d "$(PRIVATE_SOURCE_INTERMEDIATES_DIR)" ]; then \
|
$(hide) if [ -d "$(PRIVATE_SOURCE_INTERMEDIATES_DIR)" ]; then \
|
||||||
find $(PRIVATE_SOURCE_INTERMEDIATES_DIR) -name '*.java' >> $(dir $(PRIVATE_CLASS_INTERMEDIATES_DIR))/java-source-list; \
|
find $(PRIVATE_SOURCE_INTERMEDIATES_DIR) -name '*.java' >> $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list; \
|
||||||
fi
|
fi
|
||||||
$(hide) tr ' ' '\n' < $(dir $(PRIVATE_CLASS_INTERMEDIATES_DIR))java-source-list \
|
$(hide) tr ' ' '\n' < $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list \
|
||||||
| sort -u > $(dir $(PRIVATE_CLASS_INTERMEDIATES_DIR))java-source-list-uniq
|
| sort -u > $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list-uniq
|
||||||
$(hide) $(1) -encoding ascii \
|
$(hide) $(1) -encoding ascii \
|
||||||
$(strip $(PRIVATE_JAVAC_DEBUG_FLAGS)) \
|
$(strip $(PRIVATE_JAVAC_DEBUG_FLAGS)) \
|
||||||
$(if $(findstring true,$(LOCAL_WARNINGS_ENABLE)),$(xlint_unchecked),) \
|
$(if $(findstring true,$(LOCAL_WARNINGS_ENABLE)),$(xlint_unchecked),) \
|
||||||
|
@ -1433,10 +1433,10 @@ $(hide) $(1) -encoding ascii \
|
||||||
$(if $(findstring true,$(LOCAL_WARNINGS_ENABLE)),$(xlint_unchecked),) \
|
$(if $(findstring true,$(LOCAL_WARNINGS_ENABLE)),$(xlint_unchecked),) \
|
||||||
-extdirs "" -d $(PRIVATE_CLASS_INTERMEDIATES_DIR) \
|
-extdirs "" -d $(PRIVATE_CLASS_INTERMEDIATES_DIR) \
|
||||||
$(PRIVATE_JAVACFLAGS) \
|
$(PRIVATE_JAVACFLAGS) \
|
||||||
\@$(dir $(PRIVATE_CLASS_INTERMEDIATES_DIR))java-source-list-uniq \
|
\@$(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list-uniq \
|
||||||
|| ( rm -rf $(PRIVATE_CLASS_INTERMEDIATES_DIR) ; exit 41 )
|
|| ( rm -rf $(PRIVATE_CLASS_INTERMEDIATES_DIR) ; exit 41 )
|
||||||
$(hide) rm -f $(dir $(PRIVATE_CLASS_INTERMEDIATES_DIR))/java-source-list
|
$(hide) rm -f $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list
|
||||||
$(hide) rm -f $(dir $(PRIVATE_CLASS_INTERMEDIATES_DIR))/java-source-list-uniq
|
$(hide) rm -f $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list-uniq
|
||||||
$(hide) jar $(if $(strip $(PRIVATE_JAR_MANIFEST)),-cfm,-cf) \
|
$(hide) jar $(if $(strip $(PRIVATE_JAR_MANIFEST)),-cfm,-cf) \
|
||||||
$@ $(PRIVATE_JAR_MANIFEST) -C $(PRIVATE_CLASS_INTERMEDIATES_DIR) .
|
$@ $(PRIVATE_JAR_MANIFEST) -C $(PRIVATE_CLASS_INTERMEDIATES_DIR) .
|
||||||
endef
|
endef
|
||||||
|
@ -1447,6 +1447,51 @@ $(call compile-java,$(TARGET_JAVAC),$(PRIVATE_BOOTCLASSPATH))
|
||||||
$(hide) rm -rf $(PRIVATE_CLASS_INTERMEDIATES_DIR)
|
$(hide) rm -rf $(PRIVATE_CLASS_INTERMEDIATES_DIR)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
# Override the above definitions if we want to do incremetal javac
|
||||||
|
ifeq (true, $(ENABLE_INCREMENTALJAVAC))
|
||||||
|
define compile-java
|
||||||
|
$(hide) mkdir -p $(dir $@)
|
||||||
|
$(hide) mkdir -p $(PRIVATE_CLASS_INTERMEDIATES_DIR)
|
||||||
|
$(hide) touch $(PRIVATE_CLASS_INTERMEDIATES_DIR)/newstamp
|
||||||
|
$(call unzip-jar-files,$(PRIVATE_STATIC_JAVA_LIBRARIES),$(PRIVATE_CLASS_INTERMEDIATES_DIR))
|
||||||
|
$(hide) if [ -e $(PRIVATE_CLASS_INTERMEDIATES_DIR)/stamp ] ; then \
|
||||||
|
newerFlag=$$(echo -n "-newer $(PRIVATE_CLASS_INTERMEDIATES_DIR)/stamp") ; \
|
||||||
|
fi ; \
|
||||||
|
find $(PRIVATE_JAVA_SOURCES) $$newerFlag > $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list ; \
|
||||||
|
if [ -d "$(PRIVATE_SOURCE_INTERMEDIATES_DIR)" ]; then \
|
||||||
|
find $(PRIVATE_SOURCE_INTERMEDIATES_DIR) -name '*.java' $$newerFlag >> $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list; \
|
||||||
|
fi
|
||||||
|
$(hide) tr ' ' '\n' < $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list \
|
||||||
|
| sort -u > $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list-uniq
|
||||||
|
@echo "(Incremental) build source files:"
|
||||||
|
@cat $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list-uniq
|
||||||
|
$(hide) if [ -s $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list-uniq ] ; then \
|
||||||
|
$(1) -encoding ascii \
|
||||||
|
$(strip $(PRIVATE_JAVAC_DEBUG_FLAGS)) \
|
||||||
|
$(if $(findstring true,$(LOCAL_WARNINGS_ENABLE)),$(xlint_unchecked),) \
|
||||||
|
$(2) \
|
||||||
|
$(addprefix -classpath ,$(strip \
|
||||||
|
$(call normalize-path-list,$(PRIVATE_ALL_JAVA_LIBRARIES) $(PRIVATE_CLASS_INTERMEDIATES_DIR)))) \
|
||||||
|
$(if $(findstring true,$(LOCAL_WARNINGS_ENABLE)),$(xlint_unchecked),) \
|
||||||
|
-extdirs "" -d $(PRIVATE_CLASS_INTERMEDIATES_DIR) \
|
||||||
|
$(PRIVATE_JAVACFLAGS) \
|
||||||
|
\@$(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list-uniq \
|
||||||
|
|| ( exit 41 ) \
|
||||||
|
fi
|
||||||
|
$(hide) rm -f $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list
|
||||||
|
$(hide) rm -f $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list-uniq
|
||||||
|
$(hide) rm -f $@
|
||||||
|
$(hide) jar $(if $(strip $(PRIVATE_JAR_MANIFEST)),-cfm,-cf) \
|
||||||
|
$@ $(PRIVATE_JAR_MANIFEST) -C $(PRIVATE_CLASS_INTERMEDIATES_DIR) .
|
||||||
|
$(hide) mv $(PRIVATE_CLASS_INTERMEDIATES_DIR)/newstamp $(PRIVATE_CLASS_INTERMEDIATES_DIR)/stamp
|
||||||
|
endef
|
||||||
|
|
||||||
|
define transform-java-to-classes.jar
|
||||||
|
@echo "target Java: $(PRIVATE_MODULE) ($(PRIVATE_CLASS_INTERMEDIATES_DIR))"
|
||||||
|
$(call compile-java,$(TARGET_JAVAC),$(PRIVATE_BOOTCLASSPATH))
|
||||||
|
endef
|
||||||
|
endif # ENABLE_INCREMENTALJAVAC
|
||||||
|
|
||||||
define transform-classes.jar-to-emma
|
define transform-classes.jar-to-emma
|
||||||
$(hide) java -classpath $(EMMA_JAR) emma instr -outmode fullcopy -outfile \
|
$(hide) java -classpath $(EMMA_JAR) emma instr -outmode fullcopy -outfile \
|
||||||
$(PRIVATE_EMMA_COVERAGE_FILE) -ip $< -d $(PRIVATE_EMMA_INTERMEDIATES_DIR) \
|
$(PRIVATE_EMMA_COVERAGE_FILE) -ip $< -d $(PRIVATE_EMMA_INTERMEDIATES_DIR) \
|
||||||
|
@ -1570,7 +1615,7 @@ endef
|
||||||
# in transform-java-to-classes for the sake of vm-tests.
|
# in transform-java-to-classes for the sake of vm-tests.
|
||||||
define transform-host-java-to-package
|
define transform-host-java-to-package
|
||||||
@echo "host Java: $(PRIVATE_MODULE) ($(PRIVATE_CLASS_INTERMEDIATES_DIR))"
|
@echo "host Java: $(PRIVATE_MODULE) ($(PRIVATE_CLASS_INTERMEDIATES_DIR))"
|
||||||
$(call compile-java,$(HOST_JAVAC),)
|
$(call compile-java,$(HOST_JAVAC),$(PRIVATE_BOOTCLASSPATH))
|
||||||
$(hide) if [ ! -z "$(PRIVATE_EXTRA_JAR_ARGS)" ]; then jar uf $@ $(PRIVATE_EXTRA_JAR_ARGS); fi
|
$(hide) if [ ! -z "$(PRIVATE_EXTRA_JAR_ARGS)" ]; then jar uf $@ $(PRIVATE_EXTRA_JAR_ARGS); fi
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
|
18
core/main.mk
18
core/main.mk
|
@ -155,7 +155,23 @@ endif
|
||||||
# These are the modifier targets that don't do anything themselves, but
|
# These are the modifier targets that don't do anything themselves, but
|
||||||
# change the behavior of the build.
|
# change the behavior of the build.
|
||||||
# (must be defined before including definitions.make)
|
# (must be defined before including definitions.make)
|
||||||
INTERNAL_MODIFIER_TARGETS := showcommands checkbuild all
|
INTERNAL_MODIFIER_TARGETS := showcommands checkbuild all incrementaljavac
|
||||||
|
|
||||||
|
.PHONY: incrementaljavac
|
||||||
|
incrementaljavac: ;
|
||||||
|
|
||||||
|
# WARNING:
|
||||||
|
# ENABLE_INCREMENTALJAVAC should NOT be enabled by default, because change of
|
||||||
|
# a Java source file won't trigger rebuild of its dependent Java files.
|
||||||
|
# You can only enable it by adding "incrementaljavac" to your make command line.
|
||||||
|
# You are responsible for the correctness of the incremental build.
|
||||||
|
# This may decrease incremental build time dramatically for large Java libraries,
|
||||||
|
# such as core.jar, framework.jar, etc.
|
||||||
|
ENABLE_INCREMENTALJAVAC :=
|
||||||
|
ifneq (,$(filter incrementaljavac, $(MAKECMDGOALS)))
|
||||||
|
ENABLE_INCREMENTALJAVAC := true
|
||||||
|
MAKECMDGOALS := $(filter-out incrementaljavac, $(MAKECMDGOALS))
|
||||||
|
endif
|
||||||
|
|
||||||
# Bring in standard build system definitions.
|
# Bring in standard build system definitions.
|
||||||
include $(BUILD_SYSTEM)/definitions.mk
|
include $(BUILD_SYSTEM)/definitions.mk
|
||||||
|
|
|
@ -695,6 +695,8 @@ function mmm()
|
||||||
ARGS="$ARGS showcommands"
|
ARGS="$ARGS showcommands"
|
||||||
elif [ "$DIR" = dist ]; then
|
elif [ "$DIR" = dist ]; then
|
||||||
ARGS="$ARGS dist"
|
ARGS="$ARGS dist"
|
||||||
|
elif [ "$DIR" = incrementaljavac ]; then
|
||||||
|
ARGS="$ARGS incrementaljavac"
|
||||||
else
|
else
|
||||||
echo "No Android.mk in $DIR."
|
echo "No Android.mk in $DIR."
|
||||||
return 1
|
return 1
|
||||||
|
|
Loading…
Reference in a new issue