8081814: Modularize the deploy build
authorerikj
Thu, 04 Jun 2015 18:27:42 +0200
changeset 31310 481585782338
parent 31309 15a47f7751da
child 31311 3d8fd992345c
8081814: Modularize the deploy build Reviewed-by: ihse, ddehaven
common/bin/compare.sh
make/CompileJavaModules.gmk
make/Images.gmk
make/MacBundles.gmk
make/Main.gmk
make/MainSupport.gmk
make/StripBinaries.gmk
make/common/MakeBase.gmk
--- a/common/bin/compare.sh	Tue Jun 16 13:00:47 2015 -0700
+++ b/common/bin/compare.sh	Thu Jun 04 18:27:42 2015 +0200
@@ -1188,28 +1188,11 @@
         OTHER_JDK="$OTHER/install/jdk"
         OTHER_JRE="$OTHER/install/jre"
         echo "Selecting install images for compare"
-    elif [ -d "$THIS/deploy/jdk" -o -d "$THIS/deploy/images/jdk" ] \
-	     && [ -d "$OTHER/deploy/jdk" -o -d "$OTHER/deploy/images/jdk" ]; then
-	if [ -d "$THIS/deploy/images/jdk" ]; then
-            THIS_JDK="$THIS/deploy/images/jdk"
-            THIS_JRE="$THIS/deploy/images/jre"
-	else
-            THIS_JDK="$THIS/deploy/jdk"
-            THIS_JRE="$THIS/deploy/jre"
-	fi
-	if [ -d "$OTHER/deploy/images/jdk" ]; then
-            OTHER_JDK="$OTHER/deploy/images/jdk"
-            OTHER_JRE="$OTHER/deploy/images/jre"
-	else
-            OTHER_JDK="$OTHER/deploy/jdk"
-            OTHER_JRE="$OTHER/deploy/jre"
-	fi
-        echo "Selecting deploy images for compare"
-    elif [ -d "$THIS/deploy/images/jdk" ] && [ -d "$OTHER/deploy/jdk" ]; then
-        THIS_JDK="$THIS/deploy/jdk"
-        THIS_JRE="$THIS/deploy/jre"
-        OTHER_JDK="$OTHER/deploy/jdk"
-        OTHER_JRE="$OTHER/deploy/jre"
+    elif [ -d "$THIS/images/jdk" ] && [ -d "$OTHER/deploy/images/jdk" ]; then
+        THIS_JDK="$THIS/images/jdk"
+        THIS_JRE="$THIS/images/jre"
+        OTHER_JDK="$OTHER/deploy/images/jdk"
+        OTHER_JRE="$OTHER/deploy/images/jre"
         echo "Selecting deploy images for compare"
     elif [ -d "$THIS/images/jdk" ] && [ -d "$OTHER/images/jdk" ]; then
         THIS_JDK="$THIS/images/jdk"
@@ -1221,30 +1204,28 @@
         echo "No common images found."
         exit 1
     fi
+    echo "  $THIS_JDK"
+    echo "  $OTHER_JDK"
 
-    if [ -d "$THIS/deploy/jdk-bundle" -o -d "$THIS/deploy/images/jdk-bundle" ] \
-	     && [ -d "$OTHER/deploy/jdk-bundle" -o -d "$OTHER/deploy/images/jdk-bundle" ]; then
+    if [ -d "$THIS/images/jdk-bundle" -o -d "$THIS/deploy/images/jdk-bundle" ] \
+	     && [ -d "$OTHER/images/jdk-bundle" -o -d "$OTHER/deploy/images/jdk-bundle" ]; then
 	if [ -d "$THIS/deploy/images/jdk-bundle" ]; then
             THIS_JDK_BUNDLE="$THIS/deploy/images/jdk-bundle"
             THIS_JRE_BUNDLE="$THIS/deploy/images/jre-bundle"
 	else
-            THIS_JDK_BUNDLE="$THIS/deploy/jdk-bundle"
-            THIS_JRE_BUNDLE="$THIS/deploy/jre-bundle"
+            THIS_JDK_BUNDLE="$THIS/images/jdk-bundle"
+            THIS_JRE_BUNDLE="$THIS/images/jre-bundle"
 	fi
 	if [ -d "$OTHER/deploy/images/jdk-bundle" ]; then
             OTHER_JDK_BUNDLE="$OTHER/deploy/images/jdk-bundle"
             OTHER_JRE_BUNDLE="$OTHER/deploy/images/jre-bundle"
 	else
