8055095: Improve "do nothing" incremental build performance after modularized source code integration
authorerikj
Thu, 21 Aug 2014 12:22:42 +0200
changeset 26116 f051bd253364
parent 26115 7a9dc384f3c8
child 26117 f33e2783f40d
8055095: Improve "do nothing" incremental build performance after modularized source code integration Reviewed-by: tbell
make/CompileJavaModules.gmk
make/Main.gmk
make/MakeHelpers.gmk
make/common/MakeBase.gmk
make/common/Modules.gmk
--- a/make/CompileJavaModules.gmk	Thu Aug 21 11:05:01 2014 +0200
+++ b/make/CompileJavaModules.gmk	Thu Aug 21 12:22:42 2014 +0200
@@ -28,6 +28,7 @@
 
 include $(SPEC)
 include MakeBase.gmk
+include Modules.gmk
 include JavaCompilation.gmk
 include SetupJavaCompilers.gmk
 
--- a/make/Main.gmk	Thu Aug 21 11:05:01 2014 +0200
+++ b/make/Main.gmk	Thu Aug 21 12:22:42 2014 +0200
@@ -37,6 +37,7 @@
 
 # Load the vital tools for all the makefiles.
 include $(SRC_ROOT)/make/common/MakeBase.gmk
+include $(SRC_ROOT)/make/common/Modules.gmk
 
 # Load common profile names definitions
 include $(JDK_TOPDIR)/make/ProfileNames.gmk
--- a/make/MakeHelpers.gmk	Thu Aug 21 11:05:01 2014 +0200
+++ b/make/MakeHelpers.gmk	Thu Aug 21 12:22:42 2014 +0200
@@ -303,4 +303,32 @@
 	@$(PRINTF) " done\n"
 endef
 
+################################################################################
+
+MAKE_DIR_LIST := $(JDK_TOPDIR)/make
+
+# Find all modules that has a makefile for a certain build phase
+# Param 1: Make subdir to look in
+# Param 2: File prefix to look for
+FindModulesWithMakefileFor = $(sort $(foreach d, $(MAKE_DIR_LIST), \
+    $(patsubst $d/$(strip $1)/$(strip $2)-%.gmk,%, \
+    $(wildcard $d/$(strip $1)/$(strip $2)-*.gmk))))
+
+# Declare a recipe for calling such a makefile
+# Param 1: Module name
+# Param 2: Suffix for rule
+# Param 3: Make subdir
+# Param 4: Makefile prefix
+define DeclareRecipeForModuleMakefile
+  $$(strip $1)-$$(strip $2):
+	+($(CD) $$(dir $$(firstword $$(wildcard $$(addsuffix /$$(strip $3)/$$(strip $4)-$$(strip $1).gmk, \
+	        $(MAKE_DIR_LIST))))) \
+	    && $(MAKE) $(MAKE_ARGS) \
+	    -f $$(strip $4)-$$(strip $1).gmk \
+	    $$(addprefix -I, $$(wildcard $(MAKE_DIR_LIST) \
+	        $$(addsuffix /$$(strip $3), $(MAKE_DIR_LIST)))))
+endef
+
+################################################################################
+
 endif # _MAKEHELPERS_GMK
--- a/make/common/MakeBase.gmk	Thu Aug 21 11:05:01 2014 +0200
+++ b/make/common/MakeBase.gmk	Thu Aug 21 12:22:42 2014 +0200
@@ -25,7 +25,6 @@
 
 ################################################################
 #
-# Check that GNU make and cygwin are recent enough.
 # Setup common utility functions.
 #
 ################################################################
@@ -533,71 +532,6 @@
 endef
 
 ################################################################################
