8054834: Modular Source Code

Co-authored-by: Alan Bateman <alan.bateman@oracle.com>
Co-authored-by: Alex Buckley <alex.buckley@oracle.com>
Co-authored-by: Erik Joelsson <erik.joelsson@oracle.com>
Co-authored-by: Jonathan Gibbons <jonathan.gibbons@oracle.com>
Co-authored-by: Karen Kinnear <karen.kinnear@oracle.com>
Co-authored-by: Magnus Ihse Bursie <magnus.ihse.bursie@oracle.com>
Co-authored-by: Mandy Chung <mandy.chung@oracle.com>
Co-authored-by: Mark Reinhold <mark.reinhold@oracle.com>
Co-authored-by: Paul Sandoz <paul.sandoz@oracle.com>
Reviewed-by: alanb, chegar, ihse, mduigou
This commit is contained in:
Chris Hegarty 2014-08-17 15:52:32 +01:00
parent 4e543f382a
commit 2b80c4715f
826 changed files with 1569 additions and 807 deletions

View File

@ -1,47 +0,0 @@
#
# Copyright (c) 2011, 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.
#
# This must be the first rule
default: all
include $(SPEC)
gensrc-langtools:
+$(MAKE) -f $(LANGTOOLS_TOPDIR)/make/GensrcLangtools.gmk
interim-langtools: gensrc-langtools
+$(MAKE) -f $(LANGTOOLS_TOPDIR)/make/CompileInterim.gmk
genstubs-langtools: interim-langtools
+$(MAKE) -f $(LANGTOOLS_TOPDIR)/make/GenstubsLangtools.gmk
compile-langtools: gensrc-langtools interim-langtools genstubs-langtools
+$(MAKE) -f $(LANGTOOLS_TOPDIR)/make/CompileLangtools.gmk
all: compile-langtools
.PHONY: default all
.PHONY: gensrc-langtools interim-langtools genstubs-langtools compile-langtools

View File

