This commit is contained in:
Iris Clark 2015-11-29 20:30:01 -08:00
commit 1ad5b907b1
4 changed files with 23 additions and 32 deletions

View File

@ -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
@ -31,19 +31,12 @@ include MakeBase.gmk
include JarArchive.gmk
include JavaCompilation.gmk
include SetupJavaCompilers.gmk
include TextFileProcessing.gmk
JDK_CLASSES := $(call PathList, $(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, \
@ -93,25 +86,23 @@ $(NASGEN_RUN_FILE): $(BUILD_NASGEN)
$(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 SetupJarArchive, BUILD_NASHORN_JAR, \
DEPENDENCIES := $(NASGEN_RUN_FILE) \
$(VERSION_FILE), \
$(eval $(call SetupJarArchive,BUILD_NASHORN_JAR, \
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, \
@ -120,7 +111,7 @@ $(eval $(call SetupJarArchive, BUILD_NASHORN_JAR, \
JAR := $(NASHORN_JAR), \
))
compile: $(NASHORN_RUN_FILE) $(VERSION_FILE)
compile: $(NASHORN_RUN_FILE) $(BUILD_VERSION_FILE)
all: $(NASHORN_JAR)
.PHONY: compile all

View File

@ -158,9 +158,9 @@
<copy file="${nashorn.module.src.dir}/jdk/internal/dynalink/support/messages.properties" todir="${build.classes.dir}/jdk/internal/dynalink/support"/>
<copy file="${nashorn.module.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">

View File

@ -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 @@ public final class Version {
* @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 @@ public final class Version {
* @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";

View File

@ -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
@ -23,5 +23,5 @@
# questions.
#
full=$(FULL_VERSION)
release=$(RELEASE)
version_short=@@VERSION_SHORT@@
version_string=@@VERSION_STRING@@