changeset 1178:ea1777436829

New basic target for jimages
author erikj
date Thu, 18 Sep 2014 16:52:52 +0200
parents 894e6e0aa6f4
children d9e973d6d3b9 909d68bc96d2
files make/Images.gmk make/Main.gmk
diffstat 2 files changed, 119 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/Images.gmk	Thu Sep 18 16:52:52 2014 +0200
@@ -0,0 +1,105 @@
+#
+# 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.
+#
+
+default: all
+
+include $(SPEC)
+include MakeBase.gmk
+
+# Hook to include the corresponding custom file, if present.
+$(eval $(call IncludeCustomExtension, , Images.gmk))
+
+############################################################################
+
+# Dropping jdk.deploy since it currently doesn't exist.
+MAIN_MODULES += java.se java.smartcardio jdk.httpserver jdk.sctp \
+               jdk.security.auth jdk.runtime
+
+# providers
+PROVIDER_MODULES += jdk.charsets jdk.crypto.ec jdk.crypto.pkcs11 jdk.jvmstat jdk.localedata \
+               jdk.naming.dns jdk.naming.rmi jdk.scripting.nashorn jdk.zipfs
+
+# tools
+TOOLS_MODULES += jdk.attach jdk.compiler jdk.dev jdk.javadoc jdk.jcmd jdk.jconsole \
+               jdk.hotspot.agent jdk.hprof.agent jdk.jdi jdk.jdwp.agent jdk.rmic \
+               jdk.xml.bind jdk.xml.ws
+
+ifeq ($(OPENJDK_TARGET_OS), windows)
+  PROVIDER_MODULES += jdk.crypto.mscapi
+endif
+
+ifeq ($(OPENJDK_TARGET_OS), macosx)
+  MAIN_MODULES += jdk.deploy.osx
+endif
+
+JRE_MODULES := $(MAIN_MODULES) $(PROVIDER_MODULES)
+JDK_MODULES := $(JRE_MODULES) $(TOOLS_MODULES)
+
+# Replacing double-comma with a single comma is to workaround the issue
+# with some version of make on windows that doesn't substitute spaces 
+# with one comma properly as with make 4.0
+
+JRE_MODULES_LIST := $(subst $(COMMA)$(COMMA),$(COMMA),$(subst $(SPACE),$(COMMA),$(JRE_MODULES)))
+JDK_MODULES_LIST := $(subst $(COMMA)$(COMMA),$(COMMA),$(subst $(SPACE),$(COMMA),$(JRE_MODULES)))
+
+################################################################################
+
+JIMAGE_TOOL := $(JAVA_SMALL) \
+    -Xbootclasspath/p:$(BUILDTOOLS_OUTPUTDIR)/interim_jimage_classes \
+    -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_bt_classes build.tools.module.ImageBuilder \
+    --cmds $(SUPPORT_OUTPUTDIR)/modules_cmds \
+    --libs $(SUPPORT_OUTPUTDIR)/modules_libs \
+    --classes $(JDK_OUTPUTDIR)/modules \
+    #
+
+MODULES_XML += $(SRC_ROOT)/modules.xml
+DEPENDENCIES := $(call CacheFind, \
+    $(SUPPORT_OUTPUTDIR)/modules_cmds \
+    $(SUPPORT_OUTPUTDIR)/modules_libs) \
+    $(wildcard $(JDK_OUTPUTDIR)/modules/*/_*) \
+    $(MODULES_XML)
+    #
+
+JDK_JIMAGE_DIR := $(IMAGES_OUTPUTDIR)/jdk-jimage
+JRE_JIMAGE_DIR := $(IMAGES_OUTPUTDIR)/jre-jimage
+
+$(IMAGES_OUTPUTDIR)/_jdk-jimages-create.marker: $(DEPENDENCIES)
+	$(ECHO) Creating jdk-jimage
+	$(RM) -r $(JDK_JIMAGE_DIR)
+	$(JIMAGE_TOOL) --mods $(JDK_MODULES_LIST) --output $(JDK_JIMAGE_DIR) \
+	    $(MODULES_XML)
+	$(TOUCH) $@
+
+$(IMAGES_OUTPUTDIR)/_jre-jimages-create.marker: $(DEPENDENCIES)
+	$(ECHO) Creating jre-jimage
+	$(RM) -r $(JRE_JIMAGE_DIR)
+	$(JIMAGE_TOOL) --mods $(JRE_MODULES_LIST) --output $(JRE_JIMAGE_DIR) \
+	    $(MODULES_XML)
+	$(TOUCH) $@
+
+all: $(IMAGES_OUTPUTDIR)/_jdk-jimages-create.marker \
+    $(IMAGES_OUTPUTDIR)/_jre-jimages-create.marker
+
+################################################################################
--- a/make/Main.gmk	Thu Sep 18 11:35:32 2014 +0200
+++ b/make/Main.gmk	Thu Sep 18 16:52:52 2014 +0200
@@ -232,7 +232,7 @@
 	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) PROFILE="" -f CreateJars.gmk)
 
 # Creates the images (j2sdk-image j2re-image etc)
-images:
+legacy-images:
 	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) PROFILE="" -f Images.gmk)
         ifeq ($(OPENJDK_TARGET_OS), macosx)
 	  +($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Bundles.gmk)
@@ -259,9 +259,12 @@
 	@$(ECHO) Boot cycle build step 2: Building a new JDK image using previously built image
 	+$(MAKE) $(MAKE_ARGS) -f Main.gmk SPEC=$(dir $(SPEC))bootcycle-spec.gmk images
 
-ALL_TARGETS += source-tips security-jars nashorn-jar main-jars images \
+jimages:
+	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk)
+
+ALL_TARGETS += source-tips security-jars nashorn-jar main-jars legacy-images \
     $(PROFILE_JARS_TARGETS) $(PROFILE_IMAGES_TARGETS) profiles-oscheck \
-    bootcycle-images
+    bootcycle-images jimages
 
 ################################################################################
 # Docs targets
@@ -396,9 +399,11 @@
     main-jars: java.security.jgss-libs
   endif
 
-  images: jars demos samples exploded-image source-tips
+  legacy-images: jars demos samples exploded-image source-tips
 
-  bootcycle-images: images
+  jimages: exploded-image source-tips
+
+  bootcycle-images: legacy-images
 
   # Need to depend on jars as otherwise there will a race between all the
   # invocations of CreateJars.gmk.
@@ -466,6 +471,8 @@
 
 jars: main-jars nashorn-jar security-jars
 
+images: legacy-images jimages demos samples
+
 # Make each profile name a target that depends on it's images target.
 $(foreach p, $(ALL_PROFILES), $(eval $(p): $(p)-images $(p)-jars))
 
@@ -475,12 +482,12 @@
 
 ALL_TARGETS += buildtools gensrc gendata copy java rmic libs launchers \
     jdk.jdwp.agent-gensrc \
-    $(ALL_MODULE_TARGETS) exploded-image jdk jars \
+    $(ALL_MODULE_TARGETS) exploded-image jdk jars images \
     $(ALL_PROFILES) profiles docs
 
 ################################################################################
 
-all: images docs verify-modules
+all: legacy-images docs verify-modules
 default: exploded-image
 
 ALL_TARGETS += default all