8004281: build-infra: Move all jar creation to images target and put jars in images/lib
authorerikj
Wed, 05 Dec 2012 10:12:57 +0100
changeset 14596 a1f29d55b5ee
parent 14559 17820b958ae8
child 14597 558a3373ba7e
8004281: build-infra: Move all jar creation to images target and put jars in images/lib Reviewed-by: ohair, tbell, dholmes
jdk/makefiles/CompileDemos.gmk
jdk/makefiles/CompileJavaClasses.gmk
jdk/makefiles/CreateJars.gmk
jdk/makefiles/Images.gmk
jdk/makefiles/Import.gmk
--- a/jdk/makefiles/CompileDemos.gmk	Wed Jul 05 18:30:50 2017 +0200
+++ b/jdk/makefiles/CompileDemos.gmk	Wed Dec 05 10:12:57 2012 +0100
@@ -194,15 +194,6 @@
 
 ##################################################################################################
 
-# Why do we install a demo jar into the main jre/lib/ext????????????????
-$(JDK_OUTPUTDIR)/lib/ext/zipfs.jar : $(JDK_OUTPUTDIR)/demo/nio/zipfs/zipfs.jar
-		$(MKDIR) -p $(@D)
-		$(CP) $< $@
-
-BUILD_DEMOS += $(JDK_OUTPUTDIR)/lib/ext/zipfs.jar
-
-##################################################################################################
-
 # In the old makefiles, j2dbench was not compiled. 
 #$(eval $(call SetupDemo,J2DBench,java2d,/src,,j2dbench/J2DBench))
 
--- a/jdk/makefiles/CompileJavaClasses.gmk	Wed Jul 05 18:30:50 2017 +0200
+++ b/jdk/makefiles/CompileJavaClasses.gmk	Wed Dec 05 10:12:57 2012 +0100
@@ -338,29 +338,14 @@
 
 ##########################################################################################
 
-#
-# This is an empty jar (only contains manifest) and fits poorly into framework...
-#   create simple rule instead
-#
-MANAGEMENT_AGENT_JAR_DEPS := $(JDK_TOPDIR)/src/share/classes/sun/management/manifest
-
-$(JDK_OUTPUTDIR)/lib/management-agent.jar : $(JDK_TOPDIR)/src/share/classes/sun/management/manifest
-	$(JAR) cfm $@ $(JDK_TOPDIR)/src/share/classes/sun/management/manifest
-
-JARS += $(JDK_OUTPUTDIR)/lib/management-agent.jar
-
-##########################################################################################
-
 ifndef OPENJDK
 
-$(eval $(call SetupJavaCompilation,BUILD_ALTCLASSES_JAR,\
+    $(eval $(call SetupJavaCompilation,BUILD_ALTCLASSES,\
 		SETUP:=GENERATE_JDKBYTECODE,\
 		SRC:=$(JDK_TOPDIR)/src/closed/share/altclasses, \
-		BIN:=$(JDK_OUTPUTDIR)/altclasses_classes,\
-		JAR:=$(JDK_OUTPUTDIR)/lib/alt-rt.jar))
+		BIN:=$(JDK_OUTPUTDIR)/altclasses_classes))
 
-$(BUILD_ALTCLASSES_JAR): $(BUILD_JDK)
-JARS += $(JDK_OUTPUTDIR)/lib/alt-rt.jar
+    $(BUILD_ALTCLASSES): $(BUILD_JDK)
 
 endif
 
@@ -383,7 +368,7 @@
      SERVER_DIR:=$(SJAVAC_SERVER_DIR),\
      SERVER_JVM:=$(SJAVAC_SERVER_JAVA)))
 
