提交 e6d47311 编写于 作者: J jcoomes

Merge

要显示的变更太多。

To preserve performance only 1000 of 1000+ files are displayed.
......@@ -77,8 +77,8 @@ ifeq ($(STANDALONE),true)
OTHER_CXXFLAGS += $(ZINCLUDE)
LDDFLAGS += $(ZIPOBJS)
else
LDDFLAGS += -lz
OTHER_CXXFLAGS += -DSYSTEM_ZLIB
LDDFLAGS += $(ZLIB_LIBS)
OTHER_CXXFLAGS += $(ZLIB_CFLAGS) -DSYSTEM_ZLIB
endif
else
OTHER_CXXFLAGS += -DNO_ZLIB -DUNPACK_JNI
......
......@@ -91,7 +91,7 @@ ifeq ($(PLATFORM), macosx)
LDFLAGS += $(OUTPUTDIR)/tmp/java/jli/$(OBJDIRNAME)/static/libjli.a
ifeq ($(SYSTEM_ZLIB),true)
OTHER_LDLIBS += -lz
OTHER_LDLIBS += $(ZLIB_LIBS)
endif
endif
......@@ -125,6 +125,26 @@ ifeq ($(PLATFORM), windows)
OTHER_LDLIBS += jli.lib
endif
#
# Applications expect to be able to link against libjawt without invoking
# System.loadLibrary("jawt") first. This was the behaviour described in the
# devloper documentation of JAWT and what worked with OpenJDK6.
#
ifeq ($(PLATFORM), solaris)
ifeq ($(ARCH_DATA_MODEL), 32)
LDFLAGS += -R \$$ORIGIN/../lib/$(LIBARCH)
LDFLAGS += -R \$$ORIGIN/../jre/lib/$(LIBARCH)
else # ! ARCH_DATA_MODEL 64-bit
LDFLAGS += -R \$$ORIGIN/../../lib/$(LIBARCH)
LDFLAGS += -R \$$ORIGIN/../../jre/lib/$(LIBARCH)
endif # ARCH_DATA_MODEL
endif # PLATFORM SOLARIS
ifeq ($(PLATFORM), linux)
LDFLAGS += -Wl,-rpath -Wl,\$$ORIGIN/../lib/$(LIBARCH)
LDFLAGS += -Wl,-rpath -Wl,\$$ORIGIN/../jre/lib/$(LIBARCH)
endif # PLATFORM LINUX
#
# Launcher specific files.
#
......
......@@ -160,7 +160,7 @@ JAVAHFLAGS += -bootclasspath "$(CLASSBINDIR)$(JCE_PATH)"
# Needed for javadoc to ensure it builds documentation
# against the newly built classes
JAVADOCFLAGS += -bootclasspath $(CLASSBINDIR)
JAVADOCFLAGS += -bootclasspath "$(CLASSBINDIR)$(JCE_PATH)"
# Needed for JAVADOC and BOOT_JAVACFLAGS
NO_PROPRIETARY_API_WARNINGS = -XDignore.symbol.file=true
......
......@@ -129,6 +129,11 @@ endif
BUILD_HEADLESS = true
LIBM=-lm
# Set ZLIB_LIBS if not already set
ifeq ("$(ZLIB_LIBS)", "")
ZLIB_LIBS=-lz
endif
# GCC29_COMPILER_PATH: is the path to where the gcc 2.9 compiler is installed
# NOTE: Must end with / so that it could be empty, allowing PATH usage.
ifdef ALT_GCC29_COMPILER_PATH
......
......@@ -143,6 +143,11 @@ else
_CUPS_HEADERS_PATH=$(PACKAGE_PATH)/include
endif
# Set ZLIB_LIBS if not already set
ifeq ("$(ZLIB_LIBS)", "")
ZLIB_LIBS=-lz
endif
# Import JDK images allow for partial builds, components not built are
# imported (or copied from) these import areas when needed.
......
......@@ -140,6 +140,11 @@ BUILD_HEADLESS = true
_CUPS_HEADERS_PATH=/opt/sfw/cups/include
# Set ZLIB_LIBS if not already set
ifeq ("$(ZLIB_LIBS)", "")
ZLIB_LIBS=-lz
endif
# Import JDK images allow for partial builds, components not built are
# imported (or copied from) these import areas when needed.
......
......@@ -93,7 +93,8 @@ FILES_export = \
sun/reflect/ConstantPool.java \
sun/reflect/NativeConstructorAccessorImpl.java \
sun/reflect/NativeMethodAccessorImpl.java \
sun/reflect/Reflection.java
sun/reflect/Reflection.java \
sun/util/locale/provider/HostLocaleProviderAdapterImpl.java
EXPORTED_inner = \
java.lang.ClassLoader$$NativeLibrary
......@@ -170,7 +171,8 @@ FILES_export = \
sun/reflect/NativeMethodAccessorImpl.java \
sun/reflect/Reflection.java \
sun/security/provider/NativeSeedGenerator.java \
sun/io/Win32ErrorMode.java
sun/io/Win32ErrorMode.java \
sun/util/locale/provider/HostLocaleProviderAdapterImpl.java
EXPORTED_inner = \
java.lang.ClassLoader$$NativeLibrary
......
......@@ -78,4 +78,5 @@ FILES_c = \
AtomicLong.c \
Version.c \
VM.c \
VMSupport.c
VMSupport.c \
HostLocaleProviderAdapter_md.c
......@@ -188,7 +188,6 @@ JAVA_JAVA_java = \
java/util/IllformedLocaleException.java \
java/util/FormatterClosedException.java \
java/util/ListResourceBundle.java \
sun/util/EmptyListResourceBundle.java \
java/util/Locale.java \
sun/util/locale/BaseLocale.java \
sun/util/locale/Extension.java \
......@@ -201,9 +200,35 @@ JAVA_JAVA_java = \
sun/util/locale/ParseStatus.java \
sun/util/locale/StringTokenIterator.java \
sun/util/locale/UnicodeLocaleExtension.java \
sun/util/locale/provider/AuxLocaleProviderAdapter.java \
sun/util/locale/provider/AvailableLanguageTags.java \
sun/util/locale/provider/BreakDictionary.java \
sun/util/locale/provider/BreakIteratorProviderImpl.java \
sun/util/locale/provider/CalendarDataProviderImpl.java \
sun/util/locale/provider/CalendarDataUtility.java \
sun/util/locale/provider/CollationRules.java \
sun/util/locale/provider/CollatorProviderImpl.java \
sun/util/locale/provider/CurrencyNameProviderImpl.java \
sun/util/locale/provider/DateFormatProviderImpl.java \
sun/util/locale/provider/DateFormatSymbolsProviderImpl.java \
sun/util/locale/provider/DecimalFormatSymbolsProviderImpl.java \
sun/util/locale/provider/DictionaryBasedBreakIterator.java \
sun/util/locale/provider/HostLocaleProviderAdapter.java \
sun/util/locale/provider/HostLocaleProviderAdapterImpl.java \
sun/util/locale/provider/JRELocaleConstants.java \
sun/util/locale/provider/JRELocaleProviderAdapter.java \
sun/util/locale/provider/LocaleServiceProviderPool.java \
sun/util/locale/provider/LocaleProviderAdapter.java \
sun/util/locale/provider/LocaleDataMetaInfo.java \
sun/util/locale/provider/LocaleNameProviderImpl.java \
sun/util/locale/provider/LocaleResources.java \
sun/util/locale/provider/NumberFormatProviderImpl.java \
sun/util/locale/provider/RuleBasedBreakIterator.java \
sun/util/locale/provider/SPILocaleProviderAdapter.java \
sun/util/locale/provider/TimeZoneNameProviderImpl.java \
sun/util/locale/provider/TimeZoneNameUtility.java \
java/util/LocaleISOData.java \
sun/util/LocaleServiceProviderPool.java \
sun/util/LocaleDataMetaInfo.java \
sun/util/cldr/CLDRLocaleProviderAdapter.java \
java/util/MissingResourceException.java \
java/util/NoSuchElementException.java \
java/util/Observable.java \
......@@ -222,7 +247,6 @@ JAVA_JAVA_java = \
java/util/StringTokenizer.java \
java/util/TimeZone.java \
java/util/SimpleTimeZone.java \
sun/util/TimeZoneNameUtility.java \
sun/util/calendar/ZoneInfo.java \
sun/util/calendar/ZoneInfoFile.java \
sun/util/calendar/TzIDOldMapping.java \
......@@ -369,6 +393,7 @@ JAVA_JAVA_java = \
java/util/prefs/PreferencesFactory.java \
java/util/prefs/Base64.java \
java/util/prefs/XmlSupport.java \
java/util/spi/CalendarDataProvider.java \
java/util/spi/CurrencyNameProvider.java \
java/util/spi/LocaleNameProvider.java \
java/util/spi/LocaleServiceProvider.java \
......
......@@ -156,6 +156,11 @@ vpath %.c $(PLATFORM_SRC)/native/common
vpath %.c $(PLATFORM_SRC)/native/java/util
vpath %.c $(PLATFORM_SRC)/native/sun/security/provider
vpath %.c $(PLATFORM_SRC)/native/sun/io
ifeq ($(PLATFORM),macosx)
vpath %.c $(PLATFORM_SRC_MACOS)/native/sun/util/locale/provider
else # PLATFORM
vpath %.c $(PLATFORM_SRC)/native/sun/util/locale/provider
endif # PLATFORM
#
# Includes the fdlibm header file.
......
......@@ -68,8 +68,8 @@ NonEuro_Resources_properties := $(FILES_compiled_properties)
FILES_java := $(FILES_java_orig)
FILES_compiled_properties := $(FILES_compiled_properties_orig)
LocaleDataMetaInfo_Src=$(SHARE_SRC)/classes/sun/util/LocaleDataMetaInfo-XLocales.java.template
LocaleDataMetaInfo_Dest=$(GENSRCDIR)/sun/util/LocaleDataMetaInfo.java
LocaleDataMetaInfo_Src=$(SHARE_SRC)/classes/sun/util/locale/provider/LocaleDataMetaInfo-XLocales.java.template
LocaleDataMetaInfo_Dest=$(GENSRCDIR)/sun/util/locale/provider/LocaleDataMetaInfo.java
LOCALEGEN_SH=localegen.sh
RESOURCE_NAMES="FormatData CollationData TimeZoneNames LocaleNames CurrencyNames CalendarData"
......
#!/bin/sh
#
# Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2005, 2012, 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
......@@ -47,20 +47,29 @@ OUTPUT_FILE=$5
localelist=
getlocalelist() {
localelist=""
localelist=`$NAWK -F$1_ '{print $2}' $2 | $SORT`
localelist=`$NAWK -F$1_ '{print $2}' $2 | $SORT | $SED -e 's/_/-/g'`
}
sed_script="$SED -e \"s@^#warn .*@// -- This file was mechanically generated: Do not edit! -- //@\" "
sed_script="$SED -e \"s@^#warn .*@// -- This file was mechanically generated: Do not edit! -- //@\" "
for FILE in $RESOURCE_NAMES
# ja-JP-JP and th-TH-TH need to be manually added, as they don't have any resource files.
noneuroall=" ja-JP-JP th-TH-TH "
for FILE in $RESOURCE_NAMES
do
getlocalelist $FILE $EURO_FILES_LIST
sed_script=$sed_script"-e \"s@#"$FILE"_EuroLocales#@$localelist@g\" "
euroall=$euroall" "$localelist
getlocalelist $FILE $NONEURO_FILES_LIST
sed_script=$sed_script"-e \"s@#"$FILE"_NonEuroLocales#@$localelist@g\" "
noneuroall=$noneuroall" "$localelist
done
sed_script=$sed_script"$INPUT_FILE > $OUTPUT_FILE"
eval $sed_script
euroall=`(for LOC in $euroall; do echo $LOC;done) |$SORT -u`
noneuroall=`(for LOC in $noneuroall; do echo $LOC;done) |$SORT -u`
sed_script=$sed_script"-e \"s@#AvailableLocales_EuroLocales#@$euroall@g\" "
sed_script=$sed_script"-e \"s@#AvailableLocales_NonEuroLocales#@$noneuroall@g\" "
sed_script=$sed_script"$INPUT_FILE > $OUTPUT_FILE"
eval $sed_script
......@@ -285,6 +285,8 @@ SUNWprivate_1.1 {
# Java_sun_misc_VM_unsuspendSomeThreads; threads.c
# Java_sun_misc_VM_unsuspendThreads; threads.c
Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getPattern;
# Outcalls from libjvm done using dlsym().
VerifyClassCodes;
......
......@@ -46,6 +46,8 @@ include $(BUILDDIR)/common/Defs.gmk
ifneq ($(SYSTEM_ZLIB),true)
ZIP_SRC = $(SHARE_SRC)/native/java/util/zip/zlib-$(ZLIB_VERSION)
else # SYSTEM_ZLIB
OTHER_CFLAGS += $(ZLIB_CFLAGS)
endif #SYSTEM_ZLIB
LAUNCHER_SHARE_SRC = $(SHARE_SRC)/bin
......@@ -162,7 +164,7 @@ OTHER_INCLUDES += -I$(LAUNCHER_PLATFORM_SRC)
ifneq ($(SYSTEM_ZLIB),true)
OTHER_INCLUDES += -I$(ZIP_SRC)
else # !SYSTEM_ZLIB
LDLIBS += -lz
LDLIBS += $(ZLIB_LIBS)
endif # SYSTEM_ZLIB
#
......
......@@ -277,7 +277,6 @@ FILES_java += \
sun/nio/ch/UnixAsynchronousServerSocketChannelImpl.java \
sun/nio/ch/UnixAsynchronousSocketChannelImpl.java \
\
sun/nio/fs/GnomeFileTypeDetector.java \
sun/nio/fs/BsdFileStore.java \
sun/nio/fs/BsdFileSystem.java \
sun/nio/fs/BsdFileSystemProvider.java \
......@@ -312,7 +311,6 @@ FILES_c += \
UnixAsynchronousServerSocketChannelImpl.c \
UnixAsynchronousSocketChannelImpl.c \
\
GnomeFileTypeDetector.c \
BsdNativeDispatcher.c \
MacOSXNativeDispatcher.c \
UnixCopyFile.c \
......@@ -329,7 +327,6 @@ FILES_export += \
sun/nio/ch/UnixAsynchronousServerSocketChannelImpl.java \
sun/nio/ch/UnixAsynchronousSocketChannelImpl.java \
\
sun/nio/fs/GnomeFileTypeDetector.java \
sun/nio/fs/BsdNativeDispatcher.java \
sun/nio/fs/UnixCopyFile.java \
sun/nio/fs/UnixNativeDispatcher.java
......
......@@ -121,10 +121,6 @@ SUNWprivate_1.1 {
Java_sun_nio_fs_BsdNativeDispatcher_getfsstat;
Java_sun_nio_fs_BsdNativeDispatcher_fsstatEntry;
Java_sun_nio_fs_BsdNativeDispatcher_endfsstat;
Java_sun_nio_fs_GnomeFileTypeDetector_initializeGio;
Java_sun_nio_fs_GnomeFileTypeDetector_probeUsingGio;
Java_sun_nio_fs_GnomeFileTypeDetector_initializeGnomeVfs;
Java_sun_nio_fs_GnomeFileTypeDetector_probeUsingGnomeVfs;
Java_sun_nio_fs_UnixNativeDispatcher_init;
Java_sun_nio_fs_UnixNativeDispatcher_getcwd;
Java_sun_nio_fs_UnixNativeDispatcher_strerror;
......@@ -170,7 +166,6 @@ SUNWprivate_1.1 {
Java_sun_nio_fs_UnixNativeDispatcher_getgrgid;
Java_sun_nio_fs_UnixNativeDispatcher_getpwnam0;
Java_sun_nio_fs_UnixNativeDispatcher_getgrnam0;
Java_sun_nio_fs_UnixNativeDispatcher_getextmntent;
Java_sun_nio_fs_UnixCopyFile_transfer;
handleSocketError;
......
......@@ -143,6 +143,7 @@ SUNWprivate_1.1 {
Java_sun_nio_fs_LinuxNativeDispatcher_fsetxattr0;
Java_sun_nio_fs_LinuxNativeDispatcher_fremovexattr0;
Java_sun_nio_fs_LinuxNativeDispatcher_setmntent0;
Java_sun_nio_fs_LinuxNativeDispatcher_getmntent;
Java_sun_nio_fs_LinuxNativeDispatcher_endmntent;
Java_sun_nio_fs_UnixNativeDispatcher_init;
Java_sun_nio_fs_UnixNativeDispatcher_getcwd;
......@@ -189,7 +190,6 @@ SUNWprivate_1.1 {
Java_sun_nio_fs_UnixNativeDispatcher_getgrgid;
Java_sun_nio_fs_UnixNativeDispatcher_getpwnam0;
Java_sun_nio_fs_UnixNativeDispatcher_getgrnam0;
Java_sun_nio_fs_UnixNativeDispatcher_getextmntent;
Java_sun_nio_fs_UnixCopyFile_transfer;
handleSocketError;
......
......@@ -169,10 +169,10 @@ SUNWprivate_1.1 {
Java_sun_nio_fs_UnixNativeDispatcher_getgrgid;
Java_sun_nio_fs_UnixNativeDispatcher_getpwnam0;
Java_sun_nio_fs_UnixNativeDispatcher_getgrnam0;
Java_sun_nio_fs_UnixNativeDispatcher_getextmntent;
Java_sun_nio_fs_UnixCopyFile_transfer;
Java_sun_nio_fs_SolarisNativeDispatcher_init;
Java_sun_nio_fs_SolarisNativeDispatcher_facl;
Java_sun_nio_fs_SolarisNativeDispatcher_getextmntent;
Java_sun_nio_fs_SolarisWatchService_init;
Java_sun_nio_fs_SolarisWatchService_portCreate;
Java_sun_nio_fs_SolarisWatchService_portAssociate;
......
#
# Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 1996, 2012, 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
......@@ -27,7 +27,6 @@ FILES_java = \
java/text/Annotation.java \
java/text/AttributedCharacterIterator.java \
java/text/AttributedString.java \
java/text/BreakDictionary.java \
java/text/BreakIterator.java \
java/text/CalendarBuilder.java \
java/text/CharacterIterator.java \
......@@ -36,11 +35,9 @@ FILES_java = \
java/text/Collator.java \
java/text/CollationElementIterator.java \
java/text/CollationKey.java \
java/text/CollationRules.java \
java/text/DateFormat.java \
java/text/DateFormatSymbols.java \
java/text/DecimalFormat.java \
java/text/DictionaryBasedBreakIterator.java \
java/text/DigitList.java \
java/text/EntryPair.java \
java/text/Format.java \
......@@ -56,7 +53,6 @@ FILES_java = \
java/text/PatternEntry.java \
java/text/RBCollationTables.java \
java/text/RBTableBuilder.java \
java/text/RuleBasedBreakIterator.java \
java/text/RuleBasedCollator.java \
java/text/RuleBasedCollationKey.java \
java/text/SimpleDateFormat.java \
......@@ -107,158 +103,150 @@ FILES_java = \
sun/text/resources/BreakIteratorInfo.java \
\
sun/text/resources/CollationData.java \
sun/text/resources/CollationData_be.java \
sun/text/resources/CollationData_bg.java \
sun/text/resources/CollationData_ca.java \
sun/text/resources/CollationData_cs.java \
sun/text/resources/CollationData_da.java \
sun/text/resources/CollationData_de.java \
sun/text/resources/CollationData_el.java \
sun/text/resources/CollationData_en.java \
sun/text/resources/CollationData_es.java \
sun/text/resources/CollationData_et.java \
sun/text/resources/CollationData_fi.java \
sun/text/resources/CollationData_fr.java \
sun/text/resources/CollationData_hr.java \
sun/text/resources/CollationData_hu.java \
sun/text/resources/CollationData_is.java \
sun/text/resources/CollationData_it.java \
sun/text/resources/CollationData_lt.java \
sun/text/resources/CollationData_lv.java \
sun/text/resources/CollationData_mk.java \
sun/text/resources/CollationData_nl.java \
sun/text/resources/CollationData_no.java \
sun/text/resources/CollationData_pl.java \
sun/text/resources/CollationData_pt.java \
sun/text/resources/CollationData_ro.java \
sun/text/resources/CollationData_ru.java \
sun/text/resources/CollationData_sk.java \
sun/text/resources/CollationData_sl.java \
sun/text/resources/CollationData_sq.java \
sun/text/resources/CollationData_sr.java \
sun/text/resources/CollationData_sr_Latn.java \
sun/text/resources/CollationData_sv.java \
sun/text/resources/CollationData_tr.java \
sun/text/resources/CollationData_uk.java \
sun/text/resources/be/CollationData_be.java \
sun/text/resources/bg/CollationData_bg.java \
sun/text/resources/ca/CollationData_ca.java \
sun/text/resources/cs/CollationData_cs.java \
sun/text/resources/da/CollationData_da.java \
sun/text/resources/el/CollationData_el.java \
sun/text/resources/es/CollationData_es.java \
sun/text/resources/et/CollationData_et.java \
sun/text/resources/fi/CollationData_fi.java \
sun/text/resources/fr/CollationData_fr.java \
sun/text/resources/hr/CollationData_hr.java \
sun/text/resources/hu/CollationData_hu.java \
sun/text/resources/is/CollationData_is.java \
sun/text/resources/lt/CollationData_lt.java \
sun/text/resources/lv/CollationData_lv.java \
sun/text/resources/mk/CollationData_mk.java \
sun/text/resources/no/CollationData_no.java \
sun/text/resources/pl/CollationData_pl.java \
sun/text/resources/ro/CollationData_ro.java \
sun/text/resources/ru/CollationData_ru.java \
sun/text/resources/sk/CollationData_sk.java \
sun/text/resources/sl/CollationData_sl.java \
sun/text/resources/sq/CollationData_sq.java \
sun/text/resources/sr/CollationData_sr.java \
sun/text/resources/sr/CollationData_sr_Latn.java \
sun/text/resources/sv/CollationData_sv.java \
sun/text/resources/tr/CollationData_tr.java \
sun/text/resources/uk/CollationData_uk.java \
\
sun/text/resources/FormatData.java \
sun/text/resources/FormatData_be.java \
sun/text/resources/FormatData_be_BY.java \
sun/text/resources/FormatData_bg.java \
sun/text/resources/FormatData_bg_BG.java \
sun/text/resources/FormatData_ca.java \
sun/text/resources/FormatData_ca_ES.java \
sun/text/resources/FormatData_cs.java \
sun/text/resources/FormatData_cs_CZ.java \
sun/text/resources/FormatData_da.java \
sun/text/resources/FormatData_da_DK.java \
sun/text/resources/FormatData_de.java \
sun/text/resources/FormatData_de_AT.java \
sun/text/resources/FormatData_de_CH.java \
sun/text/resources/FormatData_de_DE.java \
sun/text/resources/FormatData_de_LU.java \
sun/text/resources/FormatData_el.java \
sun/text/resources/FormatData_el_CY.java \
sun/text/resources/FormatData_el_GR.java \
sun/text/resources/FormatData_en.java \
sun/text/resources/FormatData_en_US.java \
sun/text/resources/FormatData_en_AU.java \
sun/text/resources/FormatData_en_CA.java \
sun/text/resources/FormatData_en_GB.java \
sun/text/resources/FormatData_en_IE.java \
sun/text/resources/FormatData_en_IN.java \
sun/text/resources/FormatData_en_MT.java \
sun/text/resources/FormatData_en_NZ.java \
sun/text/resources/FormatData_en_PH.java \
sun/text/resources/FormatData_en_SG.java \
sun/text/resources/FormatData_en_ZA.java \
sun/text/resources/FormatData_es.java \
sun/text/resources/FormatData_es_BO.java \
sun/text/resources/FormatData_es_AR.java \
sun/text/resources/FormatData_es_CL.java \
sun/text/resources/FormatData_es_CO.java \
sun/text/resources/FormatData_es_CR.java \
sun/text/resources/FormatData_es_DO.java \
sun/text/resources/FormatData_es_EC.java \
sun/text/resources/FormatData_es_ES.java \
sun/text/resources/FormatData_es_GT.java \
sun/text/resources/FormatData_es_HN.java \
sun/text/resources/FormatData_es_MX.java \
sun/text/resources/FormatData_es_NI.java \
sun/text/resources/FormatData_es_PA.java \
sun/text/resources/FormatData_es_PE.java \
sun/text/resources/FormatData_es_PR.java \
sun/text/resources/FormatData_es_PY.java \
sun/text/resources/FormatData_es_SV.java \
sun/text/resources/FormatData_es_US.java \
sun/text/resources/FormatData_es_UY.java \
sun/text/resources/FormatData_es_VE.java \
sun/text/resources/FormatData_et.java \
sun/text/resources/FormatData_et_EE.java \
sun/text/resources/FormatData_fi.java \
sun/text/resources/FormatData_fi_FI.java \
sun/text/resources/FormatData_fr.java \
sun/text/resources/FormatData_fr_BE.java \
sun/text/resources/FormatData_fr_CA.java \
sun/text/resources/FormatData_fr_CH.java \
sun/text/resources/FormatData_fr_FR.java \
sun/text/resources/FormatData_fr_LU.java \
sun/text/resources/FormatData_ga.java \
sun/text/resources/FormatData_ga_IE.java \
sun/text/resources/FormatData_hr.java \
sun/text/resources/FormatData_hr_HR.java \
sun/text/resources/FormatData_hu.java \
sun/text/resources/FormatData_hu_HU.java \
sun/text/resources/FormatData_in.java \
sun/text/resources/FormatData_in_ID.java \
sun/text/resources/FormatData_is.java \
sun/text/resources/FormatData_is_IS.java \
sun/text/resources/FormatData_it.java \
sun/text/resources/FormatData_it_CH.java \
sun/text/resources/FormatData_it_IT.java \
sun/text/resources/FormatData_lt.java \
sun/text/resources/FormatData_lt_LT.java \
sun/text/resources/FormatData_lv.java \
sun/text/resources/FormatData_lv_LV.java \
sun/text/resources/FormatData_mk.java \
sun/text/resources/FormatData_mk_MK.java \
sun/text/resources/FormatData_ms.java \
sun/text/resources/FormatData_ms_MY.java \
sun/text/resources/FormatData_mt.java \
sun/text/resources/FormatData_mt_MT.java \
sun/text/resources/FormatData_nl.java \
sun/text/resources/FormatData_nl_BE.java \
sun/text/resources/FormatData_nl_NL.java \
sun/text/resources/FormatData_no.java \
sun/text/resources/FormatData_no_NO.java \
sun/text/resources/FormatData_no_NO_NY.java \
sun/text/resources/FormatData_pl.java \
sun/text/resources/FormatData_pl_PL.java \
sun/text/resources/FormatData_pt.java \
sun/text/resources/FormatData_pt_BR.java \
sun/text/resources/FormatData_pt_PT.java \
sun/text/resources/FormatData_ro.java \
sun/text/resources/FormatData_ro_RO.java \
sun/text/resources/FormatData_ru.java \
sun/text/resources/FormatData_ru_RU.java \
sun/text/resources/FormatData_sk.java \
sun/text/resources/FormatData_sk_SK.java \
sun/text/resources/FormatData_sl.java \
sun/text/resources/FormatData_sl_SI.java \
sun/text/resources/FormatData_sq.java \
sun/text/resources/FormatData_sq_AL.java \
sun/text/resources/FormatData_sr.java \
sun/text/resources/FormatData_sr_BA.java \
sun/text/resources/FormatData_sr_CS.java \
sun/text/resources/FormatData_sr_ME.java \
sun/text/resources/FormatData_sr_RS.java \
sun/text/resources/FormatData_sr_Latn.java \
sun/text/resources/FormatData_sr_Latn_BA.java \
sun/text/resources/FormatData_sr_Latn_ME.java \
sun/text/resources/FormatData_sr_Latn_RS.java \
sun/text/resources/FormatData_sv.java \
sun/text/resources/FormatData_sv_SE.java \
sun/text/resources/FormatData_tr.java \
sun/text/resources/FormatData_tr_TR.java \
sun/text/resources/FormatData_uk.java \
sun/text/resources/FormatData_uk_UA.java
sun/text/resources/be/FormatData_be.java \
sun/text/resources/be/FormatData_be_BY.java \
sun/text/resources/bg/FormatData_bg.java \
sun/text/resources/bg/FormatData_bg_BG.java \
sun/text/resources/ca/FormatData_ca.java \
sun/text/resources/ca/FormatData_ca_ES.java \
sun/text/resources/cs/FormatData_cs.java \
sun/text/resources/cs/FormatData_cs_CZ.java \
sun/text/resources/da/FormatData_da.java \
sun/text/resources/da/FormatData_da_DK.java \
sun/text/resources/de/FormatData_de.java \
sun/text/resources/de/FormatData_de_AT.java \
sun/text/resources/de/FormatData_de_CH.java \
sun/text/resources/de/FormatData_de_DE.java \
sun/text/resources/de/FormatData_de_LU.java \
sun/text/resources/el/FormatData_el.java \
sun/text/resources/el/FormatData_el_CY.java \
sun/text/resources/el/FormatData_el_GR.java \
sun/text/resources/en/FormatData_en.java \
sun/text/resources/en/FormatData_en_US.java \
sun/text/resources/en/FormatData_en_AU.java \
sun/text/resources/en/FormatData_en_CA.java \
sun/text/resources/en/FormatData_en_GB.java \
sun/text/resources/en/FormatData_en_IE.java \
sun/text/resources/en/FormatData_en_IN.java \
sun/text/resources/en/FormatData_en_MT.java \
sun/text/resources/en/FormatData_en_NZ.java \
sun/text/resources/en/FormatData_en_PH.java \
sun/text/resources/en/FormatData_en_SG.java \
sun/text/resources/en/FormatData_en_ZA.java \
sun/text/resources/es/FormatData_es.java \
sun/text/resources/es/FormatData_es_BO.java \
sun/text/resources/es/FormatData_es_AR.java \
sun/text/resources/es/FormatData_es_CL.java \
sun/text/resources/es/FormatData_es_CO.java \
sun/text/resources/es/FormatData_es_CR.java \
sun/text/resources/es/FormatData_es_DO.java \
sun/text/resources/es/FormatData_es_EC.java \
sun/text/resources/es/FormatData_es_ES.java \
sun/text/resources/es/FormatData_es_GT.java \
sun/text/resources/es/FormatData_es_HN.java \
sun/text/resources/es/FormatData_es_MX.java \
sun/text/resources/es/FormatData_es_NI.java \
sun/text/resources/es/FormatData_es_PA.java \
sun/text/resources/es/FormatData_es_PE.java \
sun/text/resources/es/FormatData_es_PR.java \
sun/text/resources/es/FormatData_es_PY.java \
sun/text/resources/es/FormatData_es_SV.java \
sun/text/resources/es/FormatData_es_US.java \
sun/text/resources/es/FormatData_es_UY.java \
sun/text/resources/es/FormatData_es_VE.java \
sun/text/resources/et/FormatData_et.java \
sun/text/resources/et/FormatData_et_EE.java \
sun/text/resources/fi/FormatData_fi.java \
sun/text/resources/fi/FormatData_fi_FI.java \
sun/text/resources/fr/FormatData_fr.java \
sun/text/resources/fr/FormatData_fr_BE.java \
sun/text/resources/fr/FormatData_fr_CA.java \
sun/text/resources/fr/FormatData_fr_CH.java \
sun/text/resources/fr/FormatData_fr_FR.java \
sun/text/resources/ga/FormatData_ga.java \
sun/text/resources/ga/FormatData_ga_IE.java \
sun/text/resources/hr/FormatData_hr.java \
sun/text/resources/hr/FormatData_hr_HR.java \
sun/text/resources/hu/FormatData_hu.java \
sun/text/resources/hu/FormatData_hu_HU.java \
sun/text/resources/in/FormatData_in.java \
sun/text/resources/in/FormatData_in_ID.java \
sun/text/resources/is/FormatData_is.java \
sun/text/resources/is/FormatData_is_IS.java \
sun/text/resources/it/FormatData_it.java \
sun/text/resources/it/FormatData_it_CH.java \
sun/text/resources/it/FormatData_it_IT.java \
sun/text/resources/lt/FormatData_lt.java \
sun/text/resources/lt/FormatData_lt_LT.java \
sun/text/resources/lv/FormatData_lv.java \
sun/text/resources/lv/FormatData_lv_LV.java \
sun/text/resources/mk/FormatData_mk.java \
sun/text/resources/mk/FormatData_mk_MK.java \
sun/text/resources/ms/FormatData_ms.java \
sun/text/resources/ms/FormatData_ms_MY.java \
sun/text/resources/mt/FormatData_mt.java \
sun/text/resources/mt/FormatData_mt_MT.java \
sun/text/resources/nl/FormatData_nl.java \
sun/text/resources/nl/FormatData_nl_BE.java \
sun/text/resources/nl/FormatData_nl_NL.java \
sun/text/resources/no/FormatData_no.java \
sun/text/resources/no/FormatData_no_NO.java \
sun/text/resources/no/FormatData_no_NO_NY.java \
sun/text/resources/pl/FormatData_pl.java \
sun/text/resources/pl/FormatData_pl_PL.java \
sun/text/resources/pt/FormatData_pt.java \
sun/text/resources/pt/FormatData_pt_BR.java \
sun/text/resources/pt/FormatData_pt_PT.java \
sun/text/resources/ro/FormatData_ro.java \
sun/text/resources/ro/FormatData_ro_RO.java \
sun/text/resources/ru/FormatData_ru.java \
sun/text/resources/ru/FormatData_ru_RU.java \
sun/text/resources/sk/FormatData_sk.java \
sun/text/resources/sk/FormatData_sk_SK.java \
sun/text/resources/sl/FormatData_sl.java \
sun/text/resources/sl/FormatData_sl_SI.java \
sun/text/resources/sq/FormatData_sq.java \
sun/text/resources/sq/FormatData_sq_AL.java \
sun/text/resources/sr/FormatData_sr.java \
sun/text/resources/sr/FormatData_sr_BA.java \
sun/text/resources/sr/FormatData_sr_CS.java \
sun/text/resources/sr/FormatData_sr_ME.java \
sun/text/resources/sr/FormatData_sr_RS.java \
sun/text/resources/sr/FormatData_sr_Latn.java \
sun/text/resources/sr/FormatData_sr_Latn_ME.java \
sun/text/resources/sv/FormatData_sv.java \
sun/text/resources/sv/FormatData_sv_SE.java \
sun/text/resources/tr/FormatData_tr.java \
sun/text/resources/tr/FormatData_tr_TR.java \
sun/text/resources/uk/FormatData_uk.java \
sun/text/resources/uk/FormatData_uk_UA.java
#
# Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2005, 2012, 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
......@@ -29,13 +29,13 @@ FILES_java = \
sun/util/resources/LocaleNamesBundle.java \
sun/util/resources/TimeZoneNamesBundle.java \
sun/util/resources/TimeZoneNames.java \
sun/util/resources/TimeZoneNames_de.java \
sun/util/resources/TimeZoneNames_en.java \
sun/util/resources/TimeZoneNames_en_CA.java \
sun/util/resources/TimeZoneNames_en_GB.java \
sun/util/resources/TimeZoneNames_en_IE.java \
sun/util/resources/TimeZoneNames_es.java \
sun/util/resources/TimeZoneNames_fr.java \
sun/util/resources/TimeZoneNames_it.java \
sun/util/resources/TimeZoneNames_pt_BR.java \
sun/util/resources/TimeZoneNames_sv.java
sun/util/resources/de/TimeZoneNames_de.java \
sun/util/resources/en/TimeZoneNames_en.java \
sun/util/resources/en/TimeZoneNames_en_CA.java \
sun/util/resources/en/TimeZoneNames_en_GB.java \
sun/util/resources/en/TimeZoneNames_en_IE.java \
sun/util/resources/es/TimeZoneNames_es.java \
sun/util/resources/fr/TimeZoneNames_fr.java \
sun/util/resources/it/TimeZoneNames_it.java \
sun/util/resources/pt/TimeZoneNames_pt_BR.java \
sun/util/resources/sv/TimeZoneNames_sv.java
此差异已折叠。
#
# Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2005, 2012, 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
......@@ -50,7 +50,7 @@ include FILES_properties.gmk
#
# Compile properties
#
COMPILED_PROPERTIES_SUPERCLASS=LocaleNamesBundle
COMPILED_PROPERTIES_SUPERCLASS=sun.util.resources.LocaleNamesBundle
#
# Include
......
......@@ -56,6 +56,10 @@ ifneq ($(PLATFORM), windows)
endif
endif
ifeq ($(SYSTEM_ZLIB),true)
OTHER_CFLAGS += $(ZLIB_CFLAGS)
endif
#
# Library to compile.
#
......@@ -90,7 +94,7 @@ endif
# Link to JVM library for JVM_Zip* functions
#
ifeq ($(SYSTEM_ZLIB),true)
OTHER_LDLIBS = -lz
OTHER_LDLIBS = $(ZLIB_LIBS)
else
OTHER_LDLIBS = $(JVMLIB)
endif
......
......@@ -378,3 +378,22 @@ if [ "${ZERO_BUILD}" = true ] ; then
export LLVM_LIBS
fi
fi
# Export variables for system zlib
# ZLIB_CFLAGS and ZLIB_LIBS tell the compiler how to compile and
# link against zlib
pkgconfig=$(which pkg-config 2>/dev/null)
if [ -x "${pkgconfig}" ] ; then
if [ "${ZLIB_CFLAGS}" = "" ] ; then
ZLIB_CFLAGS=$("${pkgconfig}" --cflags zlib)
fi
if [ "${ZLIB_LIBS}" = "" ] ; then
ZLIB_LIBS=$("${pkgconfig}" --libs zlib)
fi
fi
if [ "${ZLIB_LIBS}" = "" ] ; then
ZLIB_LIBS="-lz"
fi
export ZLIB_CFLAGS
export ZLIB_LIBS
......@@ -76,7 +76,7 @@ else
endif
# nio need to be compiled before awt to have all charsets ready
SUBDIRS = jar security javazic misc net nio text util launcher
SUBDIRS = jar security javazic misc net nio text util launcher cldr
ifdef BUILD_HEADLESS_ONLY
DISPLAY_LIBS = awt $(HEADLESS_SUBDIR)
......@@ -87,7 +87,7 @@ else
endif
SUBDIRS_desktop = audio $(RENDER_SUBDIR) image \
$(LWAWT_PRE_SUBDIR) $(DISPLAY_LIBS) $(DGA_SUBDIR) $(LWAWT_SUBDIR) \
jawt font jpeg cmm $(DISPLAY_TOOLS) beans
jawt font jpeg cmm $(DISPLAY_TOOLS)
SUBDIRS_management = management
SUBDIRS_misc = $(ORG_SUBDIR) rmi $(JDBC_SUBDIR) tracing
SUBDIRS_tools = native2ascii serialver tools jconsole
......
#
# Copyright (c) 1997, 2005, 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.
#
#
# Makefile for building sun.beans.*
#
BUILDDIR = ../..
PACKAGE = sun.beans
PRODUCT = sun
include $(BUILDDIR)/common/Defs.gmk
#
# Files
#
AUTO_FILES_JAVA_DIRS = sun/beans
#
# Rules
#
include $(BUILDDIR)/common/Classes.gmk
#
# Copyright (c) 2012, 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.
#
#
# Makefile for CLDR locale data.
#
BUILDDIR = ../..
PACKAGE = sun.text.resources.cldr
PRODUCT = sun
JAVAC_MAX_WARNINGS = true
JAVAC_WARNINGS_FATAL = true
include $(BUILDDIR)/common/Defs.gmk
# Re-direct classes to another location (we are building cldrdata.jar)
CLASSDESTDIR = $(TEMPDIR)/classes
CLDRVERSION = 21.0.1
CLDRSRCDIR = $(SHARE_SRC)/classes/sun/util/cldr/resources/$(subst .,_,$(CLDRVERSION))
CLDRDATA_JAR = $(EXTDIR)/cldrdata.jar
CLDRCONVERTER_JAR = $(BUILDTOOLJARDIR)/cldrconverter.jar
#
# Files
#
CLDRGENSRCDIR = $(GENSRCDIR)/sun/text/resources/cldr \
$(GENSRCDIR)/sun/util/cldr \
$(GENSRCDIR)/sun/util/resources/cldr
MANIFEST_FILE = $(TEMPDIR)/manifest.mf
#
# Rules
#
include $(BUILDDIR)/common/Classes.gmk
gensrc: $(GENSRCDIR)/sun/util/cldr/CLDRLocaleDataMetaInfo.java
$(GENSRCDIR)/sun/util/cldr/CLDRLocaleDataMetaInfo.java: \
$(wildcard $(CLDRSRCDIR)/common/dtd/*.dtd) \
$(wildcard $(CLDRSRCDIR)/common/main/*.xml) \
$(wildcard $(CLDRSRCDIR)/common/supplemental/*.xml)
$(prep-target)
@$(BOOT_JAVA_CMD) -jar $(CLDRCONVERTER_JAR) \
-base $(CLDRSRCDIR) \
-o $(GENSRCDIR)
@$(java-vm-cleanup)
$(CLDRDATA_JAR): $(EXTDIR) $(GENSRCDIR)/sun/util/cldr/CLDRLocaleDataMetaInfo.java $(MANIFEST_FILE)
$(prep-target)
$(MKDIR) -p $(CLASSDESTDIR)
$(shell \
for dir in $(GENSRCDIR); do \
if [ -d $$dir ] ; then \
( $(CD) $$dir; \
for sdir in $(CLDRGENSRCDIR); do \
if [ -d $$sdir ] ; then \
$(FIND) $$sdir \
-name '*.java' -print >> $(JAVA_SOURCE_LIST) ; \
fi ; \
done \
); \
fi; \
done \
)
$(JAVAC_CMD) -sourcepath "$(SOURCEPATH)" -d $(CLASSDESTDIR) @$(JAVA_SOURCE_LIST)
$(BOOT_JAR_CMD) -cmf $(MANIFEST_FILE) $@ -C $(CLASSDESTDIR) sun \
$(BOOT_JAR_JFLAGS)
@$(java-vm-cleanup)
$(MANIFEST_FILE):
@$(prep-target)
$(ECHO) "CLDR-Version: $(CLDRVERSION)" > $@
build: gensrc $(CLDRDATA_JAR)
clean clobber::
$(RM) -r $(CLASSDESTDIR)
$(RM) -r $(GENSRCDIR)/sun/text/resources/cldr
$(RM) -r $(GENSRCDIR)/sun/util/cldr
$(RM) -r $(GENSRCDIR)/sun/util/resources/cldr
$(RM) $(MANIFEST_FILE)
$(RM) $(CLDRDATA_JAR)
.PHONY: gensrc
......@@ -30,6 +30,13 @@ PRODUCT = sun
include $(BUILDDIR)/common/Defs.gmk
#
# libjawt links to other programs, but nothing links to it directly. An RPATH
# entry has been added to the launcher so third-party programs linked against
# it will be able to find it no matter where the JDK or the third-party program
# is located.
#
#
# Files
#
......
......@@ -126,7 +126,8 @@ CPPFLAGS += -I$(SHARE_SRC)/native/$(PKGDIR)/image/jpeg
ifneq ($(SYSTEM_ZLIB),true)
CPPFLAGS += -I$(SHARE_SRC)/native/java/util/zip/zlib-$(ZLIB_VERSION)
else
OTHER_LDLIBS += -lz
OTHER_CFLAGS += $(ZLIB_CFLAGS)
OTHER_LDLIBS += $(ZLIB_LIBS)
endif
# Shun the less than portable MMX assembly code in pnggccrd.c,
......
#
# Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 1997, 2012, 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
......@@ -33,63 +33,47 @@
#
FILES_java = \
sun/text/resources/BreakIteratorInfo_th.java \
sun/text/resources/th/BreakIteratorInfo_th.java \
\
sun/text/resources/CollationData_ar.java \
sun/text/resources/CollationData_hi.java \
sun/text/resources/CollationData_iw.java \
sun/text/resources/CollationData_ja.java \
sun/text/resources/CollationData_ko.java \
sun/text/resources/CollationData_th.java \
sun/text/resources/CollationData_vi.java \
sun/text/resources/CollationData_zh.java \
sun/text/resources/CollationData_zh_HK.java \
sun/text/resources/CollationData_zh_TW.java \
sun/text/resources/ar/CollationData_ar.java \
sun/text/resources/hi/CollationData_hi.java \
sun/text/resources/iw/CollationData_iw.java \
sun/text/resources/ja/CollationData_ja.java \
sun/text/resources/ko/CollationData_ko.java \
sun/text/resources/th/CollationData_th.java \
sun/text/resources/vi/CollationData_vi.java \
sun/text/resources/zh/CollationData_zh.java \
sun/text/resources/zh/CollationData_zh_HK.java \
sun/text/resources/zh/CollationData_zh_TW.java \
\
sun/text/resources/FormatData_ar.java \
sun/text/resources/FormatData_ar_AE.java \
sun/text/resources/FormatData_ar_BH.java \
sun/text/resources/FormatData_ar_DZ.java \
sun/text/resources/FormatData_ar_EG.java \
sun/text/resources/FormatData_ar_IQ.java \
sun/text/resources/FormatData_ar_JO.java \
sun/text/resources/FormatData_ar_KW.java \
sun/text/resources/FormatData_ar_LB.java \
sun/text/resources/FormatData_ar_LY.java \
sun/text/resources/FormatData_ar_MA.java \
sun/text/resources/FormatData_ar_OM.java \
sun/text/resources/FormatData_ar_QA.java \
sun/text/resources/FormatData_ar_SA.java \
sun/text/resources/FormatData_ar_SD.java \
sun/text/resources/FormatData_ar_SY.java \
sun/text/resources/FormatData_ar_TN.java \
sun/text/resources/FormatData_ar_YE.java \
sun/text/resources/FormatData_hi_IN.java \
sun/text/resources/FormatData_iw.java \
sun/text/resources/FormatData_iw_IL.java \
sun/text/resources/FormatData_ja.java \
sun/text/resources/FormatData_ja_JP.java \
sun/text/resources/FormatData_ja_JP_JP.java \
sun/text/resources/FormatData_ko.java \
sun/text/resources/FormatData_ko_KR.java \
sun/text/resources/FormatData_th.java \
sun/text/resources/FormatData_th_TH.java \
sun/text/resources/FormatData_th_TH_TH.java \
sun/text/resources/FormatData_vi.java \
sun/text/resources/FormatData_vi_VN.java \
sun/text/resources/FormatData_zh.java \
sun/text/resources/FormatData_zh_CN.java \
sun/text/resources/FormatData_zh_HK.java \
sun/text/resources/FormatData_zh_SG.java \
sun/text/resources/FormatData_zh_TW.java \
sun/text/resources/ar/FormatData_ar.java \
sun/text/resources/ar/FormatData_ar_JO.java \
sun/text/resources/ar/FormatData_ar_LB.java \
sun/text/resources/ar/FormatData_ar_SY.java \
sun/text/resources/hi/FormatData_hi_IN.java \
sun/text/resources/iw/FormatData_iw.java \
sun/text/resources/iw/FormatData_iw_IL.java \
sun/text/resources/ja/FormatData_ja.java \
sun/text/resources/ja/FormatData_ja_JP.java \
sun/text/resources/ko/FormatData_ko.java \
sun/text/resources/ko/FormatData_ko_KR.java \
sun/text/resources/th/FormatData_th.java \
sun/text/resources/th/FormatData_th_TH.java \
sun/text/resources/vi/FormatData_vi.java \
sun/text/resources/vi/FormatData_vi_VN.java \
sun/text/resources/zh/FormatData_zh.java \
sun/text/resources/zh/FormatData_zh_CN.java \
sun/text/resources/zh/FormatData_zh_HK.java \
sun/text/resources/zh/FormatData_zh_SG.java \
sun/text/resources/zh/FormatData_zh_TW.java \
\
sun/util/resources/CurrencyNames_zh_HK.java \
sun/util/resources/CurrencyNames_zh_SG.java \
sun/util/resources/LocaleNames_zh_HK.java \
sun/util/resources/TimeZoneNames_hi.java \
sun/util/resources/TimeZoneNames_ja.java \
sun/util/resources/TimeZoneNames_ko.java \
sun/util/resources/TimeZoneNames_zh_CN.java \
sun/util/resources/TimeZoneNames_zh_TW.java \
sun/util/resources/TimeZoneNames_zh_HK.java
sun/util/resources/zh/CurrencyNames_zh_HK.java \
sun/util/resources/zh/CurrencyNames_zh_SG.java \
sun/util/resources/zh/LocaleNames_zh_HK.java \
sun/util/resources/hi/TimeZoneNames_hi.java \
sun/util/resources/ja/TimeZoneNames_ja.java \
sun/util/resources/ko/TimeZoneNames_ko.java \
sun/util/resources/zh/TimeZoneNames_zh_CN.java \
sun/util/resources/zh/TimeZoneNames_zh_TW.java \
sun/util/resources/zh/TimeZoneNames_zh_HK.java
#
# Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2005, 2012, 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
......@@ -24,50 +24,50 @@
#
FILES_compiled_properties = \
sun/util/resources/LocaleNames_ar.properties \
sun/util/resources/LocaleNames_hi.properties \
sun/util/resources/LocaleNames_iw.properties \
sun/util/resources/LocaleNames_ja.properties \
sun/util/resources/LocaleNames_ko.properties \
sun/util/resources/LocaleNames_th.properties \
sun/util/resources/LocaleNames_vi.properties \
sun/util/resources/LocaleNames_zh.properties \
sun/util/resources/LocaleNames_zh_SG.properties \
sun/util/resources/LocaleNames_zh_TW.properties \
sun/util/resources/ar/LocaleNames_ar.properties \
sun/util/resources/hi/LocaleNames_hi.properties \
sun/util/resources/iw/LocaleNames_iw.properties \
sun/util/resources/ja/LocaleNames_ja.properties \
sun/util/resources/ko/LocaleNames_ko.properties \
sun/util/resources/th/LocaleNames_th.properties \
sun/util/resources/vi/LocaleNames_vi.properties \
sun/util/resources/zh/LocaleNames_zh.properties \
sun/util/resources/zh/LocaleNames_zh_SG.properties \
sun/util/resources/zh/LocaleNames_zh_TW.properties \
\
sun/util/resources/CalendarData_ar.properties \
sun/util/resources/CalendarData_hi.properties \
sun/util/resources/CalendarData_iw.properties \
sun/util/resources/CalendarData_ja.properties \
sun/util/resources/CalendarData_ko.properties \
sun/util/resources/CalendarData_th.properties \
sun/util/resources/CalendarData_vi.properties \
sun/util/resources/CalendarData_zh.properties \
sun/util/resources/ar/CalendarData_ar.properties \
sun/util/resources/hi/CalendarData_hi.properties \
sun/util/resources/iw/CalendarData_iw.properties \
sun/util/resources/ja/CalendarData_ja.properties \
sun/util/resources/ko/CalendarData_ko.properties \
sun/util/resources/th/CalendarData_th.properties \
sun/util/resources/vi/CalendarData_vi.properties \
sun/util/resources/zh/CalendarData_zh.properties \
\
sun/util/resources/CurrencyNames_ar_AE.properties \
sun/util/resources/CurrencyNames_ar_BH.properties \
sun/util/resources/CurrencyNames_ar_DZ.properties \
sun/util/resources/CurrencyNames_ar_EG.properties \
sun/util/resources/CurrencyNames_ar_IQ.properties \
sun/util/resources/CurrencyNames_ar_JO.properties \
sun/util/resources/CurrencyNames_ar_KW.properties \
sun/util/resources/CurrencyNames_ar_LB.properties \
sun/util/resources/CurrencyNames_ar_LY.properties \
sun/util/resources/CurrencyNames_ar_MA.properties \
sun/util/resources/CurrencyNames_ar_OM.properties \
sun/util/resources/CurrencyNames_ar_QA.properties \
sun/util/resources/CurrencyNames_ar_SA.properties \
sun/util/resources/CurrencyNames_ar_SD.properties \
sun/util/resources/CurrencyNames_ar_SY.properties \
sun/util/resources/CurrencyNames_ar_TN.properties \
sun/util/resources/CurrencyNames_ar_YE.properties \
sun/util/resources/CurrencyNames_hi_IN.properties \
sun/util/resources/CurrencyNames_iw_IL.properties \
sun/util/resources/CurrencyNames_ja.properties \
sun/util/resources/CurrencyNames_ja_JP.properties \
sun/util/resources/CurrencyNames_ko.properties \
sun/util/resources/CurrencyNames_ko_KR.properties \
sun/util/resources/CurrencyNames_th_TH.properties \
sun/util/resources/CurrencyNames_vi_VN.properties \
sun/util/resources/CurrencyNames_zh_CN.properties \
sun/util/resources/CurrencyNames_zh_TW.properties
sun/util/resources/ar/CurrencyNames_ar_AE.properties \
sun/util/resources/ar/CurrencyNames_ar_BH.properties \
sun/util/resources/ar/CurrencyNames_ar_DZ.properties \
sun/util/resources/ar/CurrencyNames_ar_EG.properties \
sun/util/resources/ar/CurrencyNames_ar_IQ.properties \
sun/util/resources/ar/CurrencyNames_ar_JO.properties \
sun/util/resources/ar/CurrencyNames_ar_KW.properties \
sun/util/resources/ar/CurrencyNames_ar_LB.properties \
sun/util/resources/ar/CurrencyNames_ar_LY.properties \
sun/util/resources/ar/CurrencyNames_ar_MA.properties \
sun/util/resources/ar/CurrencyNames_ar_OM.properties \
sun/util/resources/ar/CurrencyNames_ar_QA.properties \
sun/util/resources/ar/CurrencyNames_ar_SA.properties \
sun/util/resources/ar/CurrencyNames_ar_SD.properties \
sun/util/resources/ar/CurrencyNames_ar_SY.properties \
sun/util/resources/ar/CurrencyNames_ar_TN.properties \
sun/util/resources/ar/CurrencyNames_ar_YE.properties \
sun/util/resources/hi/CurrencyNames_hi_IN.properties \
sun/util/resources/iw/CurrencyNames_iw_IL.properties \
sun/util/resources/ja/CurrencyNames_ja.properties \
sun/util/resources/ja/CurrencyNames_ja_JP.properties \
sun/util/resources/ko/CurrencyNames_ko.properties \
sun/util/resources/ko/CurrencyNames_ko_KR.properties \
sun/util/resources/th/CurrencyNames_th_TH.properties \
sun/util/resources/vi/CurrencyNames_vi_VN.properties \
sun/util/resources/zh/CurrencyNames_zh_CN.properties \
sun/util/resources/zh/CurrencyNames_zh_TW.properties
#
# Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2001, 2012, 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
......@@ -48,7 +48,7 @@ include FILES_properties.gmk
#
# Compile the properties files
#
COMPILED_PROPERTIES_SUPERCLASS=LocaleNamesBundle
COMPILED_PROPERTIES_SUPERCLASS=sun.util.resources.LocaleNamesBundle
#
# Rules
......@@ -68,13 +68,13 @@ TEXT_CLASSES = $(BUILDTOOLCLASSDIR)/sun.text/classes
#
TEXT_SRCDIR = $(SHARE_SRC)/classes/sun/text/resources
BIRULES = $(TEXT_SRCDIR)/BreakIteratorRules.java \
$(TEXT_SRCDIR)/BreakIteratorRules_th.java
BIINFO = $(TEXT_SRCDIR)/BreakIteratorInfo_th.java
$(TEXT_SRCDIR)/th/BreakIteratorRules_th.java
BIINFO = $(TEXT_SRCDIR)/th/BreakIteratorInfo_th.java
UNICODEDATA = $(BUILDDIR)/tools/UnicodeData
# output
BIFILES = $(CLASSDESTDIR)/sun/text/resources/WordBreakIteratorData_th \
$(CLASSDESTDIR)/sun/text/resources/LineBreakIteratorData_th
BIFILES = $(CLASSDESTDIR)/sun/text/resources/th/WordBreakIteratorData_th \
$(CLASSDESTDIR)/sun/text/resources/th/LineBreakIteratorData_th
# builder
GENERATEBREAKITERATORDATA_JARFILE = \
......@@ -106,7 +106,7 @@ clean::
#
LOCALEDATA_JAR = $(EXTDIR)/localedata.jar
SPECIALFILES = $(CLASSDESTDIR)/sun/text/resources/thai_dict
SPECIALFILES = $(CLASSDESTDIR)/sun/text/resources/th/thai_dict
$(CLASSDESTDIR)/sun/text/resources/% : $(TEXT_SRCDIR)/%
$(install-file)
......
......@@ -36,6 +36,7 @@ include $(BUILDDIR)/common/Defs.gmk
SUBDIRS = \
addjsum \
buildmetaindex \
cldrconverter \
commentchecker \
compile_font_config \
compile_properties \
......
#
# Copyright (c) 2012, 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.
#
#
# Makefile for building the CLDRConverter tool
#
BUILDDIR = ../..
PACKAGE = build.tools.cldrconverter
PRODUCT = cldrconverter
PROGRAM = cldrconverter
include $(BUILDDIR)/common/Defs.gmk
BUILDTOOL_SOURCE_ROOT = $(BUILDDIR)/tools/src
BUILDTOOL_MAIN = $(PKGDIR)/CLDRConverter.java
#
# Build tool jar rules.
#
include $(BUILDDIR)/common/BuildToolJar.gmk
/*
* Copyright (c) 2012, 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.
*/
package build.tools.cldrconverter;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import org.xml.sax.helpers.DefaultHandler;
/**
* This is an abstract class for general LDML parsing purpose.
* LDMLParseHandler, SupplementLDMLParseHandler, and NumberingLDMLParseHandler
* are the subclasses of this class.
*/
abstract class AbstractLDMLHandler<V> extends DefaultHandler {
static final Map<String, String> DAY_OF_WEEK_MAP = new HashMap<>();
static {
DAY_OF_WEEK_MAP.put("sun", "1");
DAY_OF_WEEK_MAP.put("mon", "2");
DAY_OF_WEEK_MAP.put("tue", "3");
DAY_OF_WEEK_MAP.put("wed", "4");
DAY_OF_WEEK_MAP.put("thu", "5");
DAY_OF_WEEK_MAP.put("fri", "6");
DAY_OF_WEEK_MAP.put("sat", "7");
}
// Collected data in JRE locale data format.
private Map<String, V> data = new HashMap<>();
// The root Container
Container currentContainer = new Container("$ROOT", null);
AbstractLDMLHandler() {
}
Map<String, V> getData() {
return data;
}
V put(String key, V value) {
return data.put(key, value);
}
V get(String key) {
return data.get(key);
}
Set<String> keySet() {
return data.keySet();
}
/*
* It returns true if the data should be ignored based on the user
* defined acceptance level, which is listed with draft attribute in
* the cldr locale xml files.
* When the alt attribute is present, the data is always ignored since
* we always use the primary data
*/
boolean isIgnored(Attributes attributes) {
if (attributes.getValue("alt") != null) {
return true;
}
String draftValue = attributes.getValue("draft");
if (draftValue != null) {
return CLDRConverter.draftType > CLDRConverter.DRAFT_MAP.get(draftValue);
}
return false;
}
void pushContainer(String qName, Attributes attributes) {
if (isIgnored(attributes) || currentContainer instanceof IgnoredContainer) {
currentContainer = new IgnoredContainer(qName, currentContainer);
} else {
currentContainer = new Container(qName, currentContainer);
}
}
void pushIgnoredContainer(String qName) {
currentContainer = new IgnoredContainer(qName, currentContainer);
}
void pushKeyContainer(String qName, Attributes attributes, String key) {
if (!pushIfIgnored(qName, attributes)) {
currentContainer = new KeyContainer(qName, currentContainer, key);
}
}
/**
* start an element that defines a string entry, with the value provided by the element's text.
*/
void pushStringEntry(String qName, Attributes attributes, String key) {
if (!pushIfIgnored(qName, attributes)) {
currentContainer = new StringEntry(qName, currentContainer, key);
}
}
/**
* start an element that defines a string entry, with the value provided by an attribute value.
*/
void pushStringEntry(String qName, Attributes attributes, String key, String value) {
if (!pushIfIgnored(qName, attributes)) {
currentContainer = new StringEntry(qName, currentContainer, key, value);
}
}
void pushStringArrayEntry(String qName, Attributes attributes, String key, int length) {
if (!pushIfIgnored(qName, attributes)) {
currentContainer = new StringArrayEntry(qName, currentContainer, key, length);
}
}
void pushStringArrayElement(String qName, Attributes attributes, int index) {
if (!pushIfIgnored(qName, attributes)) {
currentContainer = new StringArrayElement(qName, currentContainer, index);
}
}
private boolean pushIfIgnored(String qName, Attributes attributes) {
if (isIgnored(attributes) || currentContainer instanceof IgnoredContainer) {
pushIgnoredContainer(qName);
return true;
}
return false;
}
/**
* Obtains the key from the innermost containing container that provides one.
*/
String getContainerKey() {
Container current = currentContainer;
while (current != null) {
if (current instanceof KeyContainer) {
return ((KeyContainer) current).getKey();
}
current = current.getParent();
}
return null;
}
@Override
public void characters(char[] ch, int start, int length) throws SAXException {
currentContainer.addCharacters(ch, start, length);
}
@SuppressWarnings(value = "CallToThreadDumpStack")
@Override
public void warning(SAXParseException e) throws SAXException {
e.printStackTrace();
}
@SuppressWarnings(value = "CallToThreadDumpStack")
@Override
public void error(SAXParseException e) throws SAXException {
e.printStackTrace();
}
@SuppressWarnings(value = "CallToThreadDumpStack")
@Override
public void fatalError(SAXParseException e) throws SAXException {
e.printStackTrace();
super.fatalError(e);
}
}
/*
* Copyright (c) 2012, 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.
*/
package build.tools.cldrconverter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
class Bundle {
static enum Type {
LOCALENAMES, CURRENCYNAMES, TIMEZONENAMES, CALENDARDATA, FORMATDATA;
static EnumSet<Type> ALL_TYPES = EnumSet.of(LOCALENAMES,
CURRENCYNAMES,
TIMEZONENAMES,
CALENDARDATA,
FORMATDATA);
}
private final static Map<String, Bundle> bundles = new HashMap<>();
private final static String[] NUMBER_PATTERN_KEYS = {
"NumberPatterns/decimal",
"NumberPatterns/currency",
"NumberPatterns/percent"
};
private final static String[] NUMBER_ELEMENT_KEYS = {
"NumberElements/decimal",
"NumberElements/group",
"NumberElements/list",
"NumberElements/percent",
"NumberElements/zero",
"NumberElements/pattern",
"NumberElements/minus",
"NumberElements/exponential",
"NumberElements/permille",
"NumberElements/infinity",
"NumberElements/nan"
};
private final static String[] TIME_PATTERN_KEYS = {
"DateTimePatterns/full-time",
"DateTimePatterns/long-time",
"DateTimePatterns/medium-time",
"DateTimePatterns/short-time",
};
private final static String[] DATE_PATTERN_KEYS = {
"DateTimePatterns/full-date",
"DateTimePatterns/long-date",
"DateTimePatterns/medium-date",
"DateTimePatterns/short-date",
};
private final static String[] DATETIME_PATTERN_KEYS = {
"DateTimePatterns/date-time"
};
private final static String[] ERA_KEYS = {
"long.Eras",
"Eras",
"short.Eras"
};
private final String id;
private final String cldrPath;
private final EnumSet<Type> bundleTypes;
private final String currencies;
static Bundle getBundle(String id) {
return bundles.get(id);
}
Bundle(String id, String cldrPath, String bundles, String currencies) {
this.id = id;
this.cldrPath = cldrPath;
if ("localenames".equals(bundles)) {
bundleTypes = EnumSet.of(Type.LOCALENAMES);
} else if ("currencynames".equals(bundles)) {
bundleTypes = EnumSet.of(Type.CURRENCYNAMES);
} else {
bundleTypes = Type.ALL_TYPES;
}
if (currencies == null) {
currencies = "local";
}
this.currencies = currencies;
addBundle();
}
private void addBundle() {
Bundle.bundles.put(id, this);
}
String getID() {
return id;
}
boolean isRoot() {
return "root".equals(id);
}
String getCLDRPath() {
return cldrPath;
}
EnumSet<Type> getBundleTypes() {
return bundleTypes;
}
String getCurrencies() {
return currencies;
}
/**
* Generate a map that contains all the data that should be
* visible for the bundle's locale
*/
Map<String, Object> getTargetMap() throws Exception {
String[] cldrBundles = getCLDRPath().split(",");
// myMap contains resources for id.
Map<String, Object> myMap = new HashMap<>();
int index;
for (index = 0; index < cldrBundles.length; index++) {
if (cldrBundles[index].equals(id)) {
myMap.putAll(CLDRConverter.getCLDRBundle(cldrBundles[index]));
break;
}
}
// parentsMap contains resources from id's parents.
Map<String, Object> parentsMap = new HashMap<>();
for (int i = cldrBundles.length - 1; i > index; i--) {
if (!("no".equals(cldrBundles[i]) || cldrBundles[i].startsWith("no_"))) {
parentsMap.putAll(CLDRConverter.getCLDRBundle(cldrBundles[i]));
}
}
// Duplicate myMap as parentsMap for "root" so that the
// fallback works. This is a huck, though.
if ("root".equals(cldrBundles[0])) {
assert parentsMap.isEmpty();
parentsMap.putAll(myMap);
}
// merge individual strings into arrays
// if myMap has any of the NumberPatterns members
for (String k : NUMBER_PATTERN_KEYS) {
if (myMap.containsKey(k)) {
String[] numberPatterns = new String[NUMBER_PATTERN_KEYS.length];
for (int i = 0; i < NUMBER_PATTERN_KEYS.length; i++) {
String key = NUMBER_PATTERN_KEYS[i];
String value = (String) myMap.remove(key);
if (value == null) {
value = (String) parentsMap.remove(key);
}
if (value.length() == 0) {
CLDRConverter.warning("empty pattern for " + key);
}
numberPatterns[i] = value;
}
myMap.put("NumberPatterns", numberPatterns);
break;
}
}
// if myMap has any of NUMBER_ELEMENT_KEYS, create a complete NumberElements.
String defaultScript = (String) myMap.get("DefaultNumberingSystem");
@SuppressWarnings("unchecked")
List<String> scripts = (List<String>) myMap.get("numberingScripts");
if (defaultScript == null && scripts != null) {
// Some locale data has no default script for numbering even with mutiple scripts.
// Take the first one as default in that case.
defaultScript = scripts.get(0);
myMap.put("DefaultNumberingSystem", defaultScript);
}
if (scripts != null) {
for (String script : scripts) {
for (String k : NUMBER_ELEMENT_KEYS) {
String[] numberElements = new String[NUMBER_ELEMENT_KEYS.length];
for (int i = 0; i < NUMBER_ELEMENT_KEYS.length; i++) {
String key = script + "." + NUMBER_ELEMENT_KEYS[i];
String value = (String) myMap.remove(key);
if (value == null) {
if (key.endsWith("/pattern")) {
value = "#";
} else {
value = (String) parentsMap.get(key);
if (value == null) {
// the last resort is "latn"
key = "latn." + NUMBER_ELEMENT_KEYS[i];
value = (String) parentsMap.get(key);
if (value == null) {
throw new InternalError("NumberElements: null for " + key);
}
}
}
}
numberElements[i] = value;
}
myMap.put(script + "." + "NumberElements", numberElements);
break;
}
}
}
// another hack: parentsMap is not used for date-time resources.
if ("root".equals(id)) {
parentsMap = null;
}
for (CalendarType calendarType : CalendarType.values()) {
String calendarPrefix = calendarType.keyElementName();
// handle multiple inheritance for month and day names
handleMultipleInheritance(myMap, parentsMap, calendarPrefix + "MonthNames");
handleMultipleInheritance(myMap, parentsMap, calendarPrefix + "MonthAbbreviations");
handleMultipleInheritance(myMap, parentsMap, calendarPrefix + "DayNames");
handleMultipleInheritance(myMap, parentsMap, calendarPrefix + "DayAbbreviations");
handleMultipleInheritance(myMap, parentsMap, calendarPrefix + "AmPmMarkers");
adjustEraNames(myMap, calendarType);
handleDateTimeFormatPatterns(TIME_PATTERN_KEYS, myMap, parentsMap, calendarType, "TimePatterns");
handleDateTimeFormatPatterns(DATE_PATTERN_KEYS, myMap, parentsMap, calendarType, "DatePatterns");
handleDateTimeFormatPatterns(DATETIME_PATTERN_KEYS, myMap, parentsMap, calendarType, "DateTimePatterns");
}
return myMap;
}
private void handleMultipleInheritance(Map<String, Object> map, Map<String, Object> parents, String key) {
String formatKey = key + "/format";
Object format = map.get(formatKey);
if (format != null) {
map.remove(formatKey);
map.put(key, format);
if (fillInElements(parents, formatKey, format)) {
map.remove(key);
}
}
String standaloneKey = key + "/stand-alone";
Object standalone = map.get(standaloneKey);
if (standalone != null) {
map.remove(standaloneKey);
String realKey = key;
if (format != null) {
realKey = "standalone." + key;
}
map.put(realKey, standalone);
if (fillInElements(parents, standaloneKey, standalone)) {
map.remove(realKey);
}
}
}
/**
* Fills in any empty elements with its parent element. Returns true if the resulting array is
* identical to its parent array.
*
* @param parents
* @param key
* @param value
* @return true if the resulting array is identical to its parent array.
*/
private boolean fillInElements(Map<String, Object> parents, String key, Object value) {
if (parents == null) {
return false;
}
if (value instanceof String[]) {
Object pvalue = parents.get(key);
if (pvalue != null && pvalue instanceof String[]) {
String[] strings = (String[]) value;
String[] pstrings = (String[]) pvalue;
for (int i = 0; i < strings.length; i++) {
if (strings[i] == null || strings[i].length() == 0) {
strings[i] = pstrings[i];
}
}
return Arrays.equals(strings, pstrings);
}
}
return false;
}
/*
* Adjusts String[] for era names because JRE's Calendars use different
* ERA value indexes in the Buddhist and Japanese Imperial calendars.
*/
private void adjustEraNames(Map<String, Object> map, CalendarType type) {
String[][] eraNames = new String[ERA_KEYS.length][];
String[] realKeys = new String[ERA_KEYS.length];
int index = 0;
for (String key : ERA_KEYS) {
String realKey = type.keyElementName() + key;
String[] value = (String[]) map.get(realKey);
if (value != null) {
switch (type) {
case GREGORIAN:
break;
case JAPANESE:
{
String[] newValue = new String[value.length + 1];
String[] julianEras = (String[]) map.get(key);
if (julianEras != null && julianEras.length >= 2) {
newValue[0] = julianEras[1];
} else {
newValue[0] = "";
}
System.arraycopy(value, 0, newValue, 1, value.length);
value = newValue;
}
break;
case BUDDHIST:
// Replace the value
value = new String[] {"BC", value[0]};
break;
}
if (!key.equals(realKey)) {
map.put(realKey, value);
}
}
realKeys[index] = realKey;
eraNames[index++] = value;
}
if (eraNames[0] != null) {
if (eraNames[1] != null) {
if (eraNames[2] == null) {
// Eras -> short.Eras
// long.Eras -> Eras
map.put(realKeys[2], map.get(realKeys[1]));
map.put(realKeys[1], map.get(realKeys[0]));
}
} else {
// long.Eras -> Eras
map.put(realKeys[1], map.get(realKeys[0]));
}
// remove long.Eras
map.remove(realKeys[0]);
}
}
private void handleDateTimeFormatPatterns(String[] patternKeys, Map<String, Object> myMap, Map<String, Object> parentsMap,
CalendarType calendarType, String name) {
String calendarPrefix = calendarType.keyElementName();
for (String k : patternKeys) {
if (myMap.containsKey(calendarPrefix + k)) {
int len = patternKeys.length;
List<String> patterns = new ArrayList<>();
for (int i = 0; i < len; i++) {
String key = calendarPrefix + patternKeys[i];
String pattern = (String) myMap.remove(key);
if (pattern == null) {
pattern = (String) parentsMap.remove(key);
}
if (pattern != null) {
patterns.add(i, translateDateFormatLetters(calendarType, pattern));
}
}
if (patterns.isEmpty()) {
return;
}
String key = calendarPrefix + name;
myMap.put(key, patterns.toArray(new String[len]));
break;
}
}
}
private String translateDateFormatLetters(CalendarType calendarType, String cldrFormat) {
String pattern = cldrFormat;
int length = pattern.length();
boolean inQuote = false;
StringBuilder jrePattern = new StringBuilder(length);
int count = 0;
char lastLetter = 0;
for (int i = 0; i < length; i++) {
char c = pattern.charAt(i);
if (c == '\'') {
// '' is treated as a single quote regardless of being
// in a quoted section.
if ((i + 1) < length) {
char nextc = pattern.charAt(i + 1);
if (nextc == '\'') {
i++;
if (count != 0) {
convert(calendarType, lastLetter, count, jrePattern);
lastLetter = 0;
count = 0;
}
jrePattern.append("''");
continue;
}
}
if (!inQuote) {
if (count != 0) {
convert(calendarType, lastLetter, count, jrePattern);
lastLetter = 0;
count = 0;
}
inQuote = true;
} else {
inQuote = false;
}
jrePattern.append(c);
continue;
}
if (inQuote) {
jrePattern.append(c);
continue;
}
if (!(c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z')) {
if (count != 0) {
convert(calendarType, lastLetter, count, jrePattern);
lastLetter = 0;
count = 0;
}
jrePattern.append(c);
continue;
}
if (lastLetter == 0 || lastLetter == c) {
lastLetter = c;
count++;
continue;
}
convert(calendarType, lastLetter, count, jrePattern);
lastLetter = c;
count = 1;
}
if (inQuote) {
throw new InternalError("Unterminated quote in date-time pattern: " + cldrFormat);
}
if (count != 0) {
convert(calendarType, lastLetter, count, jrePattern);
}
if (cldrFormat.contentEquals(jrePattern)) {
return cldrFormat;
}
return jrePattern.toString();
}
private void convert(CalendarType calendarType, char cldrLetter, int count, StringBuilder sb) {
switch (cldrLetter) {
case 'G':
if (calendarType != CalendarType.GREGORIAN) {
// Adjust the number of 'G's for JRE SimpleDateFormat
if (count == 5) {
// CLDR narrow -> JRE short
count = 1;
} else if (count == 1) {
// CLDR abbr -> JRE long
count = 4;
}
}
appendN(cldrLetter, count, sb);
break;
// TODO: support 'c' and 'e' in JRE SimpleDateFormat
// Use 'u' and 'E' for now.
case 'c':
case 'e':
switch (count) {
case 1:
sb.append('u');
break;
case 3:
case 4:
appendN('E', count, sb);
break;
case 5:
appendN('E', 3, sb);
break;
}
break;
case 'v':
case 'V':
appendN('z', count, sb);
break;
case 'Z':
if (count == 4 || count == 5) {
sb.append("XXX");
}
break;
case 'u':
case 'U':
case 'q':
case 'Q':
case 'l':
case 'g':
case 'j':
case 'A':
throw new InternalError(String.format("Unsupported letter: '%c', count=%d%n",
cldrLetter, count));
default:
appendN(cldrLetter, count, sb);
break;
}
}
private void appendN(char c, int n, StringBuilder sb) {
for (int i = 0; i < n; i++) {
sb.append(c);
}
}
}
/*
* Copyright (c) 2012, 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.
*/
package build.tools.cldrconverter;
import java.io.IOException;
import java.util.Map;
import java.util.SortedSet;
public interface BundleGenerator {
public void generateBundle(String packageName, String baseName, String localeID,
boolean useJava, Map<String, ?> map, boolean open) throws IOException;
public void generateMetaInfo(Map<String, SortedSet<String>> metaInfo) throws IOException;
}
/*
* Copyright (c) 2012, 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.
*/
package build.tools.cldrconverter;
import java.util.Locale;
/**
* Constants for the Calendars supported by JRE.
*/
enum CalendarType {
GREGORIAN, BUDDHIST, JAPANESE;
private static final int[][] ERA_DATA = {
// start index, array length
{0, 2}, // gregorian
{0, 1}, // buddhist
{232, 4}, // japanese (eras from Meiji)
};
private final String lname; // lowercase name
private CalendarType() {
lname = name().toLowerCase(Locale.ROOT);
}
String lname() {
return lname;
}
String keyElementName() {
return (this == GREGORIAN) ? "" : lname + ".";
}
int normalizeEraIndex(int index) {
index -= ERA_DATA[ordinal()][0];
if (index >= ERA_DATA[ordinal()][1]) {
index = -1;
}
return index;
}
int getEraLength(String name) {
return ERA_DATA[ordinal()][1];
}
static CalendarType forName(String name) {
for (CalendarType type : values()) {
if (type.lname.equals(name)) {
return type;
}
}
return null;
}
}
/*
* Copyright (c) 2012, 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.
*/
package build.tools.cldrconverter;
class Container {
private final String qName;
private final Container parent;
Container(String qName, Container parent) {
this.qName = qName;
this.parent = parent;
}
void addCharacters(char[] characters, int start, int length) {
if (getParent() != null) {
getParent().addCharacters(characters, start, length);
}
}
Container getParent() {
return parent;
}
/**
* @return the qName
*/
String getqName() {
return qName;
}
}
/*
* Copyright (c) 2012, 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.
*/
package build.tools.cldrconverter;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.Locale;
import java.util.TimeZone;
class CopyrightHeaders {
private static final String ORACLE2012 =
"/*\n" +
" * Copyright (c) %d, Oracle and/or its affiliates. All rights reserved.\n" +
" */\n";
private static final String ORACLE_AFTER2012 =
"/*\n" +
" * Copyright (c) 2012, %d, Oracle and/or its affiliates. All rights reserved.\n" +
" */\n";
private static final String UNICODE =
"/*\n" +
" * COPYRIGHT AND PERMISSION NOTICE\n" +
" *\n" +
" * Copyright (C) 1991-2012 Unicode, Inc. All rights reserved. Distributed under\n" +
" * the Terms of Use in http://www.unicode.org/copyright.html.\n" +
" *\n" +
" * Permission is hereby granted, free of charge, to any person obtaining a copy\n" +
" * of the Unicode data files and any associated documentation (the \"Data\n" +
" * Files\") or Unicode software and any associated documentation (the\n" +
" * \"Software\") to deal in the Data Files or Software without restriction,\n" +
" * including without limitation the rights to use, copy, modify, merge,\n" +
" * publish, distribute, and/or sell copies of the Data Files or Software, and\n" +
" * to permit persons to whom the Data Files or Software are furnished to do so,\n" +
" * provided that (a) the above copyright notice(s) and this permission notice\n" +
" * appear with all copies of the Data Files or Software, (b) both the above\n" +
" * copyright notice(s) and this permission notice appear in associated\n" +
" * documentation, and (c) there is clear notice in each modified Data File or\n" +
" * in the Software as well as in the documentation associated with the Data\n" +
" * File(s) or Software that the data or software has been modified.\n" +
" *\n" +
" * THE DATA FILES AND SOFTWARE ARE PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY\n" +
" * KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n" +
" * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF\n" +
" * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS\n" +
" * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR\n" +
" * CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,\n" +
" * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER\n" +
" * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE\n" +
" * OF THE DATA FILES OR SOFTWARE.\n" +
" *\n" +
" * Except as contained in this notice, the name of a copyright holder shall not\n" +
" * be used in advertising or otherwise to promote the sale, use or other\n" +
" * dealings in these Data Files or Software without prior written authorization\n" +
" * of the copyright holder.\n" +
" */\n";
private static String OPENJDK2012 =
"/*\n" +
" * Copyright (c) %d, Oracle and/or its affiliates. All rights reserved.\n" +
" * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.\n" +
" *\n" +
" * This code is free software; you can redistribute it and/or modify it\n" +
" * under the terms of the GNU General Public License version 2 only, as\n" +
" * published by the Free Software Foundation. Oracle designates this\n" +
" * particular file as subject to the \"Classpath\" exception as provided\n" +
" * by Oracle in the LICENSE file that accompanied this code.\n" +
" *\n" +
" * This code is distributed in the hope that it will be useful, but WITHOUT\n" +
" * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\n" +
" * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License\n" +
" * version 2 for more details (a copy is included in the LICENSE file that\n" +
" * accompanied this code).\n" +
" *\n" +
" * You should have received a copy of the GNU General Public License version\n" +
" * 2 along with this work; if not, write to the Free Software Foundation,\n" +
" * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.\n" +
" *\n" +
" * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA\n" +
" * or visit www.oracle.com if you need additional information or have any\n" +
" * questions.\n" +
" */\n";
private static String OPENJDK_AFTER2012 =
"/*\n" +
" * Copyright (c) 2012, %d, Oracle and/or its affiliates. All rights reserved.\n" +
" * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.\n" +
" *\n" +
" * This code is free software; you can redistribute it and/or modify it\n" +
" * under the terms of the GNU General Public License version 2 only, as\n" +
" * published by the Free Software Foundation. Oracle designates this\n" +
" * particular file as subject to the \"Classpath\" exception as provided\n" +
" * by Oracle in the LICENSE file that accompanied this code.\n" +
" *\n" +
" * This code is distributed in the hope that it will be useful, but WITHOUT\n" +
" * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\n" +
" * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License\n" +
" * version 2 for more details (a copy is included in the LICENSE file that\n" +
" * accompanied this code).\n" +
" *\n" +
" * You should have received a copy of the GNU General Public License version\n" +
" * 2 along with this work; if not, write to the Free Software Foundation,\n" +
" * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.\n" +
" *\n" +
" * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA\n" +
" * or visit www.oracle.com if you need additional information or have any\n" +
" * questions.\n" +
" */\n";
static String getOracleCopyright() {
int year = getYear();
return String.format(year > 2012 ? ORACLE_AFTER2012 : ORACLE2012, year);
}
static String getUnicodeCopyright() {
return UNICODE;
}
static String getOpenJDKCopyright() {
int year = getYear();
return String.format(year > 2012 ? OPENJDK_AFTER2012 : OPENJDK2012, year);
}
private static int getYear() {
return new GregorianCalendar(TimeZone.getTimeZone("America/Los_Angeles"),
Locale.US).get(Calendar.YEAR);
}
// no instantiation
private CopyrightHeaders() {
}
}
/*
* Copyright (c) 2012, 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.
*/
package build.tools.cldrconverter;
abstract class Entry<T> extends Container {
private String key;
Entry(String qName, Container parent, String key) {
super(qName, parent);
this.key = key;
}
String getKey() {
return key;
}
abstract T getValue();
}
/*
* Copyright (c) 2012, 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.
*/
package build.tools.cldrconverter;
class IgnoredContainer extends Container {
IgnoredContainer(String qName, Container parent) {
super(qName, parent);
}
@Override
void addCharacters(char[] characters, int start, int length) {
// ignore
}
}
/*
* Copyright (c) 2012, 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.
*/
package build.tools.cldrconverter;
/**
* A container that provides a key for contained elements.
* This container does not provide a value.
*/
class KeyContainer extends Container {
private String key;
KeyContainer(String qName, Container parent, String key) {
super(qName, parent);
this.key = key;
}
String getKey() {
return key;
}
}
/*
* Copyright (c) 2012, 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.
*/
package build.tools.cldrconverter;
import java.io.File;
import java.io.IOException;
import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
class MetaZonesParseHandler extends AbstractLDMLHandler<String> {
private String tzid, metazone;
MetaZonesParseHandler() {
}
@Override
public InputSource resolveEntity(String publicID, String systemID) throws IOException, SAXException {
// avoid HTTP traffic to unicode.org
if (systemID.startsWith(CLDRConverter.SPPL_LDML_DTD_SYSTEM_ID)) {
return new InputSource((new File(CLDRConverter.LOCAL_SPPL_LDML_DTD)).toURI().toString());
}
return null;
}
@Override
@SuppressWarnings("fallthrough")
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
switch (qName) {
case "timezone":
tzid = attributes.getValue("type");
pushContainer(qName, attributes);
break;
case "usesMetazone":
// Ignore any historical zone names (for now)
if (attributes.getValue("to") == null) {
metazone = attributes.getValue("mzone");
}
pushIgnoredContainer(qName);
break;
case "version":
case "generation":
pushIgnoredContainer(qName);
break;
default:
// treat anything else as a container
pushContainer(qName, attributes);
break;
}
}
@Override
public void endElement(String uri, String localName, String qName) throws SAXException {
assert qName.equals(currentContainer.getqName()) : "current=" + currentContainer.getqName() + ", param=" + qName;
switch (qName) {
case "timezone":
if (tzid == null || metazone == null) {
throw new InternalError();
}
put(tzid, metazone);
break;
}
currentContainer = currentContainer.getParent();
}
}
/*
* Copyright (c) 2012, 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.
*/
package build.tools.cldrconverter;
import java.io.File;
import java.io.IOException;
import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
/**
* Handles parsing of files in Locale Data Markup Language for numberingSystems.xml
* and produces a map that uses the keys and values of JRE locale data.
*/
class NumberingSystemsParseHandler extends AbstractLDMLHandler<String> {
NumberingSystemsParseHandler() {
}
@Override
public InputSource resolveEntity(String publicID, String systemID) throws IOException, SAXException {
// avoid HTTP traffic to unicode.org
if (systemID.startsWith(CLDRConverter.SPPL_LDML_DTD_SYSTEM_ID)) {
return new InputSource((new File(CLDRConverter.LOCAL_SPPL_LDML_DTD)).toURI().toString());
}
return null;
}
@Override
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
switch (qName) {
case "numberingSystem":
if ("numeric".equals(attributes.getValue("type"))) {
// eg, <numberingSystem id="latn" type="numeric" digits="0123456789"/>
put(attributes.getValue("id"), attributes.getValue("digits"));
}
pushIgnoredContainer(qName);
break;
case "version":
case "generation":
pushIgnoredContainer(qName);
break;
default:
// treat anything else as a container
pushContainer(qName, attributes);
break;
}
}
@Override
public void endElement(String uri, String localName, String qName) throws SAXException {
assert qName.equals(currentContainer.getqName()) : "current=" + currentContainer.getqName() + ", param=" + qName;
currentContainer = currentContainer.getParent();
}
}
/*
* Copyright (c) 2012, 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.
*/
package build.tools.cldrconverter;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Map;
import java.util.SortedSet;
class ResourceBundleGenerator implements BundleGenerator {
@Override
public void generateBundle(String packageName, String baseName, String localeID, boolean useJava,
Map<String, ?> map, boolean open) throws IOException {
String suffix = useJava ? ".java" : ".properties";
String lang = CLDRConverter.getLanguageCode(localeID);
String dirName = CLDRConverter.DESTINATION_DIR + File.separator + "sun" + File.separator
+ packageName + File.separator + "resources" + File.separator + "cldr";
if (lang.length() > 0) {
dirName = dirName + File.separator + lang;
packageName = packageName + ".resources.cldr." + lang;
} else {
packageName = packageName + ".resources.cldr";
}
File dir = new File(dirName);
if (!dir.exists()) {
dir.mkdirs();
}
File file = new File(dir, baseName + ("root".equals(localeID) ? "" : "_" + localeID) + suffix);
if (!file.exists()) {
file.createNewFile();
}
CLDRConverter.info("\tWriting file " + file);
String encoding;
if (useJava) {
if (CLDRConverter.USE_UTF8) {
encoding = "utf-8";
} else {
encoding = "us-ascii";
}
} else {
encoding = "iso-8859-1";
}
try (PrintWriter out = new PrintWriter(file, encoding)) {
// Output copyright headers
out.println(CopyrightHeaders.getOpenJDKCopyright());
out.println(CopyrightHeaders.getUnicodeCopyright());
if (useJava) {
out.println("package sun." + packageName + ";\n");
if (open) {
out.println("import sun.util.resources.OpenListResourceBundle;\n");
out.println("public class " + baseName + ("root".equals(localeID) ? "" : "_" + localeID) + " extends OpenListResourceBundle {");
} else {
out.println("import java.util.ListResourceBundle;\n");
out.println("public class " + baseName + ("root".equals(localeID) ? "" : "_" + localeID) + " extends ListResourceBundle {");
}
out.println(" @Override\n" +
" protected final Object[][] getContents() {\n" +
" final Object[][] data = new Object[][] {");
}
for (String key : map.keySet()) {
if (useJava) {
Object value = map.get(key);
if (value == null) {
CLDRConverter.warning("null value for " + key);
} else if (value instanceof String) {
out.println(" { \"" + key + "\", \"" + CLDRConverter.saveConvert((String) value, useJava) + "\" },");
} else if (value instanceof String[]) {
String[] values = (String[]) value;
out.println(" { \"" + key + "\",\n new String[] {");
for (String s : values) {
out.println(" \"" + CLDRConverter.saveConvert(s, useJava) + "\",");
}
out.println(" }\n },");
} else {
throw new RuntimeException("unknown value type: " + value.getClass().getName());
}
} else {
out.println(key + "=" + CLDRConverter.saveConvert((String) map.get(key), useJava));
}
}
if (useJava) {
out.println(" };\n return data;\n }\n}");
}
}
}
private static final String METAINFO_CLASS = "CLDRLocaleDataMetaInfo";
@Override
public void generateMetaInfo(Map<String, SortedSet<String>> metaInfo) throws IOException {
String dirName = CLDRConverter.DESTINATION_DIR + File.separator + "sun" + File.separator + "util" + File.separator
+ "cldr" + File.separator;
File dir = new File(dirName);
if (!dir.exists()) {
dir.mkdirs();
}
File file = new File(dir, METAINFO_CLASS + ".java");
if (!file.exists()) {
file.createNewFile();
}
CLDRConverter.info("Generating file " + file);
try (PrintWriter out = new PrintWriter(file, "us-ascii")) {
out.println(CopyrightHeaders.getOpenJDKCopyright());
out.println("package sun.util.cldr;\n\n"
+ "import java.util.ListResourceBundle;\n");
out.printf("public class %s extends ListResourceBundle {\n", METAINFO_CLASS);
out.println(" @Override\n" +
" protected final Object[][] getContents() {\n" +
" final Object[][] data = new Object[][] {");
for (String key : metaInfo.keySet()) {
out.printf(" { \"%s\",\n", key);
out.printf(" \"%s\" },\n", toLocaleList(metaInfo.get(key)));
}
out.println(" };\n return data;\n }\n}");
}
}
private static String toLocaleList(SortedSet<String> set) {
StringBuilder sb = new StringBuilder(set.size() * 6);
for (String id : set) {
if (!"root".equals(id)) {
if (sb.length() > 0) {
sb.append(' ');
}
sb.append(id);
}
}
return sb.toString();
}
}
/*
* Copyright (c) 2012, 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.
*/
package build.tools.cldrconverter;
class StringArrayElement extends Container {
StringArrayEntry array;
int index;
StringArrayElement(String qName, Container parent, int index) {
super(qName, parent);
while (!(parent instanceof StringArrayEntry)) {
parent = parent.getParent();
}
array = (StringArrayEntry) parent;
this.index = index;
}
@Override
void addCharacters(char[] characters, int start, int length) {
array.addCharacters(index, characters, start, length);
}
}
/*
* Copyright (c) 2012, 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.
*/
package build.tools.cldrconverter;
class StringArrayEntry extends Entry<String[]> {
private String[] value;
StringArrayEntry(String qName, Container parent, String key, int length) {
super(qName, parent, key);
value = new String[length];
}
void addCharacters(int index, char[] characters, int start, int length) {
if (value[index] != null) {
StringBuilder sb = new StringBuilder(value[index]);
sb.append(characters, start, length);
value[index] = sb.toString();
} else {
value[index] = new String(characters, start, length);
}
}
@Override
String[] getValue() {
// This method patches up a few oddities:
// - Since am/pm strings are nested directly under the calendar element,
// am/pm arrays may be created for which there was no real data.
// This test avoids returning empty arrays.
// - On the other hand, for month names it's OK to not have month 13,
// but this should be indicated by an empty string for compatibility
// with JRE resource bundles.
// - Finally, CLDR doesn't really have string arrays; each string is
// supposed to be inherited separately. Although value is the partially filled array,
// we will return it so that it can be reconstructed later in the method,
// ConvertLocaleData.convertBundles()
// The CLDR's iheritance system is different from JRE's. CLDR can inherit
// by the element level in the array.
if (getKey().startsWith("Month") && value[0] != null && value[12] == null) {
value[12] = "";
}
for (String element : value) {
if (element != null) {
return value;
}
}
return null;
}
}
/*
* Copyright (c) 2012, 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.
*/
package build.tools.cldrconverter;
class StringEntry extends Entry<String> {
private String value;
StringEntry(String qName, Container parent, String key) {
super(qName, parent, key);
}
StringEntry(String qName, Container parent, String key, String value) {
super(qName, parent, key);
this.value = value;
}
@Override
void addCharacters(char[] characters, int start, int length) {
String s = new String(characters, start, length);
if (value != null) {
value += s;
} else {
value = s;
}
}
@Override
String getValue() {
return value;
}
}
/*
* Copyright (c) 2012, 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.
*/
package build.tools.cldrconverter;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
/**
* Handles parsing of files in Locale Data Markup Language for SupplementData.xml
* and produces a map that uses the keys and values of JRE locale data.
*/
class SupplementDataParseHandler extends AbstractLDMLHandler<Object> {
//UNM49 region and composition code used in supplementalData.xml
private static final String WORLD = "001";
private static final String JAVA_FIRSTDAY = "firstDayOfWeek";
private static final String JAVA_MINDAY = "minimalDaysInFirstWeek";
// The weekData is now in supplementalData.xml,
// which is not a locale specific file.
// Map for JRE is created locale specific way.
// When parsing the locale neutral file (supplementalData.xml),
// we need to rely on the country code because
// the weekData is listed using country code.
private final Map<String, Object> firstDayMap;
private final Map<String, Object> minDaysMap;
SupplementDataParseHandler() {
firstDayMap = new HashMap<>();
minDaysMap = new HashMap<>();
}
/**
* It returns Map that contains the firstDay and minDays information for
* the country. The Map is created in JRE format after obtaining the data
* from two Maps, firstDayMap and minDaysMap.
*
* It returns null when there is no firstDay and minDays for the country
* although this should not happen because supplementalData.xml includes
* default value for the world ("001") for firstDay and minDays.
*/
Map<String, Object> getData(String country) {
Map<String, Object> values = new HashMap<>();
String countryData = getWeekData(country, JAVA_FIRSTDAY, firstDayMap);
if (countryData != null) {
values.put(JAVA_FIRSTDAY, countryData);
}
String minDaysData = getWeekData(country, JAVA_MINDAY, minDaysMap);
if (minDaysData != null) {
values.put(JAVA_MINDAY, minDaysData);
}
return values.isEmpty() ? null : values;
}
/**
* It returns either firstDay or minDays in the JRE format for the country.
*
* @param country territory code of the requested data
* @param jreDataName JAVA_FIRSTDAY or JAVA_MINDAY
* @param dataMap firstDayMap or minDaysMap
* @return the value for the given jreDataName, or null if requested value
* (firstDay/minDays) is not available although that is highly unlikely
* because of the default value for the world (001).
*/
String getWeekData(String country, final String jreDataName, final Map<String, Object> dataMap) {
String countryValue = null;
String defaultWorldValue = null;
for (String key : dataMap.keySet()) {
if (key.contains(country)) {
if (jreDataName.equals(JAVA_FIRSTDAY)) {
countryValue = DAY_OF_WEEK_MAP.get((String) dataMap.get(key));
} else if (jreDataName.equals(JAVA_MINDAY)) {
countryValue = (String) dataMap.get(key);
}
if (countryValue != null) {
return countryValue;
}
} else if (key.contains(WORLD)) {
if (jreDataName.equals(JAVA_FIRSTDAY)) {
defaultWorldValue = DAY_OF_WEEK_MAP.get((String) dataMap.get(key));
} else if (jreDataName.equals(JAVA_MINDAY)) {
defaultWorldValue = (String) dataMap.get(key);
}
}
}
return defaultWorldValue;
}
@Override
public InputSource resolveEntity(String publicID, String systemID) throws IOException, SAXException {
// avoid HTTP traffic to unicode.org
if (systemID.startsWith(CLDRConverter.SPPL_LDML_DTD_SYSTEM_ID)) {
return new InputSource((new File(CLDRConverter.LOCAL_SPPL_LDML_DTD)).toURI().toString());
}
return null;
}
/**
* JRE requires all the data to be organized by the locale while CLDR 1.4 list
* Calendar related data (weekData)in SupplementalData.xml.
* startElement stores JRE required data into two Maps,
* firstDayMap and minDaysMap.
*/
@Override
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
// elements we need to actively ignore
switch (qName) {
case "firstDay":
if (!isIgnored(attributes)) {
firstDayMap.put(attributes.getValue("territories"), attributes.getValue("day"));
}
break;
case "minDays":
if (!isIgnored(attributes)) {
minDaysMap.put(attributes.getValue("territories"), attributes.getValue("count"));
}
break;
default:
// treat anything else as a container
pushContainer(qName, attributes);
break;
}
}
}
/*
* Copyright (c) 2012, 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.
*/
package build.tools.generatebreakiteratordata;
import java.util.Arrays;
import java.util.ResourceBundle;
import java.util.List;
import java.util.Locale;
class BreakIteratorRBControl extends ResourceBundle.Control {
static final BreakIteratorRBControl INSTANCE = new BreakIteratorRBControl();
private static final String RESOURCES = ".resources.";
private BreakIteratorRBControl() {
}
@Override
public Locale getFallbackLocale(String baseName, Locale locale) {
// No fallback
return null;
}
@Override
public List<Locale> getCandidateLocales(String baseName, Locale locale) {
// No parents lookup
return Arrays.asList(locale);
}
/**
* Changes baseName to its per-language package name and
* calls the super class implementation.
*/
@Override
public String toBundleName(String baseName, Locale locale) {
String newBaseName = baseName;
String lang = locale.getLanguage();
if (lang.length() > 0) {
int index = baseName.indexOf(RESOURCES);
if (index > 0) {
index += RESOURCES.length();
newBaseName = baseName.substring(0, index) + lang + "."
+ baseName.substring(index);
}
}
return super.toBundleName(newBaseName, locale);
}
}
/*
* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2012, 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
......@@ -79,43 +79,33 @@ public class GenerateBreakIteratorData {
ResourceBundle rules, info;
info = ResourceBundle.getBundle("sun.text.resources.BreakIteratorInfo",
new Locale(language, country, valiant));
new Locale(language, country, valiant),
BreakIteratorRBControl.INSTANCE);
classNames = info.getStringArray("BreakIteratorClasses");
rules = ResourceBundle.getBundle("sun.text.resources.BreakIteratorRules",
new Locale(language, country, valiant));
/*
* Fallback is not necessary here.... So, cannot use getBundle().
*/
try {
info = (ResourceBundle)Class.forName("sun.text.resources.BreakIteratorInfo" + localeName).newInstance();
Enumeration<String> keys = info.getKeys();
while (keys.hasMoreElements()) {
String key = keys.nextElement();
if (key.equals("CharacterData")) {
generateDataFile(info.getString(key),
rules.getString("CharacterBreakRules"),
classNames[0]);
} else if (key.endsWith("WordData")) {
generateDataFile(info.getString(key),
rules.getString("WordBreakRules"),
classNames[1]);
} else if (key.endsWith("LineData")) {
generateDataFile(info.getString(key),
rules.getString("LineBreakRules"),
classNames[2]);
} else if (key.endsWith("SentenceData")) {
generateDataFile(info.getString(key),
rules.getString("SentenceBreakRules"),
classNames[3]);
}
}
new Locale(language, country, valiant),
BreakIteratorRBControl.INSTANCE);
if (info.containsKey("CharacterData")) {
generateDataFile(info.getString("CharacterData"),
rules.getString("CharacterBreakRules"),
classNames[0]);
}
if (info.containsKey("WordData")) {
generateDataFile(info.getString("WordData"),
rules.getString("WordBreakRules"),
classNames[1]);
}
if (info.containsKey("LineData")) {
generateDataFile(info.getString("LineData"),
rules.getString("LineBreakRules"),
classNames[2]);
}
catch (Exception e) {
throw new InternalError(e.toString());
if (info.containsKey("SentenceData")) {
generateDataFile(info.getString("SentenceData"),
rules.getString("SentenceBreakRules"),
classNames[3]);
}
}
......
......@@ -256,7 +256,8 @@ ifeq ($(OPENJDK_TARGET_OS),macosx)
EXFILES+= $(JDK_TOPDIR)/src/solaris/classes/sun/nio/ch/DefaultSelectorProvider.java \
$(JDK_TOPDIR)/src/solaris/classes/sun/java2d/BackBufferCapsProvider.java \
$(JDK_TOPDIR)/src/solaris/classes/java/net/DefaultInterface.java \
$(JDK_TOPDIR)/src/solaris/classes/java/lang/ClassLoaderHelper.java
$(JDK_TOPDIR)/src/solaris/classes/java/lang/ClassLoaderHelper.java \
$(JDK_TOPDIR)/src/solaris/classes/sun/util/locale/provider/HostLocaleProviderAdapterImpl.java
# JObjC.jar contains 1.5 byte-code...so skip it here :-(
# MACOSX_SRC_DIRS += $(JDK_TOPDIR)/src/macosx/native/jobjc/src
......
......@@ -74,37 +74,15 @@ JARS+=$(JDK_OUTPUTDIR)/lib/ext/dnsns.jar
##########################################################################################
LOCALEDATA_INCLUDE_PATTERNS := \
sun/text/resources/*_ar* \
sun/text/resources/*_hi* \
sun/text/resources/*_iw* \
sun/text/resources/*_iw* \
sun/text/resources/*_ja* \
sun/text/resources/*_ko* \
sun/text/resources/*_th.* \
sun/text/resources/*_th_* \
sun/text/resources/*_vi* \
sun/text/resources/*_zh* \
sun/text/resources/*Data_th \
sun/text/resources/thai_dict \
sun/util/resources/*_ar* \
sun/util/resources/*_hi* \
sun/util/resources/*_iw* \
sun/util/resources/*_iw* \
sun/util/resources/*_ja* \
sun/util/resources/*_ko* \
sun/util/resources/*_th_* \
sun/util/resources/*_th.* \
sun/util/resources/*_vi* \
sun/util/resources/*_zh*
LOCALEDATA_INCLUDES := $(patsubst $(JDK_OUTPUTDIR)/classes/%,%,\
$(foreach i,$(LOCALEDATA_INCLUDE_PATTERNS), $(wildcard $(JDK_OUTPUTDIR)/classes/$i)))
LOCALEDATA_INCLUDE_LOCALES := ar hi iw ja ko th vi zh
LOCALEDATA_INCLUDES := $(addprefix sun/text/resources/,$(LOCALEDATA_INCLUDE_LOCALES)) \
$(addprefix sun/util/resources/,$(LOCALEDATA_INCLUDE_LOCALES))
$(eval $(call SetupArchive,BUILD_LOCALEDATA_JAR,,\
SRCS:=$(JDK_OUTPUTDIR)/classes,\
SUFFIXES:=.class _dict _th,\
INCLUDES:=$(LOCALEDATA_INCLUDES),\
EXCLUDES:=sun/text/resources/th/BreakIteratorRules_th.class,\
JAR:=$(JDK_OUTPUTDIR)/lib/ext/localedata.jar,\
SKIP_METAINF:=true))
......@@ -244,7 +222,10 @@ RT_JAR_EXCLUDES := \
javax/swing/SwingBeanInfoBase.class \
javax/swing/text/JTextComponentBeanInfo.class \
sun/swing/BeanInfoUtils.class \
$(LOCALEDATA_INCLUDES)
$(LOCALEDATA_INCLUDES) \
sun/text/resources/cldr \
sun/util/resources/cldr \
sun/util/cldr/CLDRLocaleDataMetaInfo.class
# These files should never be put into rt.jar
# but due to a misstake...some are put there if embedded
......@@ -634,6 +615,26 @@ endif
##########################################################################################
# Get the CLDRVERSION
include GensrcCLDR.gmk
CLDRDATA_JAR_DST := $(JDK_OUTPUTDIR)/lib/ext/cldrdata.jar
$(eval $(call SetupArchive,BUILD_CLDRDATA_JAR,$(CLDRDATA_DEPS),\
SRCS:=$(JDK_OUTPUTDIR)/classes,\
SUFFIXES:=.class,\
INCLUDES:=sun/text/resources/cldr \
sun/util/cldr \
sun/util/resources/cldr,\
EXCLUDES:=sun/util/cldr/CLDRLocaleProviderAdapter,\
JAR:=$(CLDRDATA_JAR_DST),\
EXTRA_MANIFEST_ATTR:=CLDR-Version: $(CLDRVERSION),\
SKIP_METAINF:=true))
JARS += $(CLDRDATA_JAR_DST)
##########################################################################################
TOOLS_JAR_INCLUDES := \
sun/tools/asm \
sun/tools/jar \
......
......@@ -37,8 +37,8 @@ TEXT_SRCDIR = $(JDK_TOPDIR)/src/share/classes
TEXT_PKG = sun/text/resources
TEXT_SOURCES = $(TEXT_PKG)/BreakIteratorRules.java \
$(TEXT_PKG)/BreakIteratorInfo.java \
$(TEXT_PKG)/BreakIteratorRules_th.java \
$(TEXT_PKG)/BreakIteratorInfo_th.java
$(TEXT_PKG)/th/BreakIteratorRules_th.java \
$(TEXT_PKG)/th/BreakIteratorInfo_th.java
# Generate BreakIteratorData
BREAK_ITERATOR_DIR = $(JDK_OUTPUTDIR)/break_iterator
......@@ -67,8 +67,8 @@ BIFILES = $(DATA_PKG_DIR)/CharacterBreakIteratorData \
$(DATA_PKG_DIR)/WordBreakIteratorData \
$(DATA_PKG_DIR)/LineBreakIteratorData \
$(DATA_PKG_DIR)/SentenceBreakIteratorData
BIFILES_TH = $(DATA_PKG_DIR)/WordBreakIteratorData_th \
$(DATA_PKG_DIR)/LineBreakIteratorData_th
BIFILES_TH = $(DATA_PKG_DIR)/th/WordBreakIteratorData_th \
$(DATA_PKG_DIR)/th/LineBreakIteratorData_th
$(BIFILES): $(BREAK_ITERATOR_DIR)/_the.bifiles
$(BREAK_ITERATOR_DIR)/_the.bifiles: JAVA_FLAGS += -Xbootclasspath/p:$(BREAK_ITERATOR_CLASSES)
......@@ -85,7 +85,7 @@ $(BIFILES_TH): $(BREAK_ITERATOR_DIR)/_the.bifiles_th
$(BREAK_ITERATOR_DIR)/_the.bifiles_th: JAVA_FLAGS += -Xbootclasspath/p:$(BREAK_ITERATOR_CLASSES)
$(BREAK_ITERATOR_DIR)/_the.bifiles_th: $(BUILD_TOOLS) $(UNICODEDATA) $(BUILD_BREAKITERATOR)
$(ECHO) "Generating BreakIteratorData_th"
$(MKDIR) -p $(DATA_PKG_DIR)
$(MKDIR) -p $(DATA_PKG_DIR)/th
$(RM) -f $(BIFILES_TH)
$(TOOL_GENERATEBREAKITERATORDATA) \
-o $(DATA_PKG_DIR) \
......
......@@ -73,6 +73,9 @@ include GensrcX11Wrappers.gmk
GENSRC += $(GENSRC_X11WRAPPERS)
endif
include GensrcCLDR.gmk
GENSRC += $(GENSRC_CLDR)
include GensrcSwing.gmk
ifndef DISABLE_NIMBUS
GENSRC += $(GENSRC_SWING_NIMBUS)
......@@ -99,7 +102,8 @@ all: $(GENSRC) $(GENSRC_SWING_BEANINFO)
$(CP) -rp gensrc_charsetmapping/* gensrc && \
$(CP) -rp gensrc_charsetcoder/* gensrc && \
$(CP) -rp gensrc_exceptions/* gensrc && \
$(CP) -rp gensrc_buffer/* gensrc)
$(CP) -rp gensrc_buffer/* gensrc && \
$(CP) -rp gensrc_cldr/* gensrc)
if [ -d $(JDK_OUTPUTDIR)/gensrc_swing/javax/swing/plaf ] ; then \
(cd $(JDK_OUTPUTDIR) && \
$(MKDIR) -p gensrc/javax/swing/plaf && \
......
#
# Copyright (c) 2012, 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.
#
CLDRVERSION := 21.0.1
CLDRSRCDIR := $(JDK_TOPDIR)/src/share/classes/sun/util/cldr/resources/$(subst .,_,$(CLDRVERSION))
GENSRC_DIR := $(JDK_OUTPUTDIR)/gensrc_cldr
CLDR_METAINFO_FILE := $(GENSRC_DIR)/sun/util/cldr/CLDRLocaleDataMetaInfo.java
$(CLDR_METAINFO_FILE): $(wildcard $(CLDRSRCDIR)/common/dtd/*.dtd) \
$(wildcard $(CLDRSRCDIR)/common/main/*.xml) \
$(wildcard $(CLDRSRCDIR)/common/supplemental/*.xml)
$(MKDIR) -p $(@D)
$(TOOL_CLDRCONVERTER) -base $(CLDRSRCDIR) -o $(GENSRC_DIR)
GENSRC_CLDR := $(CLDR_METAINFO_FILE)
......@@ -47,50 +47,60 @@ NEW_RESOURCES:=$(filter-out $(PREV_LOCALE_RESOURCES),$(LOCALE_RESOURCES))
ifneq (,$(MISSING_RESOURCES)$(NEW_RESOURCES))
# There is a difference in the number of supported resources. Trigger a regeneration.
$(shell $(RM) $(JDK_OUTPUTDIR)/gensrc_localedatametainfo/sun/util/LocaleDataMetaInfo.java)
$(shell $(RM) $(JDK_OUTPUTDIR)/gensrc_localedatametainfo/sun/util/locale/provider/LocaleDataMetaInfo.java)
endif
# The non-euro zone locales have to be separated from the euro-zone locales.
NON_EURO_LOCALES:=ar% hi% iw% ja% ko% th% vi% zh%
# ja-JP-JP and th-TH-TH need to be manually added, as they don't have any resource files.
ALL_NON_EURO_LOCALES:=ja-JP-JP th-TH-TH
SED_ARGS:=-e 's|$(HASH)warn This file is preprocessed before being compiled|// -- This file was mechanically generated: Do not edit! -- //|g'
# This macro creates a sed expression that substitues for example:
# #FormatData_EuroLocales# with: be be_BY bg bg_BG ca ca_ES... and some more.
CAPTURE_LOCALE='s/$$(HASH)$1_$2EuroLocales$$(HASH)/ $$($3 $(NON_EURO_LOCALES),$$(filter-out $1,$$(subst $1_,,$$(filter $1_%,$(LOCALE_RESOURCES)))))/g'
define CaptureLocale
$1_LOCALES := $$(subst _,-,$$(filter-out $1,$$(subst $1_,,$$(filter $1_%,$(LOCALE_RESOURCES)))))
$1_EURO_LOCALES := $$(filter-out $(NON_EURO_LOCALES),$$($1_LOCALES))
$1_NON_EURO_LOCALES := $$(filter $(NON_EURO_LOCALES),$$($1_LOCALES))
ALL_EURO_LOCALES += $$($1_EURO_LOCALES)
ALL_NON_EURO_LOCALES += $$($1_NON_EURO_LOCALES)
SED_ARGS+= -e 's/$$(HASH)$1_EuroLocales$$(HASH)/ $$($1_EURO_LOCALES)/g'
SED_ARGS+= -e 's/$$(HASH)$1_NonEuroLocales$$(HASH)/ $$($1_NON_EURO_LOCALES)/g'
endef
SED_ARGS:=-e 's|$(HASH)warn This file is preprocessed before being compiled|// -- This file was mechanically generated: Do not edit! -- //|g'
#sun.text.resources.FormatData
$(eval SED_ARGS+=-e $(call CAPTURE_LOCALE,FormatData,,filter-out))
$(eval SED_ARGS+=-e $(call CAPTURE_LOCALE,FormatData,Non,filter))
$(eval $(call CaptureLocale,FormatData))
#sun.text.resources.CollationData
$(eval SED_ARGS+=-e $(call CAPTURE_LOCALE,CollationData,,filter-out))
$(eval SED_ARGS+=-e $(call CAPTURE_LOCALE,CollationData,Non,filter))
$(eval $(call CaptureLocale,CollationData))
#sun.util.resources.TimeZoneNames
$(eval SED_ARGS+=-e $(call CAPTURE_LOCALE,TimeZoneNames,,filter-out))
$(eval SED_ARGS+=-e $(call CAPTURE_LOCALE,TimeZoneNames,Non,filter))
$(eval $(call CaptureLocale,TimeZoneNames))
#sun.util.resources.LocaleNames
$(eval SED_ARGS+=-e $(call CAPTURE_LOCALE,LocaleNames,,filter-out))
$(eval SED_ARGS+=-e $(call CAPTURE_LOCALE,LocaleNames,Non,filter))
$(eval $(call CaptureLocale,LocaleNames))
#sun.util.resources.CurrencyNames
$(eval SED_ARGS+=-e $(call CAPTURE_LOCALE,CurrencyNames,,filter-out))
$(eval SED_ARGS+=-e $(call CAPTURE_LOCALE,CurrencyNames,Non,filter))
$(eval $(call CaptureLocale,CurrencyNames))
#sun.util.resources.CalendarData
$(eval SED_ARGS+=-e $(call CAPTURE_LOCALE,CalendarData,,filter-out))
$(eval SED_ARGS+=-e $(call CAPTURE_LOCALE,CalendarData,Non,filter))
$(eval $(call CaptureLocale,CalendarData))
SED_ARGS+= -e 's/$(HASH)AvailableLocales_EuroLocales$(HASH)/$(sort $(ALL_EURO_LOCALES))/g'
SED_ARGS+= -e 's/$(HASH)AvailableLocales_NonEuroLocales$(HASH)/$(sort $(ALL_NON_EURO_LOCALES))/g'
$(JDK_OUTPUTDIR)/gensrc_localedatametainfo/sun/util/LocaleDataMetaInfo.java: \
$(JDK_TOPDIR)/src/share/classes/sun/util/LocaleDataMetaInfo-XLocales.java.template
$(JDK_OUTPUTDIR)/gensrc_localedatametainfo/sun/util/locale/provider/LocaleDataMetaInfo.java: \
$(JDK_TOPDIR)/src/share/classes/sun/util/locale/provider/LocaleDataMetaInfo-XLocales.java.template
$(MKDIR) -p $(@D)
$(ECHO) Creating sun/util/LocaleDataMetaInfo.java from $(words $(LOCALE_RESOURCES)) found resources.
$(PRINTF) "PREV_LOCALE_RESOURCES:=$(LOCALE_RESOURCES)" > $(JDK_OUTPUTDIR)/gensrc_localedatametainfo/_the.locale_resources
$(SED) $(SED_ARGS) $(JDK_TOPDIR)/src/share/classes/sun/util/LocaleDataMetaInfo-XLocales.java.template \
> $(JDK_OUTPUTDIR)/gensrc_localedatametainfo/sun/util/LocaleDataMetaInfo.java
$(SED) $(SED_ARGS) $< > $@
GENSRC_LOCALEDATAMETAINFO:=$(JDK_OUTPUTDIR)/gensrc_localedatametainfo/sun/util/LocaleDataMetaInfo.java
GENSRC_LOCALEDATAMETAINFO:=$(JDK_OUTPUTDIR)/gensrc_localedatametainfo/sun/util/locale/provider/LocaleDataMetaInfo.java
###
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册