Skip to content

Commit

Permalink
8146403: Windows build can be faster
Browse files Browse the repository at this point in the history
Reviewed-by: ihse
  • Loading branch information
erikj committed Jan 16, 2016
1 parent f51c1c2 commit 2c69287
Show file tree
Hide file tree
Showing 17 changed files with 179 additions and 133 deletions.
2 changes: 1 addition & 1 deletion common/autoconf/generated-configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4839,7 +4839,7 @@ VS_SDK_PLATFORM_NAME_2013=
#CUSTOM_AUTOCONF_INCLUDE

# Do not change or remove the following line, it is needed for consistency checks:
DATE_WHEN_GENERATED=1452780299
DATE_WHEN_GENERATED=1452935762

###############################################################################
#
Expand Down
2 changes: 1 addition & 1 deletion make/BuildStatic.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ MODULES_SYMBOLS_FILES := $(foreach module, $(EXPORTED_SYMBOLS_MODULES), \
$(SUPPORT_OUTPUTDIR)/modules_libs/$(module)/$(module).symbols)

$(GLOBAL_SYMBOLS_FILE): $(MODULES_SYMBOLS_FILES)
$(ECHO) $(LOG_INFO) "Generating global exported.symbols file"
$(call LogInfo, Generating global exported.symbols file)
$(MKDIR) -p $(@D)
$(CAT) $^ > $@

Expand Down
64 changes: 64 additions & 0 deletions make/GenerateModuleDeps.gmk
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#
# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#

# This file is included from Main.gmk only.

include $(SRC_ROOT)/make/common/JavaCompilation.gmk
include $(SRC_ROOT)/make/common/SetupJavaCompilers.gmk

################################################################################

$(eval $(call SetupJavaCompilation, BUILD_GENMODULESLIST, \
SETUP := BOOT_JAVAC, \
SRC := $(JDK_TOPDIR)/make/src/classes, \
INCLUDES := build/tools/module, \
EXCLUDE_FILES := ImageBuilder.java ModuleArchive.java, \
BIN := $(MAKESUPPORT_OUTPUTDIR)/bt_classes_moduleslist, \
DISABLE_SJAVAC := true, \
))

TOOL_GENMODULESLIST = $(JAVA_SMALL) \
-cp "$(MAKESUPPORT_OUTPUTDIR)/bt_classes_moduleslist" \
build.tools.module.GenModulesList

MODULES_LIST_FILE := $(MAKESUPPORT_OUTPUTDIR)/modules.list
# The module deps makefile is used from make/common/Modules.gmk
MODULE_DEPS_MAKEFILE := $(MAKESUPPORT_OUTPUTDIR)/module-deps.gmk

$(MODULES_LIST_FILE): $(SRC_ROOT)/modules.xml $(BUILD_GENMODULESLIST)
$(TOOL_GENMODULESLIST) -o $@ $(filter %.xml, $^)

$(MODULE_DEPS_MAKEFILE): $(MODULES_LIST_FILE)
$(CAT) $^ | $(SED) -e 's/^\([^:]*\):/DEPS_\1 :=/g' > $@

TARGETS += $(MODULE_DEPS_MAKEFILE)

################################################################################

# Hook to include the corresponding custom file, if present.
$(eval $(call IncludeCustomExtension, , GenerateModuleDeps.gmk))

# Trigger generation of this file and restart make if it changed.
-include $(MODULE_DEPS_MAKEFILE)
10 changes: 7 additions & 3 deletions make/HotspotWrapper.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,18 @@ include MakeBase.gmk

default: all

# Get all files except .hg in the hotspot directory.
HOTSPOT_FILES := $(shell $(FIND) -L $(HOTSPOT_TOPDIR) -name ".hg" -prune -o -print)
# Get all files in src, make or agent subdirs in hotspot directory and
# filter out .hg. This skips the test directory.
HOTSPOT_FILES := $(shell $(FIND) -L \
$(HOTSPOT_TOPDIR)/src $(HOTSPOT_TOPDIR)/make $(HOTSPOT_TOPDIR)/agent \
-name ".hg" -prune -o -print)

