--- a/jdk/make/gensrc/Gensrc-java.base.gmk Tue Oct 14 19:35:03 2014 +0200
+++ b/jdk/make/gensrc/Gensrc-java.base.gmk Thu Oct 16 10:37:57 2014 +0200
@@ -25,10 +25,6 @@
include GensrcCommon.gmk
-# TODO: maybe split into separate modules?
-include GensrcProperties.gmk
-GENSRC_JAVA_BASE += $(GENSRC_PROPERTIES)
-
include GensrcLocaleData.gmk
include GensrcCharacterData.gmk
include GensrcMisc.gmk
@@ -37,6 +33,34 @@
include GensrcBuffer.gmk
include GensrcExceptions.gmk
+################################################################################
+
+include GensrcProperties.gmk
+
+$(eval $(call SetupCompileProperties,LIST_RESOURCE_BUNDLE, \
+ $(filter %.properties, \
+ $(call CacheFind, $(JDK_TOPDIR)/src/java.base/share/classes/sun/launcher/resources)), \
+ ListResourceBundle))
+
+$(eval $(call SetupCompileProperties,SUN_UTIL, \
+ $(filter %.properties, \
+ $(call CacheFind, $(JDK_TOPDIR)/src/java.base/share/classes/sun/util/resources)), \
+ sun.util.resources.LocaleNamesBundle))
+
+GENSRC_JAVA_BASE += $(LIST_RESOURCE_BUNDLE) $(SUN_UTIL)
+
+# Some resources bundles are already present as java files but still need to be
+# copied to zh_HK locale.
+$(eval $(call SetupCopy-zh_HK,COPY_ZH_HK, \
+ $(addprefix $(JDK_TOPDIR)/src/java.base/share/classes/, \
+ sun/misc/resources/Messages_zh_TW.java \
+ sun/security/util/AuthResources_zh_TW.java \
+ sun/security/util/Resources_zh_TW.java)))
+
+GENSRC_JAVA_BASE += $(COPY_ZH_HK)
+
+################################################################################
+
java.base: $(GENSRC_JAVA_BASE)
all: java.base
--- a/jdk/make/gensrc/Gensrc-java.desktop.gmk Tue Oct 14 19:35:03 2014 +0200
+++ b/jdk/make/gensrc/Gensrc-java.desktop.gmk Thu Oct 16 10:37:57 2014 +0200
@@ -38,6 +38,48 @@
include GensrcSwing.gmk
+################################################################################
+
+include GensrcProperties.gmk
+
+PROP_SRC_DIRS := \
+ $(JDK_TOPDIR)/src/java.desktop/share/classes/sun/awt/resources \
+ $(JDK_TOPDIR)/src/java.desktop/share/classes/com/sun/accessibility/internal/resources \
+ $(JDK_TOPDIR)/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/resources \
+ $(JDK_TOPDIR)/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/resources \
+ $(JDK_TOPDIR)/src/java.desktop/share/classes/com/sun/swing/internal/plaf/basic/resources \
+ $(JDK_TOPDIR)/src/java.desktop/share/classes/com/sun/swing/internal/plaf/metal/resources \
+ $(JDK_TOPDIR)/src/java.desktop/share/classes/com/sun/swing/internal/plaf/synth/resources \
+ $(JDK_TOPDIR)/src/java.desktop/share/classes/sun/print/resources \
+ #
+
+ifeq ($(OPENJDK_TARGET_OS), macosx)
+ PROP_SRC_DIRS += \
+ $(JDK_TOPDIR)/src/java.desktop/macosx/classes/com/apple/laf/resources \
+ $(JDK_TOPDIR)/src/java.desktop/macosx/classes/sun/awt/resources \
+ #
+endif
+
+ifeq ($(OPENJDK_TARGET_OS), windows)
+ PROP_SRC_DIRS += $(JDK_TOPDIR)/src/java.desktop/windows/classes/sun/awt/windows
+else
+ PROP_SRC_DIRS += $(JDK_TOPDIR)/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/resources
+endif
+
+$(eval $(call SetupCompileProperties,COMPILE_PROPERTIES, \
+ $(filter %.properties, $(call CacheFind, $(PROP_SRC_DIRS))), ListResourceBundle))
+
+GENSRC_JAVA_DESKTOP += $(COMPILE_PROPERTIES)
+
+# Some resources bundles are already present as java files but still need to be
+# copied to zh_HK locale.
+$(eval $(call SetupCopy-zh_HK,COPY_ZH_HK, \
+ $(JDK_TOPDIR)/src/java.desktop/share/classes/sun/applet/resources/MsgAppletViewer_zh_TW.java))
+
+GENSRC_JAVA_DESKTOP += $(COPY_ZH_HK)
+
+################################################################################
+
java.desktop: $(GENSRC_JAVA_DESKTOP)
all: java.desktop
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/gensrc/Gensrc-java.logging.gmk Thu Oct 16 10:37:57 2014 +0200
@@ -0,0 +1,43 @@
+#
+# 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.
+#
+
+include GensrcCommon.gmk
+
+################################################################################
+
+include GensrcProperties.gmk
+
+$(eval $(call SetupCompileProperties,COMPILE_PROPERTIES, \
+ $(filter %.properties, \
+ $(call CacheFind, $(JDK_TOPDIR)/src/java.logging/share/classes/sun/util/logging/resources)), \
+ ListResourceBundle))
+
+TARGETS += $(COMPILE_PROPERTIES)
+
+################################################################################
+
+all: $(TARGETS)
+
+.PHONY: all
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/gensrc/Gensrc-java.management.gmk Thu Oct 16 10:37:57 2014 +0200
@@ -0,0 +1,43 @@
+#
+# 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.
+#
+
+include GensrcCommon.gmk
+
+################################################################################
+
+include GensrcProperties.gmk
+
+$(eval $(call SetupCompileProperties,COMPILE_PROPERTIES, \
+ $(filter %.properties, \
+ $(call CacheFind, $(JDK_TOPDIR)/src/java.management/share/classes/sun/management/resources)), \
+ ListResourceBundle))
+
+TARGETS += $(COMPILE_PROPERTIES)
+
+################################################################################
+
+all: $(TARGETS)
+
+.PHONY: all
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/gensrc/Gensrc-jdk.dev.gmk Thu Oct 16 10:37:57 2014 +0200
@@ -0,0 +1,43 @@
+#
+# 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.
+#
+
+include GensrcCommon.gmk
+
+################################################################################
+
+include GensrcProperties.gmk
+
+$(eval $(call SetupCompileProperties,COMPILE_PROPERTIES, \
+ $(filter %.properties, \
+ $(call CacheFind, $(JDK_TOPDIR)/src/jdk.dev/share/classes/sun/tools/jar/resources)), \
+ ListResourceBundle))
+
+TARGETS += $(COMPILE_PROPERTIES)
+
+################################################################################
+
+all: $(TARGETS)
+
+.PHONY: all
--- a/jdk/make/gensrc/Gensrc-jdk.jdi.gmk Tue Oct 14 19:35:03 2014 +0200
+++ b/jdk/make/gensrc/Gensrc-jdk.jdi.gmk Thu Oct 16 10:37:57 2014 +0200
@@ -69,6 +69,17 @@
################################################################################
+include GensrcProperties.gmk
+
+$(eval $(call SetupCompileProperties,COMPILE_PROPERTIES, \
+ $(filter %.properties, \
+ $(call CacheFind, $(JDK_TOPDIR)/src/jdk.jdi/share/classes/com/sun/tools/jdi/resources)), \
+ ListResourceBundle))
+
+GENSRC_JDK_JDI += $(COMPILE_PROPERTIES)
+
+################################################################################
+
jdk.jdi: $(GENSRC_JDK_JDI)
all: jdk.jdi
--- a/jdk/make/gensrc/Gensrc-jdk.localedata.gmk Tue Oct 14 19:35:03 2014 +0200
+++ b/jdk/make/gensrc/Gensrc-jdk.localedata.gmk Thu Oct 16 10:37:57 2014 +0200
@@ -31,6 +31,20 @@
include GensrcLocaleData.gmk
include GensrcCLDR.gmk
+################################################################################
+
+include GensrcProperties.gmk
+
+$(eval $(call SetupCompileProperties,COMPILE_PROPERTIES, \
+ $(filter %.properties, \
+ $(call CacheFind, $(JDK_TOPDIR)/src/jdk.localedata/share/classes/sun/util/resources)), \
+ sun.util.resources.LocaleNamesBundle))
+
+# Skip generating zh_HK from zh_TW for this module.
+GENSRC_JDK_LOCALEDATA += $(filter-out %_zh_HK.java, $(COMPILE_PROPERTIES))
+
+################################################################################
+
jdk.localedata: $(GENSRC_JDK_LOCALEDATA)
all: jdk.localedata
--- a/jdk/make/gensrc/GensrcProperties.gmk Tue Oct 14 19:35:03 2014 +0200
+++ b/jdk/make/gensrc/GensrcProperties.gmk Thu Oct 16 10:37:57 2014 +0200
@@ -23,132 +23,81 @@
# questions.
#
-# All .properties files to be compiled are appended to this variable.
-ALL_COMPILED_PROPSOURCES :=
-# All generated .java files from compilation are appended to this variable.
-ALL_COMPILED_PROPJAVAS :=
-# The (very long) command line for compilation, stored in a file, prior to use.
-COMPILE_PROPCMDLINE :=
+# This file defines macros that sets up rules for generating java classes
+# from resource bundle properties files.
-define add_properties_to_compile
- # $1 is the name of the properties group
- # $2 is the files belonging to this group
- # $3 is the super class for the generated java file.
+################################################################################
+# Helper macro for SetupCopy-zh_HK.
+define SetupOneCopy-zh_HK
+ $1_$2_TARGET := $$(patsubst $(JDK_TOPDIR)/src/$(MODULE)/share/classes/%, \
+ $(JDK_OUTPUTDIR)/gensrc/$(MODULE)/%, \
+ $$(subst _zh_TW,_zh_HK, $2))
- # Convert <root>/jdk/src/<module>/share/classes/sun/util/resources/CurrencyNames_sv.properties
- # to <build>/jdk/gensrc/<module/sun/util/resources/CurrencyNames_sv.java
- $1_PROPJAVAS := $$(patsubst $(JDK_TOPDIR)/src/%.properties, \
- $(JDK_OUTPUTDIR)/gensrc/%.java, \
- $$(subst /share/classes,, \
- $$(subst /$(OPENJDK_TARGET_OS_API_DIR)/classes,, \
- $$(subst /$(OPENJDK_TARGET_OS)/classes,, $2))))
+ $$($1_$2_TARGET): $2
+ $(MKDIR) -p $$(@D)
+ $(CAT) $$< | $(SED) -e '/class/s/_zh_TW/_zh_HK/' > $$@
+
+ $1 += $$($1_$2_TARGET)
+endef
- # Accumulate all found properties files.
- ALL_COMPILED_PROPSOURCES += $2
-
- # Generate the list of to be created java files.
- ALL_COMPILED_PROPJAVAS += $$($1_PROPJAVAS)
-
- # Now generate a sequence of
- # "-compile ...CurrencyNames_sv.properties ...CurrencyNames_sv.java ListResourceBundle"
- # suitable to be fed into the CompileProperties command.
- COMPILE_PROPCMDLINE += $$(subst _SPACE_,$(SPACE),$$(join $$(addprefix -compile_SPACE_, $2), \
- $$(addsuffix _SPACE_$(strip $3), \
- $$(addprefix _SPACE_, $$($1_PROPJAVAS)))))
+################################################################################
+# Creates rules for copying zh_TW resources to zh_HK.
+# Param 1 - Variable to add targets to
+# Param 2 - Files to copy from
+define SetupCopy-zh_HK
+ $$(foreach f, $2, $$(eval $$(call SetupOneCopy-zh_HK,$1,$$f)))
endef
################################################################################
-# Some packages have properties that need to be converted to java source files.
-COMPILE_PROP_SRC_FILES := \
- $(filter %.properties, $(call CacheFind, \
- $(JDK_TOPDIR)/src/java.desktop/share/classes/com/sun/accessibility/internal/resources \
- $(JDK_TOPDIR)/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/resources \
- $(JDK_TOPDIR)/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/resources \
- $(JDK_TOPDIR)/src/java.desktop/share/classes/com/sun/swing/internal/plaf/basic/resources \
- $(JDK_TOPDIR)/src/java.desktop/share/classes/com/sun/swing/internal/plaf/metal/resources \
- $(JDK_TOPDIR)/src/java.desktop/share/classes/com/sun/swing/internal/plaf/synth/resources \
- $(JDK_TOPDIR)/src/jdk.jdi/share/classes/com/sun/tools/jdi/resources \
- $(JDK_TOPDIR)/src/java.desktop/share/classes/sun/awt/resources \
- $(JDK_TOPDIR)/src/java.base/share/classes/sun/launcher/resources \
- $(JDK_TOPDIR)/src/java.management/share/classes/sun/management/resources \
- $(JDK_TOPDIR)/src/java.desktop/share/classes/sun/print/resources \
- $(JDK_TOPDIR)/src/jdk.dev/share/classes/sun/tools/jar/resources \
- $(JDK_TOPDIR)/src/java.logging/share/classes/sun/util/logging/resources)) \
- #
+# Creates a rule that runs CompileProperties on a set of properties files.
+# Param 1 - Variable to add targets to, must not contain space
+# Param 2 - Properties files to process
+# Param 3 - The super class for the generated classes
+define SetupCompileProperties
+ $1_SRCS := $2
+ $1_CLASS := $3
+
+ # 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:
+ # "<module>/share/classes/com/sun/tools/javac/resources/javac_zh_CN"
+ $1_JAVAS := $$(patsubst $(JDK_TOPDIR)/src/%, \
+ $(JDK_OUTPUTDIR)/gensrc/%, \
+ $$(patsubst %.properties, %.java, \
+ $$(subst /share/classes,, $$($1_SRCS))))
+
+ # Generate the package dirs for the to be generated java files. Sort to remove
+ # duplicates.
+ $1_DIRS := $$(sort $$(dir $$($1_JAVAS)))
-ifeq ($(OPENJDK_TARGET_OS), macosx)
- COMPILE_PROP_SRC_FILES += \
- $(filter %.properties, $(call CacheFind, \
- $(JDK_TOPDIR)/src/java.desktop/macosx/classes/com/apple/laf/resources \
- $(JDK_TOPDIR)/src/java.desktop/macosx/classes/sun/awt/resources)) \
- #
-endif
+ # Now generate a sequence of:
+ # "-compile ...javac_zh_CN.properties ...javac_zh_CN.java java.util.ListResourceBundle"
+ # suitable to be fed into the CompileProperties command.
+ $1_CMDLINE := $$(subst _SPACE_, $(SPACE), \
+ $$(join $$(addprefix -compile_SPACE_, $$($1_SRCS)), \
+ $$(addsuffix _SPACE_$$($1_CLASS), \
+ $$(addprefix _SPACE_, $$($1_JAVAS)))))
+
+ $1_TARGET := $(JDK_OUTPUTDIR)/gensrc/$(MODULE)/_the.$1.done
+ $1_CMDLINE_FILE := $(JDK_OUTPUTDIR)/gensrc/$(MODULE)/_the.$1.cmdline
-ifeq ($(OPENJDK_TARGET_OS), windows)
- COMPILE_PROP_SRC_FILES += \
- $(filter %.properties, $(call CacheFind, \
- $(JDK_TOPDIR)/src/java.desktop/windows/classes/sun/awt/windows)) \
- #
-else # ! windows
- COMPILE_PROP_SRC_FILES += \
- $(filter %.properties, $(call CacheFind, \
- $(JDK_TOPDIR)/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/resources)) \
- #
-endif
+ # Now setup the rule for the generation of the resource bundles.
+ $$($1_TARGET): $$($1_SRCS) $$($1_JAVAS) $(BUILD_TOOLS_JDK)
+ $(MKDIR) -p $$(@D) $$($1_DIRS)
+ $(ECHO) Compiling $$(words $$($1_SRCS)) properties into resource bundles for $(MODULE)
+ $(RM) $$($1_CMDLINE_FILE)
+ $$(call ListPathsSafely,$1_CMDLINE,\n, >> $$($1_CMDLINE_FILE))
+ $(TOOL_COMPILEPROPERTIES) -quiet @$$($1_CMDLINE_FILE)
+ $(TOUCH) $$@
-$(eval $(call add_properties_to_compile,LIST_RESOURCE_BUNDLE, \
- $(COMPILE_PROP_SRC_FILES), ListResourceBundle))
+ $$($1_JAVAS): $$($1_SRCS)
-# sun/util/resources
-$(eval $(call add_properties_to_compile,SUN_UTIL, \
- $(filter %.properties, \
- $(call CacheFind, $(JDK_TOPDIR)/src/java.base/share/classes/sun/util/resources) \
- $(call CacheFind, $(JDK_TOPDIR)/src/jdk.localedata/share/classes/sun/util/resources)), \
- sun.util.resources.LocaleNamesBundle))
+ # Create zh_HK versions of all zh_TW files created above
+ $$(eval $$(call SetupCopy-zh_HK,$1_HK,$$(filter %_zh_TW.java, $$($1_JAVAS))))
+ # The zh_HK copy must wait for the compile properties tool to run
+ $$($1_HK): $$($1_TARGET)
+
+ $1 += $$($1_JAVAS) $$($1_TARGET) $$($1_HK)
+endef
################################################################################
-# Now setup the rule for the generation of the resource bundles.
-$(JDK_OUTPUTDIR)/gensrc/_the.compiled_properties: $(ALL_COMPILED_PROPSOURCES) $(BUILD_TOOLS_JDK)
- # Generate all output directories in advance since the build tool does not do that...
- $(MKDIR) -p $(sort $(dir $(ALL_COMPILED_PROPJAVAS)))
- $(ECHO) Compiling $(words $(ALL_COMPILED_PROPSOURCES)) properties into resource bundles
- $(call ListPathsSafely,COMPILE_PROPCMDLINE,\n, >> $(JDK_OUTPUTDIR)/gensrc/_the.cmdline)
- $(TOOL_COMPILEPROPERTIES) -quiet @$(JDK_OUTPUTDIR)/gensrc/_the.cmdline
- $(TOUCH) $@
-
-$(ALL_COMPILED_PROPJAVAS): $(JDK_OUTPUTDIR)/gensrc/_the.compiled_properties
-
-################################################################################
-# Some zh_HK resources are just copies of zh_TW
-
-define convert_tw_to_hk
- $(MKDIR) -p $(@D)
- $(CAT) $< | $(SED) -e '/class/s/_zh_TW/_zh_HK/' > $@
-endef
-
-# Some are copies of existing sources
-$(JDK_OUTPUTDIR)/gensrc/java.desktop/%_zh_HK.java: \
- $(JDK_TOPDIR)/src/java.desktop/share/classes/%_zh_TW.java
- $(call convert_tw_to_hk)
-
-$(JDK_OUTPUTDIR)/gensrc/java.base/%_zh_HK.java: \
- $(JDK_TOPDIR)/src/java.base/share/classes/%_zh_TW.java
- $(call convert_tw_to_hk)
-
-# Others are copies of sources generated by this makefile
-$(JDK_OUTPUTDIR)/gensrc/%_zh_HK.java: $(JDK_OUTPUTDIR)/gensrc/%_zh_TW.java
- $(call convert_tw_to_hk)
-
-# The existing sources
-ZH_HK_JAVA := java.desktop/sun/applet/resources/MsgAppletViewer_zh_HK.java \
- java.base/sun/misc/resources/Messages_zh_HK.java \
- java.base/sun/security/util/AuthResources_zh_HK.java \
- java.base/sun/security/util/Resources_zh_HK.java
-
-ZH_HK_JAVA_FILES := $(addprefix $(JDK_OUTPUTDIR)/gensrc/, $(ZH_HK_JAVA)) \
- $(filter-out $(JDK_OUTPUTDIR)/gensrc/jdk.localedata/sun/util/resources/zh/%, \
- $(subst _zh_TW,_zh_HK,$(filter %_zh_TW.java, $(ALL_COMPILED_PROPJAVAS))))
-
-################################################################################
-
-GENSRC_PROPERTIES := $(ALL_COMPILED_PROPJAVAS) $(ZH_HK_JAVA_FILES)