-            OTHER_JDK_BUNDLE="$OTHER/deploy/jdk-bundle"
-            OTHER_JRE_BUNDLE="$OTHER/deploy/jre-bundle"
+            OTHER_JDK_BUNDLE="$OTHER/images/jdk-bundle"
+            OTHER_JRE_BUNDLE="$OTHER/images/jre-bundle"
 	fi
-        echo "Also comparing deploy macosx bundles"
-    elif [ -d "$THIS/images/jdk-bundle" ] && [ -d "$OTHER/images/jdk-bundle" ]; then
-        THIS_JDK_BUNDLE="$THIS/images/jdk-bundle"
-        THIS_JRE_BUNDLE="$THIS/images/jre-bundle"
-        OTHER_JDK_BUNDLE="$OTHER/images/jdk-bundle"
-        OTHER_JRE_BUNDLE="$OTHER/images/jre-bundle"
         echo "Also comparing macosx bundles"
+        echo "  $THIS_JDK_BUNDLE"
+        echo "  $OTHER_JDK_BUNDLE"
     fi
 
     if [ -d "$THIS/deploy/bundles" -o -d "$THIS/deploy/images/bundles" ] \
@@ -1262,19 +1243,21 @@
         echo "Also comparing deploy javadoc bundles"
     fi
 
-    if [ -d "$THIS/deploy/JavaAppletPlugin.plugin" -o -d "$THIS/deploy/images/JavaAppletPlugin.plugin" ] \
-	     && [ -d "$OTHER/deploy/JavaAppletPlugin.plugin" -o -d "$OTHER/deploy/images/JavaAppletPlugin.plugin" ]; then
-	if [ -d "$THIS/deploy/images/bundles" ]; then
-            THIS_DEPLOY_APPLET_PLUGIN_DIR="$THIS/deploy/images/JavaAppletPlugin.plugin"
+    if [ -d "$THIS/images/JavaAppletPlugin.plugin" ] \
+	     && [ -d "$OTHER/images/JavaAppletPlugin.plugin" -o -d "$OTHER/deploy/images/JavaAppletPlugin.plugin" ]; then
+	if [ -d "$THIS/images/JavaAppletPlugin.plugin" ]; then
+            THIS_DEPLOY_APPLET_PLUGIN_DIR="$THIS/images/JavaAppletPlugin.plugin"
 	else
-            THIS_DEPLOY_APPLET_PLUGIN_DIR="$THIS/deploy/JavaAppletPlugin.plugin"
+            THIS_DEPLOY_APPLET_PLUGIN_DIR="$THIS/deploy/images/JavaAppletPlugin.plugin"
 	fi
-	if [ -d "$OTHER/deploy/images/bundles" ]; then
+	if [ -d "$OTHER/images/JavaAppletPlugin.plugin" ]; then
+            OTHER_DEPLOY_APPLET_PLUGIN_DIR="$OTHER/images/JavaAppletPlugin.plugin"
+	else
             OTHER_DEPLOY_APPLET_PLUGIN_DIR="$OTHER/deploy/images/JavaAppletPlugin.plugin"
-	else
-            OTHER_DEPLOY_APPLET_PLUGIN_DIR="$OTHER/deploy/JavaAppletPlugin.plugin"
 	fi
         echo "Also comparing deploy applet image"
+        echo "  $THIS_DEPLOY_APPLET_PLUGIN_DIR"
+        echo "  $OTHER_DEPLOY_APPLET_PLUGIN_DIR"
     fi
 
     if [ -d "$OTHER/images" ]; then
--- a/make/CompileJavaModules.gmk	Tue Jun 16 13:00:47 2015 -0700
+++ b/make/CompileJavaModules.gmk	Thu Jun 04 18:27:42 2015 +0200
@@ -517,7 +517,8 @@
   # Find the module dependencies by parsing modules.list file
   $1_DEPS := $$(call FindDepsForModule, $1)
 
-  $1_CLASSPATH := $$(addprefix $(JDK_OUTPUTDIR)/modules/,$$($1_DEPS))
+  $1_CLASSPATH := $$(foreach d,$$($1_DEPS), $$(if $$($$d_BIN), $$($$d_BIN), \
+      $(JDK_OUTPUTDIR)/modules/$$d))
   # When crypto classes are prebuilt, need to look for classes already in
   # output dir.
   ifneq ($(BUILD_CRYPTO), true)
