Merge
authoriris
Mon, 06 Jul 2015 11:49:41 -0700 (2015-07-06)
changeset 34023 f4037e203963
parent 31483 f241b3e1b45e (current diff)
parent 34022 1d81c9e6c1cd (diff)
child 34024 00d015c3e298
Merge
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/version.properties-template
--- a/nashorn/make/BuildNashorn.gmk	Thu Jul 02 08:54:05 2015 -0700
+++ b/nashorn/make/BuildNashorn.gmk	Mon Jul 06 11:49:41 2015 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2010, 2015, 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
@@ -30,19 +30,12 @@
 include MakeBase.gmk
 include JavaCompilation.gmk
 include SetupJavaCompilers.gmk
+include TextFileProcessing.gmk
 
 JDK_CLASSES := $(subst $(SPACE),$(PATH_SEP),$(strip $(addprefix $(JDK_OUTPUTDIR)/modules/, \
       java.base java.logging java.scripting)))
 
 NASHORN_JAR := $(IMAGES_OUTPUTDIR)/nashorn.jar
-NASHORN_VERSION := $(JDK_VERSION)
-NASHORN_FULL_VERSION := $(FULL_VERSION)
-
-ifdef MILESTONE
-  ifeq ($(MILESTONE), internal)
-    NASHORN_VERSION = $(FULL_VERSION)
-  endif
-endif
 
 # Need to use source and target 8 for nasgen to work.
 $(eval $(call SetupJavaCompiler,GENERATE_NEWBYTECODE_DEBUG, \
@@ -88,25 +81,23 @@
 	$(TOUCH) $@
 
 # Version file needs to be processed with version numbers
-VERSION_FILE := $(JDK_OUTPUTDIR)/modules/jdk.scripting.nashorn/jdk/nashorn/internal/runtime/resources/version.properties
-VERSION_SRC := $(NASHORN_TOPDIR)/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/version.properties-template
+$(eval $(call SetupTextFileProcessing, BUILD_VERSION_FILE, \
+  SOURCE_FILES := $(NASHORN_TOPDIR)/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/version.properties.template, \
+  OUTPUT_FILE := $(JDK_OUTPUTDIR)/modules/jdk.scripting.nashorn/jdk/nashorn/internal/runtime/resources/version.properties, \
+  REPLACEMENTS := \
+      @@VERSION_STRING@@ => $(VERSION_STRING) ; \
+      @@VERSION_SHORT@@ => $(VERSION_SHORT) , \
+))
 
-# Needs to happen after nasgen run since nasgen run deletes it
-$(VERSION_FILE): $(NASGEN_RUN_FILE)
-$(VERSION_FILE): $(VERSION_SRC)
-	$(ECHO) Creating version.properties
-	$(MKDIR) -p $(@D)
-	$(CAT) $< | $(SED) -e 's/$$(FULL_VERSION)/$(NASHORN_FULL_VERSION)/g' \
-	    -e 's/$$(RELEASE)/$(NASHORN_VERSION)/g' \
-	    -e '/^#.*$$/d' -e '/^$$/d'  > $@
+# Version processing needs to happen after nasgen run since nasgen run deletes it
+$(BUILD_VERSION_FILE): $(NASGEN_RUN_FILE)
 
 
-MANIFEST_ATTRIBUTES := Name: jdk/nashorn/\nImplementation-Title: Oracle Nashorn\nImplementation-Version: $(NASHORN_FULL_VERSION)
+MANIFEST_ATTRIBUTES := Name: jdk/nashorn/\nImplementation-Title: Oracle Nashorn\nImplementation-Version: $(VERSION_SHORT)
 
 # Create nashorn.jar from the final classes dir
 $(eval $(call SetupArchive,BUILD_NASHORN_JAR, \
-    DEPENDENCIES := $(NASGEN_RUN_FILE) \
-        $(VERSION_FILE), \
+    DEPENDENCIES := $(NASGEN_RUN_FILE) $(BUILD_VERSION_FILE), \
     SRCS := $(NASHORN_CLASSES_DIR), \
     SUFFIXES := .class .js .properties Factory, \
     MANIFEST := $(NASHORN_TOPDIR)/src/jdk.scripting.nashorn/share/classes/META-INF/MANIFEST.MF, \
@@ -114,7 +105,7 @@
     SKIP_METAINF := true, \
     JAR := $(NASHORN_JAR)))
 
-compile: $(NASHORN_RUN_FILE) $(VERSION_FILE)
+compile: $(NASHORN_RUN_FILE) $(BUILD_VERSION_FILE)
 all: $(NASHORN_JAR)
 
 .PHONY: compile all
--- a/nashorn/make/build.xml	Thu Jul 02 08:54:05 2015 -0700
+++ b/nashorn/make/build.xml	Mon Jul 06 11:49:41 2015 -0700
@@ -156,9 +156,9 @@
     <copy file="${src.dir}/jdk/internal/dynalink/support/messages.properties" todir="${build.classes.dir}/jdk/internal/dynalink/support"/>
     <copy file="${src.dir}/jdk/nashorn/internal/codegen/anchor.properties" todir="${build.classes.dir}/jdk/nashorn/internal/codegen"/>
 
-    <echo message="full=${nashorn.fullversion}" file="${build.classes.dir}/jdk/nashorn/internal/runtime/resources/version.properties"/>
+    <echo message="version_string=${nashorn.fullversion}" file="${build.classes.dir}/jdk/nashorn/internal/runtime/resources/version.properties"/>
     <echo file="${build.classes.dir}/jdk/nashorn/internal/runtime/resources/version.properties" append="true">${line.separator}</echo>
-    <echo message="release=${nashorn.version}" file="${build.classes.dir}/jdk/nashorn/internal/runtime/resources/version.properties" append="true"/>
+    <echo message="version_short=${nashorn.version}" file="${build.classes.dir}/jdk/nashorn/internal/runtime/resources/version.properties" append="true"/>
   </target>
 
   <target name="jar" depends="compile, run-nasgen, generate-cc-template" description="Creates nashorn.jar" unless="compile.suppress.jar">
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Version.java	Thu Jul 02 08:54:05 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Version.java	Mon Jul 06 11:49:41 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2015, 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
@@ -41,7 +41,7 @@
      * @return version string
      */
     public static String version() {
-        return version("release");  // mm.nn.oo[-milestone]
+        return version("version_short");  // E.g. "9-internal" or "9.1.2"
     }
 
     /**
@@ -49,7 +49,7 @@
      * @return full version string
      */
     public static String fullVersion() {
-        return version("full"); // mm.mm.oo[-milestone]-build
+        return version("version_string"); // E.g. "9.1.2.3-ea-4+nashorn-testing"
     }
 
     private static final String   VERSION_RB_NAME = "jdk.nashorn.internal.runtime.resources.version";
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/version.properties-template	Thu Jul 02 08:54:05 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-#
-# Copyright (c) 2010, 2013, 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.
-#
-
-full=$(FULL_VERSION)
-release=$(RELEASE)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/version.properties.template	Mon Jul 06 11:49:41 2015 -0700
@@ -0,0 +1,27 @@
+#
+# Copyright (c) 2010, 2015, 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.
+#
+
+version_short=@@VERSION_SHORT@@
+version_string=@@VERSION_STRING@@