Fix images. ihse-setupexecute-branch
authorihse
Fri, 08 Feb 2019 13:13:51 +0100
branchihse-setupexecute-branch
changeset 57163 53d23a244f6e
parent 57162 e1a04d30f1c7
child 57228 f802ad9cf3bc
Fix images.
make/CreateJmods.gmk
make/Images.gmk
make/Main.gmk
--- a/make/CreateJmods.gmk	Fri Feb 08 10:42:05 2019 +0100
+++ b/make/CreateJmods.gmk	Fri Feb 08 13:13:51 2019 +0100
@@ -38,7 +38,7 @@
 ################################################################################
 
 JMODS_DIR := $(IMAGES_OUTPUTDIR)/jmods
-JMODS_SUPPORT_DIR := $(SUPPORT_OUTPUTDIR)/jmods
+JMODS_SUPPORT_DIR := $(SUPPORT_OUTPUTDIR)/images/jmods
 JMOD_FILE := $(MODULE).jmod
 
 LIBS_DIR ?= $(firstword $(wildcard $(addsuffix /$(MODULE), \
@@ -154,6 +154,7 @@
 # to avoid false incremental rebuilds.
 ifeq ($(INTERIM_JMOD), true)
   DEPS := $(filter-out $(SUPPORT_OUTPUTDIR)/modules_libs/java.base/classlist, $(DEPS))
+  INTERIM_MSG := interim$(SPACE)
 endif
 
 JMOD_FLAGS += --exclude '**{_the.*,_*.marker,*.diz,*.debuginfo,*.dSYM/**,*.dSYM,*.pdb,*.map}'
@@ -161,7 +162,7 @@
 # Create jmods in the support dir and then move them into place to keep the
 # module path in $(IMAGES_OUTPUTDIR)/jmods valid at all times.
 $(eval $(call SetupExecute, create_$(JMOD_FILE), \
-    WARN := Creating $(JMOD_FILE), \
+    WARN := Creating $(INTERIM_MSG)$(JMOD_FILE), \
     DEPS := $(DEPS), \
     OUTPUT_FILE := $(JMODS_DIR)/$(JMOD_FILE), \
     SUPPORT_DIR := $(JMODS_SUPPORT_DIR), \
--- a/make/Images.gmk	Fri Feb 08 10:42:05 2019 +0100
+++ b/make/Images.gmk	Fri Feb 08 13:13:51 2019 +0100
@@ -27,9 +27,9 @@
 
 include $(SPEC)
 include MakeBase.gmk
+include Execute.gmk
 include Modules.gmk
 
-TOOL_TARGETS :=
 JDK_TARGETS :=
 JRE_TARGETS :=
 
@@ -56,9 +56,6 @@
 
 JMODS := $(wildcard $(IMAGES_OUTPUTDIR)/jmods/*.jmod)
 
-# Use this file inside the image as target for make rule
-JIMAGE_TARGET_FILE := release
-
 JLINK_ORDER_RESOURCES := **module-info.class
 JLINK_JLI_CLASSES :=
 ifeq ($(ENABLE_GENERATE_CLASSLIST), true)
@@ -88,40 +85,57 @@
   JLINK_JDK_EXTRA_OPTS := --keep-packaged-modules $(JDK_IMAGE_DIR)/jmods
 endif
 
-$(JDK_IMAGE_DIR)/$(JIMAGE_TARGET_FILE): $(JMODS) \
-    $(call DependOnVariable, JDK_MODULES_LIST) $(BASE_RELEASE_FILE)
-	$(call LogWarn, Creating jdk image)
-	$(RM) -r $(JDK_IMAGE_DIR)
-	$(call ExecuteWithLog, $(SUPPORT_OUTPUTDIR)/images/jdk, \
-	    $(JLINK_TOOL) --add-modules $(JDK_MODULES_LIST) \
-	        $(JLINK_JDK_EXTRA_OPTS) \
-	        --output $(JDK_IMAGE_DIR) \
-	)
-        ifeq ($(BUILD_CDS_ARCHIVE), true)
-	  $(call LogWarn, Creating CDS archive for jdk image)
-	  $(FIXPATH) $(JDK_IMAGE_DIR)/bin/java \
-	      -Xshare:dump -Xmx128M -Xms128M $(LOG_INFO)
-        endif
-	$(TOUCH) $@
+$(eval $(call SetupExecute, jlink_jdk, \
+    WARN := Creating jdk image, \
+    DEPS := $(JMODS) $(BASE_RELEASE_FILE) \
+        $(call DependOnVariable, JDK_MODULES_LIST), \
+    OUTPUT_DIR := $(JDK_IMAGE_DIR), \
+    SUPPORT_DIR := $(SUPPORT_OUTPUTDIR)/images/jdk, \
+    PRE_COMMAND := $(RM) -r $(JDK_IMAGE_DIR), \
+    COMMAND := $(JLINK_TOOL) --add-modules $(JDK_MODULES_LIST) \
+        $(JLINK_JDK_EXTRA_OPTS) --output $(JDK_IMAGE_DIR), \
+))
+
+JLINK_JDK_TARGETS := $(jlink_jdk)
+
+$(eval $(call SetupExecute, jlink_jre, \
+    WARN := Creating legacy jre image, \
+    DEPS := $(JMODS) $(BASE_RELEASE_FILE) \
+        $(call DependOnVariable, JDK_MODULES_LIST), \
+    OUTPUT_DIR := $(JDK_IMAGE_DIR), \
+    SUPPORT_DIR := $(SUPPORT_OUTPUTDIR)/images/jre, \
+    PRE_COMMAND := $(RM) -r $(JRE_IMAGE_DIR), \
+    COMMAND := $(JLINK_TOOL) --add-modules $(JRE_MODULES_LIST) \
+        $(JLINK_JRE_EXTRA_OPTS) --output $(JRE_IMAGE_DIR), \
+))
+
+JLINK_JRE_TARGETS := $(jlink_jre)
 
-$(JRE_IMAGE_DIR)/$(JIMAGE_TARGET_FILE): $(JMODS) \
-    $(call DependOnVariable, JRE_MODULES_LIST) $(BASE_RELEASE_FILE)
-	$(call LogWarn, Creating legacy jre image)
-	$(RM) -r $(JRE_IMAGE_DIR)
-	$(call ExecuteWithLog, $(SUPPORT_OUTPUTDIR)/images/jre, \
-	    $(JLINK_TOOL) --add-modules $(JRE_MODULES_LIST) \
-	        $(JLINK_JRE_EXTRA_OPTS) \
-	        --output $(JRE_IMAGE_DIR) \
-	)
-        ifeq ($(BUILD_CDS_ARCHIVE), true)
-	  $(call LogWarn, Creating CDS archive for jre image)
-	  $(FIXPATH) $(JRE_IMAGE_DIR)/bin/java \
-	      -Xshare:dump -Xmx128M -Xms128M $(LOG_INFO)
-        endif
-	$(TOUCH) $@
+ifeq ($(BUILD_CDS_ARCHIVE), true)
+  CDS_ARCHIVE := lib/server/classes.jsa
+
+  $(eval $(call SetupExecute, gen_cds_archive_jdk, \
+      WARN := Creating CDS archive for jdk image, \
+      DEPS := $(jlink_jdk), \
+      OUTPUT_FILE := $(JDK_IMAGE_DIR)/$(CDS_ARCHIVE), \
+      SUPPORT_DIR := $(SUPPORT_OUTPUTDIR)/images/jdk, \
+      COMMAND := $(FIXPATH) $(JDK_IMAGE_DIR)/bin/java -Xshare:dump \
+          -Xmx128M -Xms128M $(LOG_INFO), \
+  ))
 
-TOOL_JRE_TARGETS := $(JRE_IMAGE_DIR)/$(JIMAGE_TARGET_FILE)
-TOOL_JDK_TARGETS := $(JDK_IMAGE_DIR)/$(JIMAGE_TARGET_FILE)
+  JDK_TARGETS += $(gen_cds_archive_jdk)
+
+  $(eval $(call SetupExecute, gen_cds_archive_jre, \
+      WARN := Creating CDS archive for jre image, \
+      DEPS := $(jlink_jre), \
+      OUTPUT_FILE := $(JRE_IMAGE_DIR)/$(CDS_ARCHIVE), \
+      SUPPORT_DIR := $(SUPPORT_OUTPUTDIR)/images/jre, \
+      COMMAND := $(FIXPATH) $(JRE_IMAGE_DIR)/bin/java -Xshare:dump \
+          -Xmx128M -Xms128M $(LOG_INFO), \
+  ))
+
+  JDK_TARGETS += $(gen_cds_archive_jdk)
+endif
 
 ################################################################################
 # src.zip
@@ -244,11 +258,11 @@
 
 ################################################################################
 
-$(JRE_TARGETS): $(TOOL_JRE_TARGETS)
-$(JDK_TARGETS): $(TOOL_JDK_TARGETS)
+$(JRE_TARGETS): $(JLINK_JRE_TARGETS)
+$(JDK_TARGETS): $(JLINK_JDK_TARGETS)
 
-jdk: $(TOOL_JDK_TARGETS) $(JDK_TARGETS)
-jre: $(TOOL_JRE_TARGETS) $(JRE_TARGETS)
+jdk: $(JLINK_JDK_TARGETS) $(JDK_TARGETS)
+jre: $(JLINK_JRE_TARGETS) $(JRE_TARGETS)
 symbols: $(SYMBOLS_TARGETS)
 
 all: jdk jre symbols
--- a/make/Main.gmk	Fri Feb 08 10:42:05 2019 +0100
+++ b/make/Main.gmk	Fri Feb 08 13:13:51 2019 +0100
@@ -1118,7 +1118,8 @@
 # file.
 
 CLEAN_DIRS += hotspot jdk bootcycle-build test buildtools support \
-    images make-support test-make bundles buildjdk test-results test-support
+    images make-support test-make bundles buildjdk test-results test-support \
+    support/images
 CLEAN_DIR_TARGETS := $(addprefix clean-, $(CLEAN_DIRS))
 CLEAN_SUPPORT_DIRS += demos
 CLEAN_SUPPORT_DIR_TARGETS := $(addprefix clean-, $(CLEAN_SUPPORT_DIRS))
@@ -1165,6 +1166,9 @@
 
 clean-test: clean-test-results clean-test-support
 
+# When cleaning images, also clean the support/images directory.
+clean-images: clean-support/images
+
 # Remove everything, including configure configuration. If the output
 # directory was created by configure and now becomes empty, remove it as well.
 dist-clean: clean