# The old build creates hotspot output dir before calling hotspot and
# not doing it breaks builds on msys.
$(HOTSPOT_OUTPUTDIR)/_hotspot.timestamp: $(HOTSPOT_FILES)
@$(MKDIR) -p $(HOTSPOT_OUTPUTDIR)
@($(CD) $(HOTSPOT_TOPDIR)/make && $(MAKE) $(HOTSPOT_MAKE_ARGS) LOG_LEVEL=$(LOG_LEVEL) SPEC=$(HOTSPOT_SPEC) BASE_SPEC=$(BASE_SPEC))
@($(CD) $(HOTSPOT_TOPDIR)/make && $(MAKE) $(HOTSPOT_MAKE_ARGS) \
LOG_LEVEL=$(LOG_LEVEL) SPEC=$(HOTSPOT_SPEC) BASE_SPEC=$(BASE_SPEC))
$(TOUCH) $@

hotspot: $(HOTSPOT_OUTPUTDIR)/_hotspot.timestamp
Expand Down
52 changes: 22 additions & 30 deletions make/Images.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -248,38 +248,38 @@ ifneq ($(OPENJDK_TARGET_OS), windows)
endif

$(JRE_IMAGE_DIR)/man/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/%
$(ECHO) $(LOG_INFO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
$(call LogInfo, Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@))
$(install-file)

$(JDK_IMAGE_DIR)/man/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/%
$(ECHO) $(LOG_INFO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
$(call LogInfo, Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@))
$(install-file)

$(JRE_IMAGE_DIR)/man/ja_JP.UTF-8/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
$(ECHO) $(LOG_INFO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
$(call LogInfo, Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@))
$(install-file)

$(JDK_IMAGE_DIR)/man/ja_JP.UTF-8/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
$(ECHO) $(LOG_INFO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
$(call LogInfo, Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@))
$(install-file)

ifeq ($(OPENJDK_TARGET_OS), solaris)
$(JRE_IMAGE_DIR)/man/ja/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
$(ECHO) $(LOG_INFO) Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@)
$(call LogInfo, Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@))
$(install-file)

$(JDK_IMAGE_DIR)/man/ja/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
$(ECHO) $(LOG_INFO) Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@)
$(call LogInfo, Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@))
$(install-file)
endif

ifneq ($(findstring $(OPENJDK_TARGET_OS), linux macosx), )
$(JRE_IMAGE_DIR)/man/ja:
$(ECHO) $(LOG_INFO) Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
$(call LogInfo, Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@))
$(CD) $(@D) && $(RM) ja && $(LN) -s ja_JP.UTF-8 ja

$(JDK_IMAGE_DIR)/man/ja:
$(ECHO) $(LOG_INFO) Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
$(call LogInfo, Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@))
$(CD) $(@D) && $(RM) ja && $(LN) -s ja_JP.UTF-8 ja
endif

Expand Down Expand Up @@ -333,7 +333,7 @@ JDK_DOC_TARGETS := $(addprefix $(JDK_IMAGE_DIR)/, $(JDK_DOC_FILES))
# Processing license files from source area to image area
# These are modified to have the platform specific EOL chars.
define process-doc-file
$(ECHO) $(LOG_INFO) Processing $(patsubst $(OUTPUT_ROOT)/%,%,$@)
$(call LogInfo, Processing $(patsubst $(OUTPUT_ROOT)/%,%,$@))
$(MKDIR) -p $(@D)
$(RM) $@
LC_ALL=C $(SED) 's/$$//g' $< > $@
Expand Down Expand Up @@ -378,7 +378,7 @@ endef

# Param 1 - The file containing the MODULES list
define prepare-info-file
$(ECHO) $(LOG_INFO) Generating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
$(call LogInfo, Generating $(patsubst $(OUTPUT_ROOT)/%,%,$@))
$(MKDIR) -p $(@D)
$(RM) $@
endef
Expand Down Expand Up @@ -426,38 +426,30 @@ JRE_COMPACT3_TARGETS += $(JRE_COMPACT3_INFO_FILE)
# src.zip

$(JDK_IMAGE_DIR)/src.zip: $(SUPPORT_OUTPUTDIR)/src.zip
$(ECHO) $(LOG_INFO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
$(call LogInfo, Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@))
$(install-file)

JDK_TARGETS += $(JDK_IMAGE_DIR)/src.zip

################################################################################
# /demo dir