@ -39,9 +39,12 @@ include CommonLangtools.gmk
$(eval $(call SetupJavaCompilation,BUILD_INTERIM_LANGTOOLS, \
SETUP := BOOT_JAVAC, \
DISABLE_SJAVAC := true, \
SRC := $(LANGTOOLS_TOPDIR)/src/share/classes \
$(LANGTOOLS_OUTPUTDIR)/gensrc \
$(LANGTOOLS_TOPDIR)/make/tools, \
SRC := $(LANGTOOLS_TOPDIR)/src/java.compiler/share/classes \
$(LANGTOOLS_TOPDIR)/src/jdk.compiler/share/classes \
$(LANGTOOLS_TOPDIR)/src/jdk.javadoc/share/classes \
$(LANGTOOLS_TOPDIR)/src/java.base/share/classes \
$(LANGTOOLS_OUTPUTDIR)/gensrc/jdk.compiler \
$(LANGTOOLS_OUTPUTDIR)/gensrc/jdk.javadoc, \
EXCLUDES := com/sun/tools/javac/nio compileproperties anttasks crules, \
COPY := $(RESOURCE_SUFFIXES), \
BIN := $(LANGTOOLS_OUTPUTDIR)/interim_classes, \

View File

@ -1,62 +0,0 @@
#
# 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.
#
# This must be the first rule
default: all
include $(SPEC)
include MakeBase.gmk
include JavaCompilation.gmk
include CommonLangtools.gmk
# Setup a compiler configuration using javac from the interim langtools jar
# that generates code for the new jdk that is being built. The code compiled
# by this compiler setup, cannot necessarily be run with the bootstrap jvm.
$(eval $(call SetupJavaCompiler,GENERATE_NEWBYTECODE, \
JVM := $(JAVA), \
JAVAC := $(NEW_JAVAC), \
FLAGS := -XDignore.symbol.file=true -Xlint:all$(COMMA)-deprecation -Werror, \
SERVER_DIR := $(SJAVAC_SERVER_DIR), \
SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
$(eval $(call SetupJavaCompilation,BUILD_FULL_LANGTOOLS, \
SETUP := GENERATE_NEWBYTECODE, \
SRC := $(LANGTOOLS_TOPDIR)/src/share/classes \
$(LANGTOOLS_OUTPUTDIR)/gensrc \
$(LANGTOOLS_OUTPUTDIR)/genstubs, \
EXCLUDES := java/util java/io java/nio, \
COPY := $(RESOURCE_SUFFIXES), \
BIN := $(LANGTOOLS_OUTPUTDIR)/classes, \
JAR := $(LANGTOOLS_OUTPUTDIR)/dist/lib/classes.jar))
# Construct the source zip separately to avoid picking up the genstubs sources.
$(eval $(call SetupZipArchive,ZIP_FULL_LANGTOOLS_SOURCE, \
SRC := $(LANGTOOLS_TOPDIR)/src/share/classes $(LANGTOOLS_OUTPUTDIR)/gensrc, \
ZIP := $(LANGTOOLS_OUTPUTDIR)/dist/lib/src.zip))
all: \
$(BUILD_FULL_LANGTOOLS) \
$(ZIP_FULL_LANGTOOLS_SOURCE)

View File

@ -34,10 +34,10 @@ include CommonLangtools.gmk
################################################################################
# Setup the compilation of the properties compilation tool. You can depend
# upon $(BUILD_TOOLS) to trigger a compilation of the tools. Note that we
# add src/share/classes to the sourcepath. This is necessary since the GenStubs
# program needs to be linked and run with the new javac sources.
$(eval $(call SetupJavaCompilation,BUILD_TOOLS, \
# upon $(BUILD_TOOLS_LANGTOOLS) to trigger a compilation of the tools. Note that
# we add src/share/classes to the sourcepath. This is necessary since the
# GenStubs program needs to be linked and run with the new javac sources.
$(eval $(call SetupJavaCompilation,BUILD_TOOLS_LANGTOOLS, \
SETUP := BOOT_JAVAC, \
DISABLE_SJAVAC := true, \
ADD_JAVAC_FLAGS := -Xprefer:source, \
@ -51,17 +51,19 @@ TOOL_COMPILEPROPS_CMD := $(JAVA) -cp $(LANGTOOLS_OUTPUTDIR)/buildtools_classes \
compileproperties.CompileProperties -quiet
# Lookup the properties that need to be compiled into resource bundles.
PROPSOURCES := $(shell $(FIND) $(LANGTOOLS_TOPDIR)/src/share/classes -name "*.properties")
PROPSOURCES := $(shell $(FIND) $(LANGTOOLS_TOPDIR)/src/*/share/classes -name "*.properties")
# Convert .../src/<module>/share/classes/com/sun/tools/javac/resources/javac_zh_CN.properties
# to .../langtools/gensrc/<module>/com/sun/tools/javac/resources/javac_zh_CN.java
# Strip away prefix and suffix, leaving for example only:
# "com/sun/tools/javac/resources/javac_zh_CN"
PROPPATHS := $(patsubst $(LANGTOOLS_TOPDIR)/src/share/classes/%.properties, %, $(PROPSOURCES))
# "<module>/share/classes/com/sun/tools/javac/resources/javac_zh_CN"
PROPJAVAS := $(patsubst $(LANGTOOLS_TOPDIR)/src/%.properties, \
$(LANGTOOLS_OUTPUTDIR)/gensrc/%.java, \
$(subst /share/classes,,$(PROPSOURCES)))
# Generate the list of java files to be created.
PROPJAVAS := $(patsubst %, $(LANGTOOLS_OUTPUTDIR)/gensrc/%.java, $(PROPPATHS))
# Generate the package dirs for the tobe generated java files.
PROPDIRS := $(dir $(PROPJAVAS))
# Generate the package dirs for the tobe generated java files. Sort to remove
# duplicates.
PROPDIRS := $(sort $(dir $(PROPJAVAS)))
# Now generate a sequence of:
# "-compile ...javac_zh_CN.properties ...javac_zh_CN.java java.util.ListResourceBundle"
@ -69,40 +71,38 @@ PROPDIRS := $(dir $(PROPJAVAS))
PROPCMDLINE := $(subst _SPACE_, $(SPACE), \
$(join $(addprefix -compile_SPACE_, $(PROPSOURCES)), \
$(addsuffix _SPACE_java.util.ListResourceBundle, \
$(addprefix _SPACE_$(LANGTOOLS_OUTPUTDIR)/gensrc/, \
$(addsuffix .java, $(PROPPATHS))))))
$(addprefix _SPACE_, $(PROPJAVAS)))))
# Now setup the rule for the generation of the resource bundles.
$(LANGTOOLS_OUTPUTDIR)/gensrc/_the_props: $(PROPSOURCES) $(BUILD_TOOLS)
$(LANGTOOLS_OUTPUTDIR)/gensrc/_the_props: $(PROPSOURCES) $(BUILD_TOOLS_LANGTOOLS)
$(RM) -r $(@D)/*
$(MKDIR) -p $(@D) $(PROPDIRS)
$(PRINTF) "jdk=$(JDK_VERSION)\nfull=$(FULL_VERSION)\nrelease=$(RELEASE)\n" \
> $(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/javah/resources/version.properties
> $(LANGTOOLS_OUTPUTDIR)/gensrc/jdk.compiler/com/sun/tools/javah/resources/version.properties
$(PRINTF) "jdk=$(JDK_VERSION)\nfull=$(FULL_VERSION)\nrelease=$(RELEASE)\n" \
> $(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/javap/resources/version.properties
> $(LANGTOOLS_OUTPUTDIR)/gensrc/jdk.compiler/com/sun/tools/javap/resources/version.properties
$(PRINTF) "jdk=$(JDK_VERSION)\nfull=$(FULL_VERSION)\nrelease=$(RELEASE)\n" \
> $(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/javac/resources/version.properties
> $(LANGTOOLS_OUTPUTDIR)/gensrc/jdk.compiler/com/sun/tools/javac/resources/version.properties
$(PRINTF) "jdk=$(JDK_VERSION)\nfull=$(FULL_VERSION)\nrelease=$(RELEASE)\n" \
> $(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/jdeps/resources/version.properties
> $(LANGTOOLS_OUTPUTDIR)/gensrc/jdk.dev/com/sun/tools/jdeps/resources/version.properties
$(PRINTF) "jdk=$(JDK_VERSION)\nfull=$(FULL_VERSION)\nrelease=$(RELEASE)\n" \
> $(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/javadoc/resources/version.properties
$(ECHO) Compiling $(words $(PROPSOURCES) javah javap javac jdeps javadoc) \
properties into resource bundles
> $(LANGTOOLS_OUTPUTDIR)/gensrc/jdk.javadoc/com/sun/tools/javadoc/resources/version.properties
$(ECHO) Compiling $(words $(PROPSOURCES) v1 v2 v3) properties into resource bundles
$(TOOL_COMPILEPROPS_CMD) $(PROPCMDLINE) \
-compile $(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/javah/resources/version.properties \
$(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/javah/resources/version.java \
-compile $(LANGTOOLS_OUTPUTDIR)/gensrc/jdk.compiler/com/sun/tools/javah/resources/version.properties \
$(LANGTOOLS_OUTPUTDIR)/gensrc/jdk.compiler/com/sun/tools/javah/resources/version.java \
java.util.ListResourceBundle \
-compile $(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/javap/resources/version.properties \
$(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/javap/resources/version.java \
-compile $(LANGTOOLS_OUTPUTDIR)/gensrc/jdk.compiler/com/sun/tools/javap/resources/version.properties \
$(LANGTOOLS_OUTPUTDIR)/gensrc/jdk.compiler/com/sun/tools/javap/resources/version.java \
java.util.ListResourceBundle \
-compile $(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/javac/resources/version.properties \
$(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/javac/resources/version.java \
-compile $(LANGTOOLS_OUTPUTDIR)/gensrc/jdk.compiler/com/sun/tools/javac/resources/version.properties \
$(LANGTOOLS_OUTPUTDIR)/gensrc/jdk.compiler/com/sun/tools/javac/resources/version.java \
java.util.ListResourceBundle \
-compile $(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/jdeps/resources/version.properties \
$(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/jdeps/resources/version.java \
-compile $(LANGTOOLS_OUTPUTDIR)/gensrc/jdk.dev/com/sun/tools/jdeps/resources/version.properties \
$(LANGTOOLS_OUTPUTDIR)/gensrc/jdk.dev/com/sun/tools/jdeps/resources/version.java \
java.util.ListResourceBundle \
-compile $(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/javadoc/resources/version.properties \
$(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/javadoc/resources/version.java \
-compile $(LANGTOOLS_OUTPUTDIR)/gensrc/jdk.javadoc/com/sun/tools/javadoc/resources/version.properties \
$(LANGTOOLS_OUTPUTDIR)/gensrc/jdk.javadoc/com/sun/tools/javadoc/resources/version.java \
java.util.ListResourceBundle
$(TOUCH) $@

View File

@ -1,70 +0,0 @@
#
# 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.
#
# This must be the first rule
default: all
include $(SPEC)
include MakeBase.gmk
include CommonLangtools.gmk
# GenStubs is used to bootstrap any dependencies from javac to the new JDK that is not
# yet built. It is currently not needed but might be again in the future. The following
# exercises the functionality to verify that it works.
TOOL_GENSTUBS_CMD = $(JAVA) \
"-Xbootclasspath/p:$(INTERIM_LANGTOOLS_JAR)" \
genstubs.GenStubs
# We fetch source from the JDK...
JDKS := $(JDK_TOPDIR)/src/share/classes
# Build the list of classes to generate stubs from. java/util/function/Predicate.java isn't
# currently needed, but is used as a demo for now.
STUBSOURCES := $(shell $(FIND) $(JDKS) -name "*.java" | $(GREP) \
-e "$(JDKS)/java/util/function/Predicate.java")
# Rewrite the file names into class names because the GenStubs tool require this.
STUBCLASSES := $(subst /,., $(patsubst $(JDKS)/%.java, %, $(STUBSOURCES)))
# Now setup the build recipe for genstubs.
$(LANGTOOLS_OUTPUTDIR)/genstubs/_the_stubs: $(STUBSOURCES)
$(MKDIR) -p $(@D)
$(MKDIR) -p $(LANGTOOLS_OUTPUTDIR)/tmpstubs
$(ECHO) $(LOG_INFO) Generating stubs from JDK sources.
$(TOOL_GENSTUBS_CMD) -s $(LANGTOOLS_OUTPUTDIR)/tmpstubs -sourcepath $(JDKS) $(STUBCLASSES)
if $(DIFF) -x "_the*" -rq $(LANGTOOLS_OUTPUTDIR)/tmpstubs $(LANGTOOLS_OUTPUTDIR)/genstubs \
> /dev/null 2>&1; then \
$(ECHO) $(LOG_INFO) No changes in the stubs!; \
$(RM) -r $(LANGTOOLS_OUTPUTDIR)/tmpstubs; \
else \
$(ECHO) $(LOG_INFO) Changes in stubs detected!; \
$(RM) -r $(@D); \
$(MV) $(LANGTOOLS_OUTPUTDIR)/tmpstubs $(@D); \
fi
$(TOUCH) $@
all: $(LANGTOOLS_OUTPUTDIR)/genstubs/_the_stubs

View File

@ -138,9 +138,18 @@
<property name="make.tools.dir" location="${make.dir}/tools"/>
<property name="src.dir" location="src"/>
<property name="src.bin.dir" location="${src.dir}/share/bin"/>
<property name="src.classes.dir" location="${src.dir}/share/classes"/>
<property name="test.dir" location="test"/>
<path id="src.dirs">
<pathelement path="${src.dir}/java.base/share/classes"/>
<pathelement path="${src.dir}/java.compiler/share/classes"/>
<pathelement path="${src.dir}/jdk.compiler/share/classes"/>
<pathelement path="${src.dir}/jdk.dev/share/classes"/>
<pathelement path="${src.dir}/jdk.javadoc/share/classes"/>
</path>
<pathconvert pathsep="," property="src.dirs.property" refid="src.dirs" />
<!-- java.marker is set to a marker file to check for within a Java install dir.
The best file to check for across Solaris/Linux/Windows/MacOS is one of the
executables; regrettably, that is OS-specific. -->
@ -237,7 +246,9 @@
</chmod>
<mkdir dir="${dist.lib.dir}"/>
<jar file="${dist.lib.dir}/classes.jar" basedir="${build.classes.dir}"/>
<zip file="${dist.lib.dir}/src.zip" basedir="${src.classes.dir}"/>
<zip file="${dist.lib.dir}/src.zip">
<multirootfileset basedirs="${src.dirs.property}" />
</zip>
</target>
<target name="build-bootstrap-tools"
@ -316,7 +327,7 @@
jvmargs="-Xmx512M">
<class location="${build.classes.dir}"/>
<sourcePath>
<pathelement location="${src.classes.dir}"/>
<path refid="src.dirs"/>
</sourcePath>
</findbugs>
<exec executable="sh">
@ -350,14 +361,24 @@
<target name="coverage-report" depends="-def-cobertura">
<mkdir dir="${dist.coverage.dir}"/>
<cobertura-report
srcdir="${src.classes.dir}"
destdir="${dist.coverage.dir}"
datafile="${build.coverage.dir}/cobertura.ser"/>
datafile="${build.coverage.dir}/cobertura.ser">
<fileset dir="${src.dir}/java.base/share/classes"/>
<fileset dir="${src.dir}/java.compiler/share/classes"/>
<fileset dir="${src.dir}/jdk.compiler/share/classes"/>
<fileset dir="${src.dir}/jdk.dev/share/classes"/>
<fileset dir="${src.dir}/jdk.javadoc/share/classes"/>
</cobertura-report>
<cobertura-report
format="xml"
srcdir="${src.classes.dir}"
destdir="${dist.coverage.dir}"
datafile="${build.coverage.dir}/cobertura.ser"/>
datafile="${build.coverage.dir}/cobertura.ser">
<fileset dir="${src.dir}/java.base/share/classes"/>
<fileset dir="${src.dir}/java.compiler/share/classes"/>
<fileset dir="${src.dir}/jdk.compiler/share/classes"/>
<fileset dir="${src.dir}/jdk.dev/share/classes"/>
<fileset dir="${src.dir}/jdk.javadoc/share/classes"/>
</cobertura-report>
</target>
<target name="diags-examples" depends="build-javac,build-javap">
@ -437,7 +458,6 @@
<mkdir dir="${build.dir}/doclint/classes"/>
<javac fork="true"
executable="${boot.javac}"
srcdir="${src.classes.dir}:${build.gensrc.dir}"
destdir="${build.dir}/doclint/classes"
includes="javax/lang/model/** com/sun/javadoc/** com/sun/source/**"
excludes=""
@ -454,6 +474,10 @@
<compilerarg line="${javac.no.jdk.warnings}"/>
<compilerarg line="${javac.version.opt}"/>
<compilerarg line="-Xdoclint:all/protected,-missing"/>
<src>
<path refid="src.dirs"/>
<path location="${build.gensrc.dir}"/>
</src>
</javac>
</target>
@ -864,7 +888,7 @@
<attribute name="java" default="${launcher.java}"/>
<sequential>
<mkdir dir="@{bin.dir}"/>
<copy file="${src.bin.dir}/launcher.sh-template" tofile="@{bin.dir}/@{name}">
<copy file="${make.dir}/launcher.sh-template" tofile="@{bin.dir}/@{name}">
<filterset begintoken="#" endtoken="#">
<filter token="PROGRAM" value="@{name}"/>
<filter token="TARGET_JAVA" value="@{java}"/>
@ -946,11 +970,14 @@
<echo level="verbose" message="build-classes: sourcepath=@{sourcepath}"/>
<mkdir dir="@{gensrc.dir}"/>
<mkdir dir="@{classes.dir}"/>
<pcompile srcdir="${src.classes.dir}"
destdir="@{gensrc.dir}"
includes="@{includes}"/>
<pcompile destdir="@{gensrc.dir}"
includes="@{includes}">
<src>
<path refid="src.dirs"/>
</src>
</pcompile>
<copy todir="@{gensrc.dir}">
<fileset dir="${src.classes.dir}" includes="@{includes}"/>
<multirootfileset basedirs="${src.dirs.property}" includes="@{includes}" />
<globmapper from="*.properties-template" to="*.properties"/>
<filterset begintoken="$(" endtoken=")">
<filter token="JDK_VERSION" value="${jdk.version}"/>
@ -958,12 +985,14 @@
<filter token="FULL_VERSION" value="@{full.version}"/>
</filterset>
</copy>
<pcompile srcdir="@{gensrc.dir}"
destdir="@{gensrc.dir}"
includes="**/*.properties"/>
<pcompile destdir="@{gensrc.dir}"
includes="**/*.properties">
<src>
<pathelement location="@{gensrc.dir}"/>
</src>
</pcompile>
<javac fork="true"
executable="@{java.home}/bin/javac"
srcdir="${src.classes.dir}:@{gensrc.dir}"
destdir="@{classes.dir}"
includes="@{includes}"
excludes="@{excludes}"
@ -982,9 +1011,13 @@
<compilerarg line="${javac.version.opt}"/>
<compilerarg line="${javac.lint.opts}"/>
<compilerarg line="@{plugin.options}"/>
<src>
<path refid="src.dirs"/>
<path location="@{gensrc.dir}"/>
</src>
</javac>
<copy todir="@{classes.dir}" includeemptydirs="false">
<fileset dir="${src.classes.dir}" includes="@{includes}" excludes="@{excludes}">
<multirootfileset basedirs="${src.dirs.property}" includes="@{includes}" excludes="@{excludes}">
<exclude name="**/*.java"/>
<exclude name="**/*.properties"/>
<exclude name="**/*-template"/>
@ -992,7 +1025,7 @@
<exclude name="**/*.orig"/>
<exclude name="**/overview.html"/>
<exclude name="**/package.html"/>
</fileset>
</multirootfileset>
</copy>
</sequential>
</macrodef>
@ -1037,7 +1070,7 @@
target="${boot.javac.target}"
executable="${boot.java.home}/bin/javac"
srcdir="${make.tools.dir}"
includes="compileproperties/* anttasks/CompileProperties*"
includes="compileproperties/* anttasks/CompileProperties* anttasks/PathFileSet*"
destdir="${build.toolclasses.dir}/"
classpath="${ant.core.lib}"
bootclasspath="${boot.java.home}/jre/lib/rt.jar"
@ -1099,11 +1132,11 @@
<attribute name="name"/>
<attribute name="includes"/>
<attribute name="options" default=""/>
<attribute name="source" default="1.5"/> <!-- FIXME -->
<attribute name="source" default="${javac.source}"/>
<sequential>
<property name="javadoc.options" value=""/> <!-- default, can be overridden per user or per project -->
<!-- Note: even with this default value, includes
from src.classes.dir get javadoc'd; see packageset below -->
from source directories get javadoc'd; see packageset below -->
<property name="javadoc.packagenames" value="none"/> <!-- default, can be overridden per user or per project -->
<javadoc
executable="${target.java.home}/bin/javadoc"
@ -1117,18 +1150,52 @@
packagenames="${javadoc.packagenames}" >
<header><![CDATA[<strong>Unofficial Javadoc</strong> generated from developer sources for preview purposes only]]></header>
<arg line="@{options}"/>
<arg value="-tag" />
<arg value="implNote:a:Implementation Note:"/>
<bootclasspath>
<path location="${build.classes.dir}"/>
<path location="${target.java.home}/jre/lib/rt.jar"/>
</bootclasspath>
<sourcepath>
<pathelement location="${src.classes.dir}"/>
<path refid="src.dirs"/>
</sourcepath>
<!-- XXX just <fileset> (restricted further to **/*.java) and no <packageset> -->
<!-- means that {@link some.package} will not work, which is no good. -->
<!-- (It correctly skips excluded single classes, but not if packageset is also included, -->
<!-- which also causes duplicates in the class index for included files.) -->
<packageset dir="${src.classes.dir}" includes="@{includes}">
<packageset dir="${src.dir}/java.base/share/classes" includes="@{includes}">
<or>
<filename name="java/"/>
<filename name="javax/"/>
<filename name="com/sun/javadoc/"/>
<filename name="com/sun/source/"/>
</or>
</packageset>
<packageset dir="${src.dir}/java.compiler/share/classes" includes="@{includes}">
<or>
<filename name="java/"/>
<filename name="javax/"/>
<filename name="com/sun/javadoc/"/>
<filename name="com/sun/source/"/>
</or>
</packageset>
<packageset dir="${src.dir}/jdk.compiler/share/classes" includes="@{includes}">
<or>
<filename name="java/"/>
<filename name="javax/"/>
<filename name="com/sun/javadoc/"/>
<filename name="com/sun/source/"/>
</or>
</packageset>
<packageset dir="${src.dir}/jdk.dev/share/classes" includes="@{includes}">
<or>
<filename name="java/"/>
<filename name="javax/"/>
<filename name="com/sun/javadoc/"/>
<filename name="com/sun/source/"/>
</or>
</packageset>
<packageset dir="${src.dir}/jdk.javadoc/share/classes" includes="@{includes}">
<or>
<filename name="java/"/>
<filename name="javax/"/>
@ -1235,7 +1302,7 @@
<pathelement location="${build.classes.dir}"/>
</auxClasspath>
<sourcePath>
<pathelement location="${src.classes.dir}"/>
<path refid="src.dirs"/>
</sourcePath>
</findbugs>
</sequential>

View File

@ -79,11 +79,12 @@
<target name="compile-single" depends="build-bootstrap-javac">
<fail unless="includes">Must set property 'includes'</fail>
<javac fork="true" executable="${build.bootstrap.dir}/bin/javac"
srcdir="${src.classes.dir}"
srcdir="${srcdir}"
destdir="${build.classes.dir}"
includes="${includes}"
sourcepath=""
includeAntRuntime="no"
source="${javac.source}"
target="${javac.target}"
debug="${javac.debug}"
debuglevel="${javac.debuglevel}"/>
@ -174,7 +175,7 @@
<target name="debug-single" depends="-check-target.java.home,-def-start-debugger,-def-run">
<fail unless="debug.classname">Must set property 'debug.classname'</fail>
<start-debugger/>
<run mainclass="${debug.classname}" default.args="" jpda.jvmargs="${jpda.jvmargs}"/>
<run mainclass="${debug.classname}" args="" jpda.jvmargs="${jpda.jvmargs}"/>
</target>
<!-- Debug a jtreg test. -->
@ -186,7 +187,7 @@
<!-- Update a class being debugged. -->
<target name="debug-fix" if="langtools.tool.name">
<target name="debug-fix">
<fail unless="class">Must set property 'class'
</fail>
<antcall target="compile-single">
@ -281,7 +282,7 @@
<pathelement location="${target.java.home}/jre/lib/rt.jar"/>
</bootclasspath>
<sourcepath>
<pathelement location="${src.classes.dir}"/>
<path refid="src.dirs"/>
</sourcepath>
</nbjpdastart>
<property

View File

@ -57,9 +57,29 @@
<location>${root}/make</location>
</source-folder>
<source-folder>
<label>Source files</label>
<label>Source files - java.base</label>
<type>java</type>
<location>${root}/src/share/classes</location>
<location>${root}/src/java.base/share/classes</location>
</source-folder>
<source-folder>
<label>Source files - java.compiler</label>
<type>java</type>
<location>${root}/src/java.compiler/share/classes</location>
</source-folder>
<source-folder>
<label>Source files - jdk.compiler</label>
<type>java</type>
<location>${root}/src/jdk.compiler/share/classes</location>
</source-folder>
<source-folder>
<label>Source files - jdk.dev</label>
<type>java</type>
<location>${root}/src/jdk.dev/share/classes</location>
</source-folder>
<source-folder>
<label>Source files - jdk.javadoc</label>
<type>java</type>
<location>${root}/src/jdk.javadoc/share/classes</location>
</source-folder>
<build-file>
<location>${root}/build/classes</location>
@ -87,10 +107,62 @@
</action>
<action name="compile.single">
<target>compile-single</target>
<property name="srcdir">${root}/src/share/classes</property>
<property name="srcdir">src/java.base/share/classes</property>
<context>
<property>includes</property>
<folder>${root}/src/share/classes</folder>
<folder>${root}/src/java.base/share/classes</folder>
<pattern>\.java$</pattern>
<format>relative-path</format>
<arity>
<separated-files>,</separated-files>
</arity>
</context>
</action>
<action name="compile.single">
<target>compile-single</target>
<property name="srcdir">src/java.compiler/share/classes</property>
<context>
<property>includes</property>
<folder>${root}/src/java.compiler/share/classes</folder>
<pattern>\.java$</pattern>
<format>relative-path</format>
<arity>
<separated-files>,</separated-files>
</arity>
</context>
</action>
<action name="compile.single">
<target>compile-single</target>
<property name="srcdir">src/jdk.compiler/share/classes</property>
<context>
<property>includes</property>
<folder>${root}/src/jdk.compiler/share/classes</folder>
<pattern>\.java$</pattern>
<format>relative-path</format>
<arity>
<separated-files>,</separated-files>
</arity>
</context>
</action>
<action name="compile.single">
<target>compile-single</target>
<property name="srcdir">src/jdk.dev/share/classes</property>
<context>
<property>includes</property>
<folder>${root}/src/jdk.dev/share/classes</folder>
<pattern>\.java$</pattern>
<format>relative-path</format>
<arity>
<separated-files>,</separated-files>
</arity>
</context>
</action>
<action name="compile.single">
<target>compile-single</target>
<property name="srcdir">src/jdk.javadoc/share/classes</property>
<context>
<property>includes</property>
<folder>${root}/src/jdk.javadoc/share/classes</folder>
<pattern>\.java$</pattern>
<format>relative-path</format>
<arity>
@ -105,7 +177,55 @@
<target>run-single</target>
<context>
<property>run.classname</property>
<folder>${root}/src/share/classes</folder>
<folder>${root}/src/jdk.base/share/classes</folder>
<pattern>\.java$</pattern>
<format>java-name</format>
<arity>
<one-file-only/>
</arity>
</context>
</action>
<action name="run.single">
<target>run-single</target>
<context>
<property>run.classname</property>
<folder>${root}/src/java.compiler/share/classes</folder>
<pattern>\.java$</pattern>
<format>java-name</format>
<arity>
<one-file-only/>
</arity>
</context>
</action>
<action name="run.single">
<target>run-single</target>
<context>
<property>run.classname</property>
<folder>${root}/src/jdk.compiler/share/classes</folder>
<pattern>\.java$</pattern>
<format>java-name</format>
<arity>
<one-file-only/>
</arity>
</context>
</action>
<action name="run.single">
<target>run-single</target>
<context>
<property>run.classname</property>
<folder>${root}/src/jdk.dev/share/classes</folder>
<pattern>\.java$</pattern>
<format>java-name</format>
<arity>
<one-file-only/>
</arity>
</context>
</action>
<action name="run.single">
<target>run-single</target>
<context>
<property>run.classname</property>
<folder>${root}/src/jdk.javadoc/share/classes</folder>
<pattern>\.java$</pattern>
<format>java-name</format>
<arity>
@ -139,7 +259,55 @@
<target>debug-single</target>
<context>
<property>debug.classname</property>
<folder>${root}/src/share/classes</folder>
<folder>${root}/src/java.base/share/classes</folder>
<pattern>\.java$</pattern>
<format>java-name</format>
<arity>
<one-file-only/>
</arity>
</context>
</action>
<action name="debug.single">
<target>debug-single</target>
<context>
<property>debug.classname</property>
<folder>${root}/src/java.compiler/share/classes</folder>
<pattern>\.java$</pattern>
<format>java-name</format>
<arity>
<one-file-only/>
</arity>
</context>
</action>
<action name="debug.single">
<target>debug-single</target>
<context>
<property>debug.classname</property>
<folder>${root}/src/jdk.compiler/share/classes</folder>
<pattern>\.java$</pattern>
<format>java-name</format>
<arity>
<one-file-only/>
</arity>
</context>
</action>
<action name="debug.single">
<target>debug-single</target>
<context>
<property>debug.classname</property>
<folder>${root}/src/jdk.dev/share/classes</folder>
<pattern>\.java$</pattern>
<format>java-name</format>
<arity>
<one-file-only/>
</arity>
</context>
</action>
<action name="debug.single">
<target>debug-single</target>
<context>
<property>debug.classname</property>
<folder>${root}/src/jdk.javadoc/share/classes</folder>
<pattern>\.java$</pattern>
<format>java-name</format>
<arity>
@ -165,10 +333,62 @@
</action>
<action name="debug.fix">
<target>debug-fix</target>
<property name="srcdir">${root}/src/share/classes</property>
<property name="srcdir">src/java.base/share/classes</property>
<context>
<property>class</property>
<folder>${root}/src/share/classes</folder>
<folder>${root}/src/java.base/share/classes</folder>
<pattern>\.java$</pattern>
<format>relative-path-noext</format>
<arity>
<one-file-only/>
</arity>
</context>
</action>
<action name="debug.fix">
<target>debug-fix</target>
<property name="srcdir">src/java.compiler/share/classes</property>
<context>
<property>class</property>
<folder>${root}/src/java.compiler/share/classes</folder>
<pattern>\.java$</pattern>
<format>relative-path-noext</format>
<arity>
<one-file-only/>
</arity>
</context>
</action>
<action name="debug.fix">
<target>debug-fix</target>
<property name="srcdir">src/jdk.compiler/share/classes</property>
<context>
<property>class</property>
<folder>${root}/src/jdk.compiler/share/classes</folder>
<pattern>\.java$</pattern>
<format>relative-path-noext</format>
<arity>
<one-file-only/>
</arity>
</context>
</action>
<action name="debug.fix">
<target>debug-fix</target>
<property name="srcdir">src/jdk.dev/share/classes</property>
<context>
<property>class</property>
<folder>${root}/src/jdk.dev/share/classes</folder>
<pattern>\.java$</pattern>
<format>relative-path-noext</format>
<arity>
<one-file-only/>
</arity>
</context>
</action>
<action name="debug.fix">
<target>debug-fix</target>
<property name="srcdir">src/jdk.dev/share/classes</property>
<context>
<property>class</property>
<folder>${root}/src/jdk.javadoc/share/classes</folder>
<pattern>\.java$</pattern>
<format>relative-path-noext</format>
<arity>
@ -197,8 +417,24 @@
<view>
<items>
<source-folder style="tree">
<label>Source files</label>
<location>${root}/src/share/classes</location>
<label>Source files - java.base</label>
<location>${root}/src/java.base/share/classes</location>
</source-folder>
<source-folder style="tree">
<label>Source files - java.compiler</label>
<location>${root}/src/java.compiler/share/classes</location>
</source-folder>
<source-folder style="tree">
<label>Source files - jdk.compiler</label>
<location>${root}/src/jdk.compiler/share/classes</location>
</source-folder>
<source-folder style="tree">
<label>Source files - jdk.dev</label>
<location>${root}/src/jdk.dev/share/classes</location>
</source-folder>
<source-folder style="tree">
<label>Source files - jdk.javadoc</label>
<location>${root}/src/jdk.javadoc/share/classes</location>
</source-folder>
<source-folder style="tree">
<label>Test files</label>
@ -239,11 +475,15 @@
</view>
<subprojects/>
</general-data>
<java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/3">
<java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/4">
<compilation-unit>
<package-root>${root}/src/share/classes</package-root>
<package-root>${root}/src/java.base/share/classes</package-root>
<package-root>${root}/src/java.compiler/share/classes</package-root>
<package-root>${root}/src/jdk.compiler/share/classes</package-root>
<package-root>${root}/src/jdk.dev/share/classes</package-root>
<package-root>${root}/src/jdk.javadoc/share/classes</package-root>
<built-to>${root}/build/classes</built-to>
<source-level>1.7</source-level>
<source-level>1.8</source-level>
</compilation-unit>
</java-data>
</configuration>

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 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
@ -25,20 +25,24 @@
package anttasks;
import compileproperties.CompileProperties;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import compileproperties.CompileProperties;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.taskdefs.MatchingTask;
import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.Resource;
public class CompilePropertiesTask extends MatchingTask {
public void setSrcDir(File srcDir) {
this.srcDir = srcDir;
public void addSrc(Path src) {
if (srcDirs == null)
srcDirs = new Path(getProject());
srcDirs.add(src);
}
public void setDestDir(File destDir) {
@ -64,25 +68,28 @@ public class CompilePropertiesTask extends MatchingTask {
};
List<String> mainOpts = new ArrayList<String>();
int count = 0;
DirectoryScanner s = getDirectoryScanner(srcDir);
for (String path: s.getIncludedFiles()) {
if (path.endsWith(".properties")) {
String destPath =
path.substring(0, path.length() - ".properties".length()) +
".java";
File srcFile = new File(srcDir, path);
File destFile = new File(destDir, destPath);
// Arguably, the comparison in the next line should be ">", not ">="
// but that assumes the resolution of the last modified time is fine
// grained enough; in practice, it is better to use ">=".
if (destFile.exists() && destFile.lastModified() >= srcFile.lastModified())
continue;
destFile.getParentFile().mkdirs();
mainOpts.add("-compile");
mainOpts.add(srcFile.getPath());
mainOpts.add(destFile.getPath());
mainOpts.add(superclass);
count++;
for (String dir : srcDirs.list()) {
File baseDir = getProject().resolveFile(dir);
DirectoryScanner s = getDirectoryScanner(baseDir);
for (String path: s.getIncludedFiles()) {
if (path.endsWith(".properties")) {
String destPath =
path.substring(0, path.length() - ".properties".length()) +
".java";
File srcFile = new File(baseDir, path);
File destFile = new File(destDir, destPath);
// Arguably, the comparison in the next line should be ">", not ">="
// but that assumes the resolution of the last modified time is fine
// grained enough; in practice, it is better to use ">=".
if (destFile.exists() && destFile.lastModified() >= srcFile.lastModified())
continue;
destFile.getParentFile().mkdirs();
mainOpts.add("-compile");
mainOpts.add(srcFile.getPath());
mainOpts.add(destFile.getPath());
mainOpts.add(superclass);
count++;
}
}
}
if (mainOpts.size() > 0) {
@ -95,7 +102,7 @@ public class CompilePropertiesTask extends MatchingTask {
}
}
private File srcDir;
private Path srcDirs;
private File destDir;
private String superclass = "java.util.ListResourceBundle";
}

View File

@ -350,8 +350,11 @@ public class CompileProperties {
int i = inEnd;
int j = outEnd;
while (i >= 0 && j >= 0) {
// If a dir contains a dot, it's not a valid package and most likely
// a module name.
if (!inputs[i].equals(outputs[j]) ||
(inputs[i].equals("gensrc") && inputs[j].equals("gensrc"))) {
(inputs[i].equals("gensrc") && outputs[j].equals("gensrc")) ||
(inputs[i].contains("."))) {
++i;
++j;
break;
@ -363,9 +366,6 @@ public class CompileProperties {
if (i < 0 || j < 0 || i >= inEnd || j >= outEnd) {
result = "";
} else {
if (inputs[i].equals("classes") && outputs[j].equals("classes")) {
++i;
}
inStart = i;
StringBuffer buf = new StringBuffer();
for (i = inStart; i <= inEnd; i++) {

Some files were not shown because too many files have changed in this diff Show More