-$(eval $(call SetupJavaCompilation,BUILD_JOBJC_JAR,\
+$(eval $(call SetupJavaCompilation,BUILD_JOBJC,\
 		SETUP:=GENERATE_15BYTECODE,\
 		DISABLE_SJAVAC:=true,\
 		SRC:=$(JDK_TOPDIR)/src/macosx/native/jobjc/src/core/java \
@@ -395,11 +380,9 @@
 		JAR:=$(JDK_OUTPUTDIR)/lib/JObjC.jar, \
 		JARINDEX := true))
 
-$(BUILD_JOBJC_JAR) : $(BUILD_JDK)
+$(BUILD_JOBJC) : $(BUILD_JDK)
 
-JARS += $(JDK_OUTPUTDIR)/lib/JObjC.jar
-
-$(eval $(call SetupJavaCompilation,BUILD_JOBJC_HEADERS_JAR,\
+$(eval $(call SetupJavaCompilation,BUILD_JOBJC_HEADERS,\
 		SETUP:=GENERATE_JDKBYTECODE,\
 		SRC:=$(JDK_TOPDIR)/src/macosx/native/jobjc/src/core/java \
 		     $(JDK_TOPDIR)/src/macosx/native/jobjc/src/runtime-additions/java \
@@ -409,16 +392,15 @@
 		BIN:=$(JDK_OUTPUTDIR)/jobjc_classes_headers,\
 		HEADERS:=$(JDK_OUTPUTDIR)/gensrc_headers_jobjc))
 
-$(BUILD_JOBJC_HEADERS_JAR) : $(BUILD_JDK)
-
-JARS += $(BUILD_JOBJC_HEADERS_JAR)
+$(BUILD_JOBJC_HEADERS) : $(BUILD_JDK)
 
 endif
 
 ##########################################################################################
 
 # copy with -a to preserve timestamps so dependencies down the line aren't messed up
-all: $(BUILD_JDK) $(JARS) $(COPY_EXTRA) $(JDK_OUTPUTDIR)/classes/META-INF/services/com.sun.tools.xjc.Plugin \
+all: $(BUILD_JDK) $(BUILD_ALTCLASSES) $(BUILD_JOBJC) $(BUILD_JOBJC_HEADERS) $(COPY_EXTRA) \
+	$(JDK_OUTPUTDIR)/classes/META-INF/services/com.sun.tools.xjc.Plugin \
 	$(JDK_OUTPUTDIR)/gensrc_headers/_the.jdk.base.headers
 
 .PHONY: all
--- a/jdk/makefiles/CreateJars.gmk	Wed Jul 05 18:30:50 2017 +0200
+++ b/jdk/makefiles/CreateJars.gmk	Wed Dec 05 10:12:57 2012 +0100
@@ -446,9 +446,7 @@
 
     $(SUNPKCS11_JAR_DST) : $(SUNPKCS11_JAR_SRC)
 	@$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt SunPKCS11 provider..."
-	$(MKDIR) -p $(@D)
-	$(RM) $@
-	$(CP) $< $@
+	$(install-file)
 
 else
 
@@ -476,9 +474,7 @@
 
     $(SUNEC_JAR_DST) : $(SUNEC_JAR_SRC)
 	@$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt SunEC provider..."
-	$(MKDIR) -p $(@D)
-	$(RM) $@
-	$(CP) $< $@
+	$(install-file)
 
 else
 
@@ -518,9 +514,8 @@
 
     $(SUNJCE_PROVIDER_JAR_DST) : $(SUNJCE_PROVIDER_JAR_SRC)
 	@$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt SunJCE provider..."
-	$(MKDIR) -p $(@D)
-	$(RM) $@
-	$(CP) $< $@
+	$(install-file)
+
 else
 
     $(eval $(call SetupArchive,BUILD_SUNJCE_PROVIDER_JAR,,\
@@ -545,9 +540,7 @@
 
     $(JCE_JAR_DST) : $(JCE_JAR_SRC)
 	@$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt jce.jar..."
-	$(MKDIR) -p $(@D)
-	$(RM) $@
-	$(CP) $< $@
+	$(install-file)
 
 else
 
@@ -567,75 +560,85 @@
 
 ##########################################################################################
 
-ifdef OPENJDK
+US_EXPORT_POLICY_JAR_DST := $(IMAGES_OUTPUTDIR)/lib/security/US_export_policy.jar
+
+ifndef OPENJDK
+
+
+    $(US_EXPORT_POLICY_JAR_DST): $(JDK_TOPDIR)/make/closed/tools/crypto/jce/US_export_policy.jar
+	$(ECHO) $(LOG_INFO) Copying $(@F)
+	$(install-file)
+
+else
 
-#
-# TODO fix so that SetupArchive does not write files into SRCS
-#   then we don't need this extra copying
-#
-# NOTE:  We currently do not place restrictions on our limited export
-# policy.  This was not a typo.
-#
-US_EXPORT_POLICY_JAR_DST := $(IMAGES_OUTPUTDIR)/lib/security/US_export_policy.jar
-US_EXPORT_POLICY_JAR_SRC_DIR := $(JDK_TOPDIR)/make/javax/crypto/policy/unlimited
-US_EXPORT_POLICY_JAR_TMP := $(IMAGES_OUTPUTDIR)/US_export_policy_jar.tmp
+    #
+    # TODO fix so that SetupArchive does not write files into SRCS
+    #   then we don't need this extra copying
+    #
+    # NOTE:  We currently do not place restrictions on our limited export
+    # policy.  This was not a typo.
+    #
+    US_EXPORT_POLICY_JAR_SRC_DIR := $(JDK_TOPDIR)/make/javax/crypto/policy/unlimited
+    US_EXPORT_POLICY_JAR_TMP := $(IMAGES_OUTPUTDIR)/US_export_policy_jar.tmp
 
-$(US_EXPORT_POLICY_JAR_TMP)/% : $(US_EXPORT_POLICY_JAR_SRC_DIR)/%
-	$(MKDIR) -p $(@D)
-	$(RM) $@
-	$(CP) $< $@
+    $(US_EXPORT_POLICY_JAR_TMP)/% : $(US_EXPORT_POLICY_JAR_SRC_DIR)/%
+	$(install-file)
 
-US_EXPORT_POLICY_JAR_DEPS := $(US_EXPORT_POLICY_JAR_TMP)/default_US_export.policy
+    US_EXPORT_POLICY_JAR_DEPS := $(US_EXPORT_POLICY_JAR_TMP)/default_US_export.policy
 
-$(eval $(call SetupArchive,BUILD_US_EXPORT_POLICY_JAR,$(US_EXPORT_POLICY_JAR_DEPS),\
+    $(eval $(call SetupArchive,BUILD_US_EXPORT_POLICY_JAR,$(US_EXPORT_POLICY_JAR_DEPS),\
 		SRCS:=$(US_EXPORT_POLICY_JAR_TMP), \
 		SUFFIXES:= .policy,\
 		JAR:=$(US_EXPORT_POLICY_JAR_DST), \
 		EXTRA_MANIFEST_ATTR := Crypto-Strength: unlimited, \
 		SKIP_METAINF := true))
 
-JARS += $(US_EXPORT_POLICY_JAR_DST)
+endif
 
-endif
+JARS += $(US_EXPORT_POLICY_JAR_DST)
 
 ##########################################################################################
 
+LOCAL_POLICY_JAR_DST := $(IMAGES_OUTPUTDIR)/lib/security/local_policy.jar
 
-ifdef OPENJDK
+ifndef OPENJDK
+
+    $(LOCAL_POLICY_JAR_DST): $(JDK_TOPDIR)/make/closed/tools/crypto/jce/local_policy.jar
+	$(ECHO) $(LOG_INFO) Copying $(@F)
+	$(install-file)
 
-#
-# TODO fix so that SetupArchive does not write files into SRCS
-#   then we don't need this extra copying
-#
-LOCAL_POLICY_JAR_DST := $(IMAGES_OUTPUTDIR)/lib/security/local_policy.jar
-LOCAL_POLICY_JAR_TMP := $(IMAGES_OUTPUTDIR)/local_policy_jar.tmp
+else
+
+    #
+    # TODO fix so that SetupArchive does not write files into SRCS
+    #   then we don't need this extra copying
+    #
+    LOCAL_POLICY_JAR_TMP := $(IMAGES_OUTPUTDIR)/local_policy_jar.tmp
 
-ifeq ($(UNLIMITED_CRYPTO), true)
-    LOCAL_POLICY_JAR_SRC_DIR := $(JDK_TOPDIR)/make/javax/crypto/policy/unlimited
-    LOCAL_POLICY_JAR_DEPS := $(LOCAL_POLICY_JAR_TMP)/default_local.policy
-    LOCAL_POLICY_JAR_ATTR := Crypto-Strength: unlimited
-else
-    LOCAL_POLICY_JAR_SRC_DIR := $(JDK_TOPDIR)/make/javax/crypto/policy/limited
-    LOCAL_POLICY_JAR_DEPS := $(LOCAL_POLICY_JAR_TMP)/exempt_local.policy \
-			 $(LOCAL_POLICY_JAR_TMP)/default_local.policy
-    LOCAL_POLICY_JAR_ATTR := Crypto-Strength: limited
-endif
+    ifeq ($(UNLIMITED_CRYPTO), true)
+        LOCAL_POLICY_JAR_SRC_DIR := $(JDK_TOPDIR)/make/javax/crypto/policy/unlimited
+        LOCAL_POLICY_JAR_DEPS := $(LOCAL_POLICY_JAR_TMP)/default_local.policy
+        LOCAL_POLICY_JAR_ATTR := Crypto-Strength: unlimited
+    else
+        LOCAL_POLICY_JAR_SRC_DIR := $(JDK_TOPDIR)/make/javax/crypto/policy/limited
+        LOCAL_POLICY_JAR_DEPS := $(LOCAL_POLICY_JAR_TMP)/exempt_local.policy \
+                                 $(LOCAL_POLICY_JAR_TMP)/default_local.policy
+        LOCAL_POLICY_JAR_ATTR := Crypto-Strength: limited
+    endif
 
-$(LOCAL_POLICY_JAR_TMP)/% : $(LOCAL_POLICY_JAR_SRC_DIR)/%
-	$(MKDIR) -p $(@D)
-	$(RM) $@
-	$(CP) $< $@
+    $(LOCAL_POLICY_JAR_TMP)/% : $(LOCAL_POLICY_JAR_SRC_DIR)/%
+	$(install-file)
 
-$(eval $(call SetupArchive,BUILD_LOCAL_POLICY_JAR,$(LOCAL_POLICY_JAR_DEPS),\
+    $(eval $(call SetupArchive,BUILD_LOCAL_POLICY_JAR,$(LOCAL_POLICY_JAR_DEPS),\
 		SRCS:=$(LOCAL_POLICY_JAR_TMP),\
 		SUFFIXES:= .policy,\
 		JAR:=$(LOCAL_POLICY_JAR_DST), \
 		EXTRA_MANIFEST_ATTR := $(LOCAL_POLICY_JAR_ATTR), \
 		SKIP_METAINF := true))
 
-JARS += $(LOCAL_POLICY_JAR_DST)
+endif
 
-endif
+JARS += $(LOCAL_POLICY_JAR_DST)
 
 ##########################################################################################
 
@@ -648,9 +651,7 @@
 
 $(SUNMSCAPI_JAR_DST) : $(SUNMSCAPI_JAR_SRC)
 	@$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt SunMSCAPI provider..."
-	$(MKDIR) -p $(@D)
-	$(RM) $@
-	$(CP) $< $@
+	$(install-file)
 
 else
 
@@ -676,9 +677,7 @@
 
 $(UCRYPTO_JAR_DST) : $(UCRYPTO_JAR_SRC)
 	@$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt OracleUcrypto provider..."
-	$(MKDIR) -p $(@D)
-	$(RM) $@
-	$(CP) $< $@
+	$(install-file)
 
 JARS += $(UCRYPTO_JAR_DST)
 
@@ -897,14 +896,10 @@
 			$(LAUNCHER_SRC_FILES)))
 
 $(IMAGES_OUTPUTDIR)/src/launcher/%: $(JDK_TOPDIR)/src/share/bin/%
-	$(MKDIR) -p $(@D)
-	$(RM) $@
-	$(CP) $< $@
+	$(install-file)
 
 $(IMAGES_OUTPUTDIR)/src/launcher/%: $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/bin/%
-	$(MKDIR) -p $(@D)
-	$(RM) $@
-	$(CP) $< $@
+	$(install-file)
 
 $(IMAGES_OUTPUTDIR)/src.zip: $(LAUNCHER_ZIP_SRC)
 
@@ -922,6 +917,55 @@
 
 ##########################################################################################
 
+#
+# This is an empty jar (only contains manifest) and fits poorly into framework...
+#   create simple rule instead
+#
+$(IMAGES_OUTPUTDIR)/lib/management-agent.jar : $(JDK_TOPDIR)/src/share/classes/sun/management/manifest
+	$(JAR) cfm $@ $<
+
+JARS += $(IMAGES_OUTPUTDIR)/lib/management-agent.jar
+
+##########################################################################################
+
+$(IMAGES_OUTPUTDIR)/lib/ext/zipfs.jar : $(JDK_OUTPUTDIR)/demo/nio/zipfs/zipfs.jar
+	$(install-file)
+
+JARS += $(IMAGES_OUTPUTDIR)/lib/ext/zipfs.jar
+
+##########################################################################################
+
+ifeq ($(OPENJDK_TARGET_OS),macosx)
+    $(eval $(call SetupArchive,BUILD_JOBJC_JAR,,\
+		SRCS:=$(JDK_OUTPUTDIR)/jobjc_classes,\
+		JAR:=$(IMAGES_OUTPUTDIR)/lib/JObjC.jar, \
+		JARINDEX:=true))
+
+    JARS += $(IMAGES_OUTPUTDIR)/lib/JObjC.jar
+endif
+
+##########################################################################################
+
+ifndef OPENJDK
+    $(eval $(call SetupArchive,BUILD_ALT_RT_JAR,,\
+		SRCS:=$(JDK_OUTPUTDIR)/altclasses_classes,\
+		JAR:=$(IMAGES_OUTPUTDIR)/lib/alt-rt.jar))
+
+    JARS += $(IMAGES_OUTPUTDIR)/lib/alt-rt.jar
+endif
+
+##########################################################################################
+
+# This file is imported from hotspot in Import.gmk. Copying it into images/lib so that
+# all jars can be found in one place when creating images in Images.gmk. It needs to be
+# done here so that clean targets can be simple and accurate.
+$(IMAGES_OUTPUTDIR)/lib/sa-jdi.jar: $(JDK_OUTPUTDIR)/lib/sa-jdi.jar
+	$(install-file)
+
+JARS += $(IMAGES_OUTPUTDIR)/lib/sa-jdi.jar
+
+##########################################################################################
+
 -include $(CUSTOM_MAKE_DIR)/CreateJars.gmk
 
 ##########################################################################################
--- a/jdk/makefiles/Images.gmk	Wed Jul 05 18:30:50 2017 +0200
+++ b/jdk/makefiles/Images.gmk	Wed Dec 05 10:12:57 2012 +0100
@@ -211,10 +211,11 @@
 endif
 
 # Find all files to copy from $(JDK_OUTPUTDIR)/lib
+# Jar files are not expected to be here
 ALL_JDKOUT_LIB_LIST := $(shell $(FIND) $(JDK_OUTPUTDIR)/lib \( -type f -o -type l \) -a ! \
-                       \( -name "_the*" -o -name "javac_state " \) )
+                       \( -name "_the*" -o -name "javac_state " -o -name "*.jar" \) )
 # Find all files to copy from $(IMAGES_OUTPUTDIR)/lib
-# This might not exist if building overlay-images
+# This is were the jar files are and might not exist if building overlay-images
 ifneq ($(wildcard $(IMAGES_OUTPUTDIR)/lib),)
     ALL_IMAGES_LIB_LIST := $(shell $(FIND) $(IMAGES_OUTPUTDIR)/lib \( -type f -o -type l \) -a ! \
                        \( -name "_the*" -o -name "javac_state " \) )
--- a/jdk/makefiles/Import.gmk	Wed Jul 05 18:30:50 2017 +0200
+++ b/jdk/makefiles/Import.gmk	Wed Dec 05 10:12:57 2012 +0100
@@ -231,22 +231,6 @@
 endef
 endif
 
-ifndef OPENJDK
-
-IMPORT_TARGET_FILES += \
-            $(JDK_OUTPUTDIR)/lib/security/US_export_policy.jar \
-            $(JDK_OUTPUTDIR)/lib/security/local_policy.jar
-
-$(JDK_OUTPUTDIR)/lib/security/local_policy.jar: $(JDK_TOPDIR)/make/closed/tools/crypto/jce/local_policy.jar
-	$(ECHO) $(LOG_INFO) Copying $(@F)
-	$(install-file)
-
-$(JDK_OUTPUTDIR)/lib/security/US_export_policy.jar: $(JDK_TOPDIR)/make/closed/tools/crypto/jce/US_export_policy.jar
-	$(ECHO) $(LOG_INFO) Copying $(@F)
-	$(install-file)
-
-endif # OPENJDK
-
 #######
 
 all: $(IMPORT_TARGET_FILES)