# The db demo contains an empty dir that needs to be copied. The other
# directories will always trigger the rule for recompile since
# _the.list_of_packages files are touched.
ifneq ($(findstring images, $(MAKECMDGOALS)), )
$(JDK_IMAGE_DIR)/demo/%: $(SUPPORT_OUTPUTDIR)/demos/image/%
if [ ! -d "$@" ]; then \
$(ECHO) $(LOG_INFO) Copying '$(patsubst $(OUTPUT_ROOT)/%,%,$@)'; \
$(MKDIR) -p $(@D); \
if [ -d "$<" ]; then $(MKDIR) -p $@; else $(CP) '$<' '$@'; fi \
fi

# Find all files including directories
JDK_DEMO_TARGETS := $(if $(wildcard $(SUPPORT_OUTPUTDIR)/demos/image), \
$(patsubst $(SUPPORT_OUTPUTDIR)/demos/image/%, $(JDK_IMAGE_DIR)/demo/%, \
$(shell $(FIND) $(SUPPORT_OUTPUTDIR)/demos/image \
! \( -name "_the*" -o -name "javac_state" \) )))

JDK_TARGETS += $(JDK_DEMO_TARGETS)
$(eval $(call SetupCopyFiles, JDK_COPY_DEMOS, \
SRC := $(SUPPORT_OUTPUTDIR)/demos/image, \
DEST := $(JDK_IMAGE_DIR)/demo, \
FILES := $(if $(wildcard $(SUPPORT_OUTPUTDIR)/demos/image), \
$(call DoubleDollar, $(call DoubleDollar, \
$(shell $(FIND) $(SUPPORT_OUTPUTDIR)/demos/image \
-type f -a ! \( -name "_the*" -o -name "javac_state" \) )))), \
))

JDK_TARGETS += $(JDK_COPY_DEMOS)
endif

################################################################################
# /sample dir