@@ -534,10 +535,10 @@
   $$(eval $$(call SetupJavaCompilation,$1, \
       SETUP := $$(if $$($1_SETUP), $$($1_SETUP), GENERATE_JDKBYTECODE), \
       SRC := $$(wildcard $$(call ALL_SRC_DIRS,$1)), \
-      INCLUDES:=$(JDK_USER_DEFINED_FILTER),\
-      BIN := $(JDK_OUTPUTDIR)/modules/$1, \
+      INCLUDES := $(JDK_USER_DEFINED_FILTER),\
+      BIN := $$(if $$($1_BIN), $$($1_BIN), $(JDK_OUTPUTDIR)/modules/$1), \
       HEADERS := $(SUPPORT_OUTPUTDIR)/headers/$1, \
-      ADD_JAVAC_FLAGS := $$($1_JAVAC_FLAGS)))
+      ADD_JAVAC_FLAGS := $$($1_ADD_JAVAC_FLAGS) $$($1_JAVAC_FLAGS)))
 
   $1: $$($1) $$($1_COPY_EXTRA)
 
@@ -548,7 +549,8 @@
   # Only the javac compilation actually depends on other modules so limit
   # dependency declaration to that by using the *_COMPILE_TARGET variable.
   $$($1_COMPILE_TARGETS): $$(foreach d,$$($1_DEPS), \
-      $$(call SetupJavaCompilationCompileTarget, $$d, $(JDK_OUTPUTDIR)/modules/$$d))
+      $$(call SetupJavaCompilationCompileTarget, $$d, \
+          $$(if $$($$d_BIN), $$($$d_BIN), $(JDK_OUTPUTDIR)/modules/$$d)))
 endef
 
 # Setup compilation for each module