-# Module list macros
-
-ALL_TOP_SRC_DIRS := \
-    $(JDK_TOPDIR)/src \
-    $(LANGTOOLS_TOPDIR)/src \
-    $(CORBA_TOPDIR)/src \
-    $(JAXP_TOPDIR)/src \
-    $(JAXWS_TOPDIR)/src \
-    $(NASHORN_TOPDIR)/src \
-    #
-
-# There are snmp classes in the open but they are not included in OpenJDK
-JAVA_MODULES_FILTER := jdk.snmp
-
-# Find all modules with java sources by looking in the source dirs
-define FindJavaModules
-  $(filter-out $(JAVA_MODULES_FILTER), $(sort $(notdir \
-      $(patsubst %/,%, $(dir $(patsubst %/,%, $(dir $(patsubst %/,%, $(dir \
-      $(wildcard $(patsubst %,%/*/share/classes/*, $(ALL_TOP_SRC_DIRS)) \
-          $(patsubst %,%/*/$(OPENJDK_TARGET_OS_API_DIR)/classes/*, $(ALL_TOP_SRC_DIRS)) \
-          $(patsubst %,%/*/$(OPENJDK_TARGET_OS)/classes/*, $(ALL_TOP_SRC_DIRS))))))))))))
-endef
-
-MODULES_LIST_FILE := $(SRC_ROOT)/make/common/modules.list
-
-# Param 1: Module to find deps for
-define FindDepsForModule
-  $(if $(filter-out java.base, $1), java.base $(filter-out jdk.scripting.nashorn, $(filter-out java.base, $(wordlist 2, 100, $(shell $(GREP) '^$(strip $1):' $(MODULES_LIST_FILE))))))
-endef
-
-# Find all modules with source for the target platform.
-define FindAllModules
-  $(sort $(filter-out closed demo sample, $(notdir $(patsubst %/,%, $(dir \
-      $(wildcard $(patsubst %, %/*/share, $(ALL_TOP_SRC_DIRS)) \
-      $(patsubst %, %/*/$(OPENJDK_TARGET_OS), $(ALL_TOP_SRC_DIRS)) \
-      $(patsubst %, %/*/$(OPENJDK_TARGET_OS_API_DIR), $(ALL_TOP_SRC_DIRS))))))))
-endef
-
-################################################################################
-
-MAKE_DIR_LIST := $(JDK_TOPDIR)/make
-
-# Find all modules that has a makefile for a certain build phase
-# Param 1: Make subdir to look in
-# Param 2: File prefix to look for
-FindModulesWithMakefileFor = $(sort $(foreach d, $(MAKE_DIR_LIST), \
-    $(patsubst $d/$(strip $1)/$(strip $2)-%.gmk,%, \
-    $(wildcard $d/$(strip $1)/$(strip $2)-*.gmk))))
-
-# Declare a recipe for calling such a makefile
-# Param 1: Module name
-# Param 2: Suffix for rule
-# Param 3: Make subdir
-# Param 4: Makefile prefix
-define DeclareRecipeForModuleMakefile
-  $$(strip $1)-$$(strip $2):
-	+($(CD) $$(dir $$(firstword $$(wildcard $$(addsuffix /$$(strip $3)/$$(strip $4)-$$(strip $1).gmk, \
-	        $(MAKE_DIR_LIST))))) \
-	    && $(MAKE) $(MAKE_ARGS) \
-	    -f $$(strip $4)-$$(strip $1).gmk \
-	    $$(addprefix -I, $$(wildcard $(MAKE_DIR_LIST) \
-	        $$(addsuffix /$$(strip $3), $(MAKE_DIR_LIST)))))
-endef
-
-################################################################################
 
 # Hook to include the corresponding custom file, if present.
 $(eval $(call IncludeCustomExtension, , common/MakeBase.gmk))
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/common/Modules.gmk	Thu Aug 21 12:22:42 2014 +0200
@@ -0,0 +1,79 @@
+#
+# 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.
+#
+
+ifndef _MODULES_GMK
+_MODULES_GMK := 1
+
+################################################################################
+# Module list macros
+
+ALL_TOP_SRC_DIRS := \
+    $(JDK_TOPDIR)/src \
+    $(LANGTOOLS_TOPDIR)/src \
+    $(CORBA_TOPDIR)/src \
+    $(JAXP_TOPDIR)/src \
+    $(JAXWS_TOPDIR)/src \
+    $(NASHORN_TOPDIR)/src \
+    #
+
+# There are snmp classes in the open but they are not included in OpenJDK
+JAVA_MODULES_FILTER := jdk.snmp
+
+# Find all modules with java sources by looking in the source dirs
+define FindJavaModules
+  $(filter-out $(JAVA_MODULES_FILTER), $(sort $(notdir \
+      $(patsubst %/,%, $(dir $(patsubst %/,%, $(dir $(patsubst %/,%, $(dir \
+      $(wildcard $(patsubst %,%/*/share/classes/*, $(ALL_TOP_SRC_DIRS)) \
+          $(patsubst %,%/*/$(OPENJDK_TARGET_OS_API_DIR)/classes/*, $(ALL_TOP_SRC_DIRS)) \
+          $(patsubst %,%/*/$(OPENJDK_TARGET_OS)/classes/*, $(ALL_TOP_SRC_DIRS))))))))))))
+endef
+
+MODULES_LIST_FILE := $(SRC_ROOT)/make/common/modules.list
+MODULE_DEPS_MAKEFILE := $(OUTPUT_ROOT)/module-deps.gmk
+
+$(MODULE_DEPS_MAKEFILE): $(MODULES_LIST_FILE)
+	$(CAT) $^ | $(SED) -e 's/^\([^:]*\):/DEPS_\1 :=/g' > $@
+
+-include $(MODULE_DEPS_MAKEFILE)
+
+# Param 1: Module to find deps for
+define FindDepsForModule
+  $(DEPS_$(strip $1))
+endef
+
+# Find all modules with source for the target platform.
+define FindAllModules
+  $(sort $(filter-out closed demo sample, $(notdir $(patsubst %/,%, $(dir \
+      $(wildcard $(patsubst %, %/*/share, $(ALL_TOP_SRC_DIRS)) \
+      $(patsubst %, %/*/$(OPENJDK_TARGET_OS), $(ALL_TOP_SRC_DIRS)) \
+      $(patsubst %, %/*/$(OPENJDK_TARGET_OS_API_DIR), $(ALL_TOP_SRC_DIRS))))))))
+endef
+
+################################################################################
+
+# Hook to include the corresponding custom file, if present.
+$(eval $(call IncludeCustomExtension, , common/Modules.gmk))
+
+endif # _MODULES_GMK