$(eval $(call SetupCopyFiles,COPY_SAMPLES, \
$(eval $(call SetupCopyFiles, COPY_SAMPLES, \
SRC := $(SUPPORT_OUTPUTDIR)/sample/image, \
DEST := $(JDK_IMAGE_DIR)/sample, \
FILES := $(if $(wildcard $(SUPPORT_OUTPUTDIR)/sample/image), \
Expand Down
19 changes: 10 additions & 9 deletions make/Init.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,8 @@ else # HAS_SPEC=true
$(eval $(call ParseCompareBuild))

ifeq ($(LOG_NOFILE), true)
# Disable log wrapper if LOG=[level,]nofile was given
override BUILD_LOG_WRAPPER :=
# Disable build log if LOG=[level,]nofile was given
override BUILD_LOG_PIPE :=
endif

ifeq ($(OUTPUT_SYNC_SUPPORTED), true)
Expand Down Expand Up @@ -277,10 +277,10 @@ else # HAS_SPEC=true
ifneq ($(SEQUENTIAL_TARGETS)$(PARALLEL_TARGETS), )
$(call RotateLogFiles)
$(call PrepareFailureLogs)
$(BUILD_LOG_WRAPPER) $(PRINTF) "Building $(TARGET_DESCRIPTION)\n"
$(PRINTF) "Building $(TARGET_DESCRIPTION)\n" $(BUILD_LOG_PIPE)
ifneq ($(SEQUENTIAL_TARGETS), )
# Don't touch build output dir since we might be cleaning. That
# means no log wrapper.
# means no log pipe.
( cd $(TOPDIR) && \
$(MAKE) $(MAKE_ARGS) -j 1 -f make/Main.gmk $(USER_MAKE_VARS) \
$(SEQUENTIAL_TARGETS) )
Expand All @@ -289,19 +289,20 @@ else # HAS_SPEC=true
$(call StartGlobalTimer)
$(call PrepareSmartJavac)
( cd $(TOPDIR) && \
$(BUILD_LOG_WRAPPER) $(NICE) $(MAKE) $(MAKE_ARGS) $(OUTPUT_SYNC_FLAG) \
$(NICE) $(MAKE) $(MAKE_ARGS) $(OUTPUT_SYNC_FLAG) \
-j $(JOBS) -f make/Main.gmk $(USER_MAKE_VARS) \
$(PARALLEL_TARGETS) $(COMPARE_BUILD_MAKE) || \
( exitcode=$$? && $(BUILD_LOG_WRAPPER) \
$(PRINTF) "\nERROR: Build failed for $(TARGET_DESCRIPTION) (exit code $$exitcode) \n" && \
$(PARALLEL_TARGETS) $(COMPARE_BUILD_MAKE) $(BUILD_LOG_PIPE) || \
( exitcode=$$? && \
$(PRINTF) "\nERROR: Build failed for $(TARGET_DESCRIPTION) (exit code $$exitcode) \n" \
$(BUILD_LOG_PIPE) && \
cd $(TOPDIR) && $(MAKE) $(MAKE_ARGS) -j 1 -f make/Init.gmk \
HAS_SPEC=true on-failure ; \
exit $$exitcode ) )
$(call CleanupSmartJavac)
$(call StopGlobalTimer)
$(call ReportBuildTimes)
endif
$(BUILD_LOG_WRAPPER) $(PRINTF) "Finished building $(TARGET_DESCRIPTION)\n"
$(PRINTF) "Finished building $(TARGET_DESCRIPTION)\n" $(BUILD_LOG_PIPE)
endif

on-failure:
Expand Down
33 changes: 19 additions & 14 deletions make/InitSupport.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ ifeq ($(HAS_SPEC),)
else ifeq ($$(LOG_LEVEL), debug)
MAKE_LOG_FLAGS :=
else ifeq ($$(LOG_LEVEL), trace)
MAKE_LOG_FLAGS := -d
MAKE_LOG_FLAGS :=
else
$$(info Error: LOG must be one of: warn, info, debug or trace.)
$$(error Cannot continue)
Expand Down Expand Up @@ -235,11 +235,15 @@ ifeq ($(HAS_SPEC),)
$$(foreach var, $$(all_confs), $$(info * $$(var)))
$$(error Cannot continue)
else
ifeq ($$(words $$(matching_confs)), 1)
$$(info Building configuration '$$(matching_confs)' (matching CONF=$$(CONF)))
else
$$(info Building these configurations (matching CONF=$$(CONF)):)
$$(foreach var, $$(matching_confs), $$(info * $$(var)))
# Don't repeat this output on make restarts caused by including
# generated files.
ifeq ($$(MAKE_RESTARTS),)
ifeq ($$(words $$(matching_confs)), 1)
$$(info Building configuration '$$(matching_confs)' (matching CONF=$$(CONF)))
else
$$(info Building these configurations (matching CONF=$$(CONF)):)
$$(foreach var, $$(matching_confs), $$(info * $$(var)))
endif
endif
endif

Expand Down Expand Up @@ -284,7 +288,7 @@ ifeq ($(HAS_SPEC),)

$$(main_targets_file):
@( cd $$(topdir) && \
$$(MAKE) $$(MAKE_LOG_FLAGS) -r -R -f $$(topdir)/make/Main.gmk \
$$(MAKE) $$(MAKE_LOG_FLAGS) -r -R -f $$(topdir)/make/Main.gmk \
-I $$(topdir)/make/common SPEC=$(strip $2) NO_RECIPES=true \
LOG_LEVEL=$$(LOG_LEVEL) \
create-main-targets-include )
Expand Down Expand Up @@ -313,7 +317,7 @@ else # $(HAS_SPEC)=true
BUILD_LOG := $(OUTPUT_ROOT)/build.log
BUILD_TRACE_LOG := $(OUTPUT_ROOT)/build-trace-time.log

BUILD_LOG_WRAPPER := $(BASH) $(SRC_ROOT)/common/bin/logger.sh $(BUILD_LOG)
BUILD_LOG_PIPE := > >($(TEE) -a $(BUILD_LOG)) 2> >($(TEE) -a $(BUILD_LOG) >&2)

# Sanity check the spec file, so it matches this source code
define CheckSpecSanity
Expand Down Expand Up @@ -455,7 +459,7 @@ else # $(HAS_SPEC)=true
endef

define RotateLogFiles
$(RM) $(BUILD_LOG).old 2> /dev/null
$(RM) $(BUILD_LOG).old 2> /dev/null && \
$(MV) $(BUILD_LOG) $(BUILD_LOG).old 2> /dev/null || true
$(if $(findstring trace, $(LOG_LEVEL)), \
$(RM) $(BUILD_TRACE_LOG).old 2> /dev/null && \
Expand All @@ -464,7 +468,7 @@ else # $(HAS_SPEC)=true
endef

define PrepareFailureLogs
$(RM) -r $(MAKESUPPORT_OUTPUTDIR)/failure-logs 2> /dev/null
$(RM) -r $(MAKESUPPORT_OUTPUTDIR)/failure-logs 2> /dev/null && \
$(MKDIR) -p $(MAKESUPPORT_OUTPUTDIR)/failure-logs
endef

Expand All @@ -483,8 +487,8 @@ else # $(HAS_SPEC)=true
endef

define StartGlobalTimer
$(RM) -r $(BUILDTIMESDIR) 2> /dev/null
$(MKDIR) -p $(BUILDTIMESDIR)
$(RM) -r $(BUILDTIMESDIR) 2> /dev/null && \
$(MKDIR) -p $(BUILDTIMESDIR) && \
$(call RecordStartTime,TOTAL)
endef

Expand All @@ -495,13 +499,14 @@ else # $(HAS_SPEC)=true
# Find all build_time_* files and print their contents in a list sorted
# on the name of the sub repository.
define ReportBuildTimes
$(BUILD_LOG_WRAPPER) $(PRINTF) $(LOG_INFO) -- \
$(PRINTF) $(LOG_INFO) -- \
"----- Build times -------\nStart %s\nEnd %s\n%s\n%s\n-------------------------\n" \
"`$(CAT) $(BUILDTIMESDIR)/build_time_start_TOTAL_human_readable`" \
"`$(CAT) $(BUILDTIMESDIR)/build_time_end_TOTAL_human_readable`" \
"`$(LS) $(BUILDTIMESDIR)/build_time_diff_* | $(GREP) -v _TOTAL | \
$(XARGS) $(CAT) | $(SORT) -k 2`" \
"`$(CAT) $(BUILDTIMESDIR)/build_time_diff_TOTAL`"
"`$(CAT) $(BUILDTIMESDIR)/build_time_diff_TOTAL`" \
$(BUILD_LOG_PIPE)
endef

endif # HAS_SPEC
Expand Down
8 changes: 4 additions & 4 deletions make/MacBundles.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -57,23 +57,23 @@ ifeq ($(OPENJDK_TARGET_OS), macosx)

# Copy empty directories (jre/lib/applet).
$(JDK_MACOSX_BUNDLE_DIR)/Home/%: $(JDK_IMAGE_DIR)/%
$(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@) $(LOG_INFO)
$(call LogInfo, Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@))
$(MKDIR) -p $(@D)
if [ -d "$<" ]; then $(MKDIR) -p $@; else $(CP) -f -R -P '$<' '$@'; fi

$(JRE_MACOSX_BUNDLE_DIR)/Home/%: $(JRE_IMAGE_DIR)/%
$(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@) $(LOG_INFO)
$(call LogInfo, Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@))
$(MKDIR) -p $(@D)
if [ -d "$<" ]; then $(MKDIR) -p $@; else $(CP) -f -R -P '$<' '$@'; fi

$(JDK_MACOSX_BUNDLE_DIR)/MacOS/libjli.dylib:
$(ECHO) Creating link $(patsubst $(OUTPUT_ROOT)/%,%,$@) $(LOG_INFO)
$(call LogInfo, Creating link $(patsubst $(OUTPUT_ROOT)/%,%,$@))
$(MKDIR) -p $(@D)
$(RM) $@
$(LN) -s ../Home/lib/jli/libjli.dylib $@

$(JRE_MACOSX_BUNDLE_DIR)/MacOS/libjli.dylib:
$(ECHO) Creating link $(patsubst $(OUTPUT_ROOT)/%,%,$@) $(LOG_INFO)
$(call LogInfo, Creating link $(patsubst $(OUTPUT_ROOT)/%,%,$@))
$(MKDIR) -p $(@D)
$(RM) $@
$(LN) -s ../Home/lib/jli/libjli.dylib $@
Expand Down
Loading

0 comments on commit 2c69287

Please sign in to comment.