--- a/make/Images.gmk	Tue Jun 16 13:00:47 2015 -0700
+++ b/make/Images.gmk	Thu Jun 04 18:27:42 2015 +0200
@@ -104,6 +104,7 @@
 MODULES_XML += $(SRC_ROOT)/modules.xml
 DEPENDENCIES := $(call CacheFind, \
     $(SUPPORT_OUTPUTDIR)/modules_cmds \
+    $(SUPPORT_OUTPUTDIR)/modules_conf \
     $(SUPPORT_OUTPUTDIR)/modules_libs) \
     $(wildcard $(JDK_OUTPUTDIR)/modules/*/_*) \
     $(MODULES_XML)
@@ -452,10 +453,10 @@
 # /sample dir
 
 $(eval $(call SetupCopyFiles,COPY_SAMPLES, \
-    SRC := $(SUPPORT_OUTPUTDIR)/sample, \
+    SRC := $(SUPPORT_OUTPUTDIR)/sample/image, \
     DEST := $(JDK_IMAGE_DIR)/sample, \
-    FILES := $(if $(wildcard $(SUPPORT_OUTPUTDIR)/sample), \
-        $(call CacheFind,$(SUPPORT_OUTPUTDIR)/sample))))
+    FILES := $(if $(wildcard $(SUPPORT_OUTPUTDIR)/sample/image), \
+        $(call CacheFind,$(SUPPORT_OUTPUTDIR)/sample/image))))
 
 JDK_TARGETS += $(COPY_SAMPLES)
 
--- a/make/MacBundles.gmk	Tue Jun 16 13:00:47 2015 -0700
+++ b/make/MacBundles.gmk	Thu Jun 04 18:27:42 2015 +0200
@@ -37,9 +37,9 @@
 
   MACOSX_PLIST_SRC := $(JDK_TOPDIR)/make/data/bundle
 
-  BUNDLE_ID := $(MACOSX_BUNDLE_ID_BASE).$(JDK_MINOR_VERSION)u$(JDK_UPDATE_VERSION)
+    BUNDLE_ID := $(MACOSX_BUNDLE_ID_BASE).$(JDK_MINOR_VERSION)u$(JDK_UPDATE_VERSION)
   BUNDLE_NAME := $(MACOSX_BUNDLE_NAME_BASE) $(JDK_MINOR_VERSION)
-  BUNDLE_INFO := $(MACOSX_BUNDLE_NAME_BASE) $(JDK_VERSION)
+    BUNDLE_INFO := $(MACOSX_BUNDLE_NAME_BASE) $(JDK_VERSION)
   BUNDLE_PLATFORM_VERSION := $(JDK_MAJOR_VERSION).$(JDK_MINOR_VERSION)
   BUNDLE_VERSION := $(JDK_VERSION)
   ifeq ($(COMPANY_NAME), N/A)
@@ -56,23 +56,23 @@
 
   # Copy empty directories (jre/lib/applet).
   $(JDK_MACOSX_BUNDLE_DIR)/Home/%: $(JDK_IMAGE_DIR)/%
-	$(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+	$(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@) $(LOG_INFO)
 	$(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)/%,%,$@)
+	$(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@) $(LOG_INFO)
 	$(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)/%,%,$@)
+	$(ECHO) Creating link $(patsubst $(OUTPUT_ROOT)/%,%,$@) $(LOG_INFO)
 	$(MKDIR) -p $(@D)
 	$(RM) $@
 	$(LN) -s ../Home/lib/jli/libjli.dylib $@
 
   $(JRE_MACOSX_BUNDLE_DIR)/MacOS/libjli.dylib:
-	$(ECHO) Creating link $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+	$(ECHO) Creating link $(patsubst $(OUTPUT_ROOT)/%,%,$@) $(LOG_INFO)
 	$(MKDIR) -p $(@D)
 	$(RM) $@
 	$(LN) -s ../Home/lib/jli/libjli.dylib $@
--- a/make/Main.gmk	Tue Jun 16 13:00:47 2015 -0700
+++ b/make/Main.gmk	Thu Jun 04 18:27:42 2015 +0200
@@ -140,7 +140,7 @@
 define DeclareCompileJavaRecipe
   $1-java:
 	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f CompileJavaModules.gmk \
-	    $1 JAVA_MODULES=$1)
+	    $1 JAVA_MODULES=$1 MODULE=$1)
 endef
 
 $(foreach m, $(filter-out jdk.scripting.nashorn, $(JAVA_MODULES)), \
@@ -198,13 +198,13 @@
 ################################################################################
 # Build demos and samples targets
 
-demos:
+demos-jdk:
 	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileDemos.gmk)
 
-samples:
+samples-jdk:
 	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CopySamples.gmk)
 
-ALL_TARGETS += demos samples
+ALL_TARGETS += demos-jdk samples-jdk
 
 ################################################################################
 # Image targets
@@ -241,11 +241,11 @@
 profiles:
 	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk profiles)
 
-mac-bundles:
+mac-bundles-jdk:
 	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f MacBundles.gmk)
 
 ALL_TARGETS += source-tips bootcycle-images zip-security zip-source strip-binaries \
-    jrtfs-jar jimages profiles mac-bundles
+    jrtfs-jar jimages profiles mac-bundles-jdk
 
 ################################################################################
 # Docs targets
@@ -359,6 +359,8 @@
 
   $(RMIC_TARGETS): interim-langtools interim-corba interim-rmic
 
+  $(JAVA_TARGETS): interim-langtools
+
   import-hotspot: hotspot
 
   $(LIBS_TARGETS): import-hotspot
@@ -368,7 +370,7 @@
   # The demos are currently linking to libjvm and libjava, just like all other
   # jdk libs, even though they don't need to. To avoid warnings, make sure they
   # aren't built until after libjava and libjvm are available to link to.
-  demos: $(JAVA_TARGETS)
+  demos-jdk: $(JAVA_TARGETS)
 
   # Declare dependency from <module>-java to <module>-gensrc
   $(foreach m, $(GENSRC_MODULES), $(eval $m-java: $m-gensrc))
@@ -428,7 +430,7 @@
 
   profiles: exploded-image strip-binaries source-tips
 
-  mac-bundles: jimages
+  mac-bundles-jdk: jimages
 
   bootcycle-images: jimages
 
@@ -489,9 +491,15 @@
 ALL_MODULE_TARGETS := $(sort $(GENSRC_MODULES) $(JAVA_MODULES) \
     $(GENDATA_MODULES) $(LIBS_MODULES) $(LAUNCHER_MODULES) $(COPY_MODULES))
 
+demos: demos-jdk
+
+samples: samples-jdk
+
 # The "exploded image" is a locally runnable JDK in $(BUILD_OUTPUT)/jdk.
 exploded-image: $(ALL_MODULE_TARGETS)
 
+mac-bundles: mac-bundles-jdk
+
 # The $(BUILD_OUTPUT)/images directory contain the resulting deliverables,
 # and in line with this, our targets for creating these are named *-image[s].
 
@@ -514,8 +522,8 @@
 all-images: product-images test-image docs-image
 
 ALL_TARGETS += buildtools gensrc gendata copy java rmic libs launchers \
-    jdk.jdwp.agent-gensrc $(ALL_MODULE_TARGETS) exploded-image \
-    product-images docs-image test-image all-images
+    jdk.jdwp.agent-gensrc $(ALL_MODULE_TARGETS) demos samples exploded-image \
+    mac-bundles product-images docs-image test-image all-images
 
 ################################################################################
 
--- a/make/MainSupport.gmk	Tue Jun 16 13:00:47 2015 -0700
+++ b/make/MainSupport.gmk	Thu Jun 04 18:27:42 2015 +0200
@@ -65,7 +65,7 @@
 	@$(PRINTF) "Cleaning java $(if $1,for $(strip $1) )..."
 	@$(PRINTF) "\n" $(LOG_DEBUG)
 	$(RM) -r $(JDK_OUTPUTDIR)/modules/$(strip $1)
-	$(RM) -r $(SUPPORT_OUTPUTDIR)/misc/$(strip $1)
+	$(RM) -r $(SUPPORT_OUTPUTDIR)/special_classes/$(strip $1)
 	$(PRINTF) " done\n"
 	$(PRINTF) "Cleaning headers $(if $1,for $(strip $1)) ..."
 	$(RM) -r $(SUPPORT_OUTPUTDIR)/headers/$(strip $1)
--- a/make/StripBinaries.gmk	Tue Jun 16 13:00:47 2015 -0700
+++ b/make/StripBinaries.gmk	Thu Jun 04 18:27:42 2015 +0200
@@ -28,6 +28,9 @@
 include $(SPEC)
 include MakeBase.gmk
 
+# Hook to include the corresponding custom file, if present.
+$(eval $(call IncludeCustomExtension, , StripBinaries.gmk))
+
 ################################################################################
 # Copy native libraries and executables to a secondary location to strip them
 # and filter out files that shouldn't go into the image.
@@ -51,11 +54,13 @@
   endef
 endif
 
+NO_STRIP_CMDS_FILTER += %.cgi
+
 # Don't include debug info for executables.
 ALL_CMDS_SRC := $(filter-out %.bc %.debuginfo %.diz %.map %.pdb, \
     $(shell $(FIND) $(SUPPORT_OUTPUTDIR)/modules_cmds -type f -o -type l))
-COPY_CMDS_SRC := $(filter %.cgi, $(ALL_CMDS_SRC))
-STRIP_CMDS_SRC := $(filter-out $(COPY_CMDS_SRC), $(ALL_CMDS_SRC))
+COPY_CMDS_SRC := $(filter $(NO_STRIP_CMDS_FILTER), $(ALL_CMDS_SRC))
+STRIP_CMDS_SRC := $(filter-out $(NO_STRIP_CMDS_FILTER), $(ALL_CMDS_SRC))
 
 # Make sure symbolic links are copied and not stripped
 COPY_LIBS_SRC := \
--- a/make/common/MakeBase.gmk	Tue Jun 16 13:00:47 2015 -0700
+++ b/make/common/MakeBase.gmk	Thu Jun 04 18:27:42 2015 +0200
@@ -754,6 +754,17 @@
     $(call DependOnVariableHelper,$(strip $1),$(strip $2))
 
 ################################################################################
+# Find lib dir for module
+# Param 1 - module name
+ifeq ($(OPENJDK_TARGET_OS_TYPE), unix)
+  FindLibDirForModule = \
+      $(SUPPORT_OUTPUTDIR)/modules_libs/$(strip $1)$(OPENJDK_TARGET_CPU_LIBDIR)
+else
+  FindLibDirForModule = \
+      $(SUPPORT_OUTPUTDIR)/modules_libs/$(strip $1)
+endif
+
+################################################################################
 
 # Hook to include the corresponding custom file, if present.
 $(eval $(call IncludeCustomExtension, , common/MakeBase.gmk))