am e334d255: Speed up the full build.

Merge commit 'e334d255dc8f85d610f4d0339227a0b985494811'

* commit 'e334d255dc8f85d610f4d0339227a0b985494811':
  Speed up the full build.
This commit is contained in:
Joe Onorato 2009-07-17 17:13:08 -07:00 committed by Android Git Automerger
commit f2bce89880
5 changed files with 116 additions and 46 deletions

View File

@ -391,6 +391,25 @@ endif
endif # !LOCAL_UNINSTALLABLE_MODULE endif # !LOCAL_UNINSTALLABLE_MODULE
###########################################################
## CHECK_BUILD goals
###########################################################
# If nobody has defined a more specific module for the
# checked modules, use LOCAL_BUILT_MODULE. This was old
# behavior, so it should be a safe default.
ifndef LOCAL_CHECKED_MODULE
LOCAL_CHECKED_MODULE := $(LOCAL_BUILT_MODULE)
endif
# If they request that this module not be checked, then don't.
# PLEASE DON'T SET THIS. ANY PLACES THAT SET THIS WITHOUT
# GOOD REASON WILL HAVE IT REMOVED.
ifdef LOCAL_DONT_CHECK_MODULE
LOCAL_CHECKED_MODULE :=
endif
########################################################### ###########################################################
## Register with ALL_MODULES ## Register with ALL_MODULES
########################################################### ###########################################################
@ -403,6 +422,8 @@ ALL_MODULES.$(LOCAL_MODULE).PATH := \
$(ALL_MODULES.$(LOCAL_MODULE).PATH) $(LOCAL_PATH) $(ALL_MODULES.$(LOCAL_MODULE).PATH) $(LOCAL_PATH)
ALL_MODULES.$(LOCAL_MODULE).TAGS := \ ALL_MODULES.$(LOCAL_MODULE).TAGS := \
$(ALL_MODULES.$(LOCAL_MODULE).TAGS) $(LOCAL_MODULE_TAGS) $(ALL_MODULES.$(LOCAL_MODULE).TAGS) $(LOCAL_MODULE_TAGS)
ALL_MODULES.$(LOCAL_MODULE).CHECKED := \
$(ALL_MODULES.$(LOCAL_MODULE).CHECKED) $(LOCAL_CHECKED_MODULE)
ALL_MODULES.$(LOCAL_MODULE).BUILT := \ ALL_MODULES.$(LOCAL_MODULE).BUILT := \
$(ALL_MODULES.$(LOCAL_MODULE).BUILT) $(LOCAL_BUILT_MODULE) $(ALL_MODULES.$(LOCAL_MODULE).BUILT) $(LOCAL_BUILT_MODULE)
ALL_MODULES.$(LOCAL_MODULE).INSTALLED := \ ALL_MODULES.$(LOCAL_MODULE).INSTALLED := \
@ -429,9 +450,6 @@ $(foreach tag,$(LOCAL_MODULE_TAGS),\
$(foreach tag,$(LOCAL_MODULE_TAGS),\ $(foreach tag,$(LOCAL_MODULE_TAGS),\
$(eval ALL_MODULE_NAME_TAGS.$(tag) += $(LOCAL_MODULE))) $(eval ALL_MODULE_NAME_TAGS.$(tag) += $(LOCAL_MODULE)))
# Always build everything, but only install a subset.
ALL_BUILT_MODULES += $(LOCAL_BUILT_MODULE)
########################################################### ###########################################################
## NOTICE files ## NOTICE files
########################################################### ###########################################################

View File

@ -5,6 +5,8 @@
LOCAL_MODULE:= LOCAL_MODULE:=
LOCAL_MODULE_PATH:= LOCAL_MODULE_PATH:=
LOCAL_MODULE_STEM:= LOCAL_MODULE_STEM:=
LOCAL_DONT_CHECK_MODULE:=
LOCAL_CHECKED_MODULE:=
LOCAL_BUILT_MODULE:= LOCAL_BUILT_MODULE:=
LOCAL_BUILT_MODULE_STEM:= LOCAL_BUILT_MODULE_STEM:=
OVERRIDE_BUILT_MODULE_PATH:= OVERRIDE_BUILT_MODULE_PATH:=

View File

@ -41,9 +41,6 @@ ALL_MODULES:=
# set of installed targets. # set of installed targets.
ALL_DEFAULT_INSTALLED_MODULES:= ALL_DEFAULT_INSTALLED_MODULES:=
# Full paths to all targets that will be built.
ALL_BUILT_MODULES:=
# The list of tags that have been defined by # The list of tags that have been defined by
# LOCAL_MODULE_TAGS. Each word in this variable maps # LOCAL_MODULE_TAGS. Each word in this variable maps
# to a corresponding ALL_MODULE_TAGS.<tagname> variable # to a corresponding ALL_MODULE_TAGS.<tagname> variable
@ -1239,21 +1236,21 @@ $(hide) rm -rf $(PRIVATE_CLASS_INTERMEDIATES_DIR)
$(hide) mkdir -p $(PRIVATE_CLASS_INTERMEDIATES_DIR) $(hide) mkdir -p $(PRIVATE_CLASS_INTERMEDIATES_DIR)
$(call unzip-jar-files,$(PRIVATE_STATIC_JAVA_LIBRARIES), \ $(call unzip-jar-files,$(PRIVATE_STATIC_JAVA_LIBRARIES), \
$(PRIVATE_CLASS_INTERMEDIATES_DIR)) $(PRIVATE_CLASS_INTERMEDIATES_DIR))
$(call dump-words-to-file,$(PRIVATE_JAVA_SOURCES),$(PRIVATE_INTERMEDIATES_DIR)/java-source-list) $(call dump-words-to-file,$(PRIVATE_JAVA_SOURCES),$(dir $(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' >> $(PRIVATE_INTERMEDIATES_DIR)/java-source-list; \ find $(PRIVATE_SOURCE_INTERMEDIATES_DIR) -name '*.java' >> $(dir $(PRIVATE_CLASS_INTERMEDIATES_DIR))/java-source-list; \
fi fi
$(hide) tr ' ' '\n' < $(PRIVATE_INTERMEDIATES_DIR)/java-source-list \ $(hide) tr ' ' '\n' < $(dir $(PRIVATE_CLASS_INTERMEDIATES_DIR))/java-source-list \
| sort -u > $(PRIVATE_INTERMEDIATES_DIR)/java-source-list-uniq | sort -u > $(dir $(PRIVATE_CLASS_INTERMEDIATES_DIR))/java-source-list-uniq
$(hide) $(TARGET_JAVAC) -encoding ascii $(PRIVATE_BOOTCLASSPATH) \ $(hide) $(TARGET_JAVAC) -encoding ascii $(PRIVATE_BOOTCLASSPATH) \
$(addprefix -classpath ,$(strip \ $(addprefix -classpath ,$(strip \
$(call normalize-path-list,$(PRIVATE_ALL_JAVA_LIBRARIES)))) \ $(call normalize-path-list,$(PRIVATE_ALL_JAVA_LIBRARIES)))) \
$(strip $(PRIVATE_JAVAC_DEBUG_FLAGS)) $(xlint_unchecked) \ $(strip $(PRIVATE_JAVAC_DEBUG_FLAGS)) $(xlint_unchecked) \
-extdirs "" -d $(PRIVATE_CLASS_INTERMEDIATES_DIR) \ -extdirs "" -d $(PRIVATE_CLASS_INTERMEDIATES_DIR) \
\@$(PRIVATE_INTERMEDIATES_DIR)/java-source-list-uniq \ \@$(dir $(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 $(PRIVATE_INTERMEDIATES_DIR)/java-source-list $(hide) rm -f $(dir $(PRIVATE_CLASS_INTERMEDIATES_DIR))/java-source-list
$(hide) rm -f $(PRIVATE_INTERMEDIATES_DIR)/java-source-list-uniq $(hide) rm -f $(dir $(PRIVATE_CLASS_INTERMEDIATES_DIR))/java-source-list-uniq
$(hide) mkdir -p $(dir $@) $(hide) mkdir -p $(dir $@)
$(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) .

View File

@ -37,6 +37,54 @@ ifneq ($(filter classes-compiled.jar classes.jar,$(LOCAL_BUILT_MODULE_STEM)),)
$(error LOCAL_BUILT_MODULE_STEM may not be "$(LOCAL_BUILT_MODULE_STEM)") $(error LOCAL_BUILT_MODULE_STEM may not be "$(LOCAL_BUILT_MODULE_STEM)")
endif endif
##############################################################################
# Define the intermediate targets before including base_rules so they get
# the correct environment.
##############################################################################
intermediates := $(call local-intermediates-dir)
intermediates.COMMON := $(call local-intermediates-dir,COMMON)
# This is cleared below, and re-set if we really need it.
full_classes_jar := $(intermediates.COMMON)/classes.jar
# Emma source code coverage
ifneq ($(EMMA_INSTRUMENT),true)
LOCAL_NO_EMMA_INSTRUMENT := true
LOCAL_NO_EMMA_COMPILE := true
endif
# Choose leaf name for the compiled jar file.
ifneq ($(LOCAL_NO_EMMA_COMPILE),true)
full_classes_compiled_jar_leaf := classes-no-debug-var.jar
else
full_classes_compiled_jar_leaf := classes-full-debug.jar
endif
full_classes_compiled_jar := $(intermediates.COMMON)/$(full_classes_compiled_jar_leaf)
emma_intermediates_dir := $(intermediates.COMMON)/emma_out
# the 'lib/$(full_classes_compiled_jar_leaf)' portion of this path is fixed in
# the emma tool
full_classes_emma_jar := $(emma_intermediates_dir)/lib/$(full_classes_compiled_jar_leaf)
full_classes_stubs_jar := $(intermediates.COMMON)/stubs.jar
full_classes_jarjar_jar := $(full_classes_jar)
built_dex := $(intermediates.COMMON)/classes.dex
LOCAL_INTERMEDIATE_TARGETS += \
$(full_classes_jar) \
$(full_classes_compiled_jar) \
$(full_classes_emma_jar) \
$(full_classes_stubs_jar) \
$(full_classes_jarjar_jar) \
$(built_dex)
# TODO: It looks like the only thing we need from base_rules is
# all_java_sources. See if we can get that by adding a
# common_java.mk, and moving the include of base_rules.mk to
# after all the declarations.
####################################### #######################################
include $(BUILD_SYSTEM)/base_rules.mk include $(BUILD_SYSTEM)/base_rules.mk
####################################### #######################################
@ -65,6 +113,7 @@ ifneq (,$(strip $(all_java_sources)))
# LOCAL_BUILT_MODULE, so it will inherit the necessary PRIVATE_* # LOCAL_BUILT_MODULE, so it will inherit the necessary PRIVATE_*
# variable definitions. # variable definitions.
full_classes_jar := $(intermediates.COMMON)/classes.jar full_classes_jar := $(intermediates.COMMON)/classes.jar
built_dex := $(intermediates.COMMON)/classes.dex
# Droiddoc isn't currently able to generate stubs for modules, so we're just # Droiddoc isn't currently able to generate stubs for modules, so we're just
# allowing it to use the classes.jar as the "stubs" that would be use to link # allowing it to use the classes.jar as the "stubs" that would be use to link
@ -74,34 +123,28 @@ full_classes_jar := $(intermediates.COMMON)/classes.jar
# it, so it's closest to what's on the device. # it, so it's closest to what's on the device.
# - This extra copy, with the dependency on LOCAL_BUILT_MODULE allows the # - This extra copy, with the dependency on LOCAL_BUILT_MODULE allows the
# PRIVATE_ vars to be preserved. # PRIVATE_ vars to be preserved.
full_classes_stubs_jar := $(intermediates.COMMON)/stubs.jar
$(full_classes_stubs_jar): PRIVATE_SOURCE_FILE := $(full_classes_jar) $(full_classes_stubs_jar): PRIVATE_SOURCE_FILE := $(full_classes_jar)
$(full_classes_stubs_jar) : $(LOCAL_BUILT_MODULE) | $(ACP) $(full_classes_stubs_jar) : $(LOCAL_BUILT_MODULE) | $(ACP)
@echo Copying $(PRIVATE_SOURCE_FILE) @echo Copying $(PRIVATE_SOURCE_FILE)
$(hide) $(ACP) -fp $(PRIVATE_SOURCE_FILE) $@ $(hide) $(ACP) -fp $(PRIVATE_SOURCE_FILE) $@
ALL_MODULES.$(LOCAL_MODULE).STUBS := $(full_classes_stubs_jar) ALL_MODULES.$(LOCAL_MODULE).STUBS := $(full_classes_stubs_jar)
# Emma source code coverage
ifneq ($(EMMA_INSTRUMENT),true)
LOCAL_NO_EMMA_INSTRUMENT := true
LOCAL_NO_EMMA_COMPILE := true
endif
# Choose leaf name for the compiled jar file.
ifneq ($(LOCAL_NO_EMMA_COMPILE),true)
full_classes_compiled_jar_leaf := classes-no-debug-var.jar
else
full_classes_compiled_jar_leaf := classes-full-debug.jar
endif
# Compile the java files to a .jar file. # Compile the java files to a .jar file.
# This intentionally depends on java_sources, not all_java_sources. # This intentionally depends on java_sources, not all_java_sources.
# Deps for generated source files must be handled separately, # Deps for generated source files must be handled separately,
# via deps on the target that generates the sources. # via deps on the target that generates the sources.
full_classes_compiled_jar := $(intermediates.COMMON)/$(full_classes_compiled_jar_leaf)
$(full_classes_compiled_jar): $(java_sources) $(full_java_lib_deps) $(full_classes_compiled_jar): $(java_sources) $(full_java_lib_deps)
$(transform-java-to-classes.jar) $(transform-java-to-classes.jar)
# All of the rules after full_classes_compiled_jar are very unlikely
# to fail except for bugs in their respective tools. If you would
# like to run these rules, add the "all" modifier goal to the make
# command line.
# This overwrites the value defined in base_rules.mk. That's a little
# dirty. It's preferable to set LOCAL_CHECKED_MODULE, but this has to
# be done after the inclusion of base_rules.mk.
ALL_MODULES.$(LOCAL_MODULE).CHECKED := $(full_classes_compiled_jar)
ifneq ($(LOCAL_NO_EMMA_COMPILE),true) ifneq ($(LOCAL_NO_EMMA_COMPILE),true)
# If you instrument class files that have local variable debug information in # If you instrument class files that have local variable debug information in
# them emma does not correctly maintain the local variable table. # them emma does not correctly maintain the local variable table.
@ -115,11 +158,6 @@ else
$(full_classes_compiled_jar): PRIVATE_JAVAC_DEBUG_FLAGS := -g $(full_classes_compiled_jar): PRIVATE_JAVAC_DEBUG_FLAGS := -g
endif endif
emma_intermediates_dir := $(intermediates.COMMON)/emma_out
# the 'lib/$(full_classes_compiled_jar_leaf)' portion of this path is fixed in
# the emma tool
full_classes_emma_jar := $(emma_intermediates_dir)/lib/$(full_classes_compiled_jar_leaf)
ifeq ($(LOCAL_IS_STATIC_JAVA_LIBRARY),true) ifeq ($(LOCAL_IS_STATIC_JAVA_LIBRARY),true)
# Skip adding emma instrumentation to class files if this is a static library, # Skip adding emma instrumentation to class files if this is a static library,
# since it will be instrumented by the package that includes it # since it will be instrumented by the package that includes it
@ -142,7 +180,6 @@ endif
# Run jarjar if necessary, otherwise just copy the file. This is the last # Run jarjar if necessary, otherwise just copy the file. This is the last
# part of this step, so the output of this command is full_classes_jar. # part of this step, so the output of this command is full_classes_jar.
full_classes_jarjar_jar := $(full_classes_jar)
ifneq ($(strip $(LOCAL_JARJAR_RULES)),) ifneq ($(strip $(LOCAL_JARJAR_RULES)),)
$(full_classes_jarjar_jar): PRIVATE_JARJAR_RULES := $(LOCAL_JARJAR_RULES) $(full_classes_jarjar_jar): PRIVATE_JARJAR_RULES := $(LOCAL_JARJAR_RULES)
$(full_classes_jarjar_jar): $(full_classes_emma_jar) | jarjar $(full_classes_jarjar_jar): $(full_classes_emma_jar) | jarjar
@ -154,9 +191,6 @@ $(full_classes_jarjar_jar): $(full_classes_emma_jar) | $(ACP)
$(hide) $(ACP) $< $@ $(hide) $(ACP) $< $@
endif endif
built_dex := $(intermediates.COMMON)/classes.dex
# Override PRIVATE_INTERMEDIATES_DIR so that install-dex-debug # Override PRIVATE_INTERMEDIATES_DIR so that install-dex-debug
# will work even when intermediates != intermediates.COMMON. # will work even when intermediates != intermediates.COMMON.
$(built_dex): PRIVATE_INTERMEDIATES_DIR := $(intermediates.COMMON) $(built_dex): PRIVATE_INTERMEDIATES_DIR := $(intermediates.COMMON)

View File

@ -126,7 +126,7 @@ endif # windows
# 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 INTERNAL_MODIFIER_TARGETS := showcommands checkbuild
# Bring in standard build system definitions. # Bring in standard build system definitions.
include $(BUILD_SYSTEM)/definitions.mk include $(BUILD_SYSTEM)/definitions.mk
@ -302,11 +302,11 @@ endef
endif endif
# If all they typed was make showcommands, we'll actually build # If they only used the modifier goals (showcommands, checkbuild), we'll actually
# the default target. # build the default target.
ifeq ($(MAKECMDGOALS),showcommands) ifeq ($(filter-out $(INTERNAL_MODIFIER_TARGETS),$(MAKECMDGOALS)),)
.PHONY: showcommands .PHONY: $(INTERNAL_MODIFIER_TARGETS)
showcommands: $(DEFAULT_GOAL) $(INTERNAL_MODIFIER_TARGETS): $(DEFAULT_GOAL)
endif endif
# These targets are going to delete stuff, don't bother including # These targets are going to delete stuff, don't bother including
@ -514,7 +514,6 @@ add-required-deps :=
# poisons the rest of the tags and shouldn't appear # poisons the rest of the tags and shouldn't appear
# on any list. # on any list.
Default_MODULES := $(sort $(ALL_DEFAULT_INSTALLED_MODULES) \ Default_MODULES := $(sort $(ALL_DEFAULT_INSTALLED_MODULES) \
$(ALL_BUILT_MODULES) \
$(CUSTOM_MODULES)) $(CUSTOM_MODULES))
# TODO: Remove the 3 places in the tree that use # TODO: Remove the 3 places in the tree that use
# ALL_DEFAULT_INSTALLED_MODULES and get rid of it from this list. # ALL_DEFAULT_INSTALLED_MODULES and get rid of it from this list.
@ -580,7 +579,7 @@ ifdef is_sdk_build
endif endif
# config/Makefile contains extra stuff that we don't want to pollute this # build/core/Makefile contains extra stuff that we don't want to pollute this
# top-level makefile with. It expects that ALL_DEFAULT_INSTALLED_MODULES # top-level makefile with. It expects that ALL_DEFAULT_INSTALLED_MODULES
# contains everything that's built during the current make, but it also further # contains everything that's built during the current make, but it also further
# extends ALL_DEFAULT_INSTALLED_MODULES. # extends ALL_DEFAULT_INSTALLED_MODULES.
@ -591,6 +590,20 @@ ALL_DEFAULT_INSTALLED_MODULES :=
endif # dont_bother endif # dont_bother
# These are additional goals that we build, in order to make sure that there
# is as little code as possible in the tree that doesn't build.
modules_to_check := $(foreach m,$(ALL_MODULES),$(ALL_MODULES.$(m).CHECKED))
# If you would like to build all goals, and not skip any intermediate
# steps, you can pass the "all" modifier goal on the commandline.
ifneq ($(filter all,$(MAKECMDGOALS)),)
modules_to_check += $(foreach m,$(ALL_MODULES),$(ALL_MODULES.$(m).BUILT))
endif
# for easier debugging
modules_to_check := $(sort $(modules_to_check))
#$(error modules_to_check $(modules_to_check))
# ------------------------------------------------------------------- # -------------------------------------------------------------------
# This is used to to get the ordering right, you can also use these, # This is used to to get the ordering right, you can also use these,
# but they're considered undocumented, so don't complain if their # but they're considered undocumented, so don't complain if their
@ -608,10 +621,16 @@ $(ALL_C_CPP_ETC_OBJECTS): | all_copied_headers
# All the droid stuff, in directories # All the droid stuff, in directories
.PHONY: files .PHONY: files
files: prebuilt $(modules_to_install) $(INSTALLED_ANDROID_INFO_TXT_TARGET) files: prebuilt \
$(modules_to_install) \
$(modules_to_check) \
$(INSTALLED_ANDROID_INFO_TXT_TARGET)
# ------------------------------------------------------------------- # -------------------------------------------------------------------
.PHONY: checkbuild
checkbuild: $(modules_to_check)
.PHONY: ramdisk .PHONY: ramdisk
ramdisk: $(INSTALLED_RAMDISK_TARGET) ramdisk: $(INSTALLED_RAMDISK_TARGET)