]> git.saurik.com Git - apple/icu.git/blame - icuSources/data/cldr-icu-readme.txt
ICU-64243.0.1.tar.gz
[apple/icu.git] / icuSources / data / cldr-icu-readme.txt
CommitLineData
f3c0d7a5
A
1# Copyright (C) 2016 and later: Unicode, Inc. and others.
2# License & terms of use: http://www.unicode.org/copyright.html
b331163b 3# Copyright (C) 2010-2014, International Business Machines Corporation and others.
729e4ab9
A
4# All Rights Reserved.
5#
6# Commands for regenerating ICU4C locale data (.txt files) from CLDR.
7#
8# The process requires local copies of
9# - CLDR (the source of most of the data, and some Java tools)
57a6839d 10# - ICU4J (used only for checking the converted data)
729e4ab9
A
11# - ICU4C (the destination for the new data, and the source for some of it)
12#
13# For an official CLDR data integration into ICU, these should be clean, freshly
14# checked-out. For released CLDR sources, an alternative to checking out sources
15# for a given version is downloading the zipped sources for the common (core.zip)
16# and tools (tools.zip) directory subtrees from the Data column in
17# [http://cldr.unicode.org/index/downloads].
18#
19# The versions of each of these must match. Included with the release notes for
20# ICU is the version number and/or a CLDR svn tag name for the revision of CLDR
21# that was the source of the data for that release of ICU.
22#
729e4ab9
A
23# Besides a standard JDK, the process also requires ant
24# (http://ant.apache.org/),
25# plus the xml-apis.jar from the Apache xalan package
26# (http://xml.apache.org/xalan-j/downloads.html).
27#
28# Note: Enough things can (and will) fail in this process that it is best to
29# run the commands separately from an interactive shell. They should all
30# copy and paste without problems.
31#
32# It is often useful to save logs of the output of many of the steps in this
33# process. The commands below put log files in /tmp; you may want to put them
34# somewhere else.
35#
36#----
37#
3d1f044b 38# CLDR dtd caching
0f5d89e8 39#
3d1f044b 40# Parts of the build process (notably building the new ICU data files in step 4)
0f5d89e8
A
41# require http: access to files in the CLDR repository; for example, processing
42# the files in icu4c/source/data/xml/ may require access to
43# http://www.unicode.org/repos/cldr/trunk/common/dtd/ldml.dtd
44#
3d1f044b
A
45# Unless you cache the dtds locally by
46# 1. creating a temp directory e.g. ~/.cldrdtd
47# 2. setting CLDR_DTD_CACHE to it e.g. -DCLDR_DTD_CACHE=~/.cldrdtd
48# your system will make excessive network requests, which will result in the
49# Unicode server blocking access.
0f5d89e8
A
50#
51#----
52#
729e4ab9
A
53# There are several environment variables that need to be defined.
54#
55# a) Java- and ant-related variables
56#
57# JAVA_HOME: Path to JDK (a directory, containing e.g. bin/java, bin/javac,
58# etc.); on many systems this can be set using
59# `/usr/libexec/java_home`.
60#
57a6839d 61# ANT_OPTS: You may want to set:
729e4ab9 62#
3d1f044b 63# -Xmx4096m, to give Java more memory; otherwise it may run out
729e4ab9 64# of heap.
3d1f044b
A
65# -DCLDR_DTD_CACHE=~/.cldrdtd (or some other temp directory
66# that already exists), to reduce frequent http: access to dtds
67# and consequent blockage by Unicode server.
729e4ab9 68#
729e4ab9
A
69# b) CLDR-related variables
70#
71# CLDR_DIR: Path to root of CLDR sources, below which are the common and
57a6839d 72# tools directories.
3d1f044b
A
73# CLDR_CLASSES: Path to the CLDR Tools classes directory. If not set, defaults
74# to $CLDR_DIR/tools/java/classes
729e4ab9 75#
57a6839d
A
76# c) ICU-related variables
77# These variables only need to be set if you're directly reusing the
78# commands below.
729e4ab9
A
79#
80# ICU4C_DIR: Path to root of ICU4C sources, below which is the source dir.
81#
82# ICU4J_ROOT: Path to root of ICU4J sources, below which is the main dir.
729e4ab9
A
83#
84#----
85#
86# If you are adding or removing locales, or specific kinds of locale data,
87# there are some xml files in the ICU sources that need to be updated (these xml
88# files are used in addition to the CLDR files as inputs to the CLDR data build
89# process for ICU):
90#
0f5d89e8 91# icu4c/source/data/icu-config.xml - Update <locales> to add or remove
729e4ab9
A
92# CLDR locales for inclusion in ICU. Update <paths> to prefer
93# alt forms for certain paths, or to exclude certain paths; note
94# that <paths> items can only have draft or alt attributes.
95#
51004dcb
A
96# Note that if a language-only locale (e.g. "de") is included in
97# <locales>, then all region sublocales for that language that
98# are present in CLDR data (e.g. "de_AT", "de_BE", "de_CH", etc.)
99# should also be included in <locales>, per PMC policy decision
100# 2012-05-02 (see http://bugs.icu-project.org/trac/ticket/9298).
101#
0f5d89e8 102# icu4c/source/data/build.xml - If you are adding or removing break
729e4ab9
A
103# iterators, you need to update <fileset id="brkitr" ...> under
104# <target name="clean" ...> to clean the correct set of files.
105#
3d1f044b
A
106# If there are new CLDR resource bundle types, you may need to
107# updated the <remapper> sections to put these in the correct
108# data subfolder for ICU.
109#
0f5d89e8 110# icu4c/source/data/xml/ - If you are adding a new locale, break
57a6839d
A
111# iterator, collation tailoring, or rule-based number formatter,
112# you may need to add a corresponding xml file in (respectively)
113# the main/, brkitr/, collation/, or rbnf/ subdirectory here.
729e4ab9
A
114#
115#----
116#
117# For an official CLDR data integration into ICU, there are some additional
118# considerations:
119#
120# a) Don't commit anything in ICU sources (and possibly any changes in CLDR
121# sources, depending on their nature) until you have finished testing and
122# resolving build issues and test failures for both ICU4C and ICU4J.
123#
124# b) There are version numbers that may need manual updating in CLDR (other
125# version numbers get updated automatically, based on these):
126#
127# common/dtd/ldml.dtd - update cldrVersion
128# common/dtd/ldmlBCP47.dtd - update cldrVersion
129# common/dtd/ldmlSupplemental.dtd - update cldrVersion
3d1f044b
A
130# common/dtd/ldmlSupplemental.dtd - updateunicodeVersion
131# keyboards/dtd/ldmlKeyboard.dtd - update cldrVersion
729e4ab9
A
132# tools/java/org/unicode/cldr/util/CLDRFile.java - update GEN_VERSION
133#
134# c) After everything is committed, you will need to tag the CLDR, ICU4J, and
135# ICU4C sources that ended up being used for the integration; see step 17
136# below.
137#
138################################################################################
139
140# 1a. Java and ant variables, adjust for your system
729e4ab9
A
141
142export JAVA_HOME=`/usr/libexec/java_home`
3d1f044b 143export ANT_OPTS="-Xmx4096m -DCLDR_DTD_CACHE=~/.cldrdtd"
729e4ab9
A
144
145# 1b. CLDR variables, adjust for your setup; with cygwin it might be e.g.
146# CLDR_DIR=`cygpath -wp /build/cldr`
147
148export CLDR_DIR=$HOME/cldr/trunk
729e4ab9
A
149
150# 1c. ICU variables
151
3d1f044b
A
152export ICU4C_DIR=$HOME/icu/icu4c
153export ICU4J_ROOT=$HOME/icu/icu4j
154
155# 1d. Pre-populate your CLDR DTD cache. You need to do this only once.
156
157mkdir ~/.cldrdtd
158cd ~/.cldrdtd
159curl http://www.unicode.org/repos/cldr/trunk/common/dtd/ldml.dtd \
160 -o http___www.unicode.org_repos_cldr_trunk_common_dtd_ldml.dtd
161# WAIT before hitting the server again; it WILL NOT give you a second chance!
162sleep 5
163curl http://www.unicode.org/repos/cldr/trunk/common/dtd/ldmlICU.dtd \
164 -o http___www.unicode.org_repos_cldr_trunk_common_dtd_ldmlICU.dtd
165sleep 5
166curl http://www.unicode.org/repos/cldr/trunk/common/dtd/ldmlSupplemental.dtd \
167 -o http___www.unicode.org_repos_cldr_trunk_common_dtd_ldmlSupplemental.dtd
729e4ab9 168
57a6839d 169# 2. Build the CLDR Java tools
3d1f044b 170# Optionally build the jar, but ant will look inside the classes directory anyway
729e4ab9
A
171
172cd $CLDR_DIR/tools/java
3d1f044b
A
173ant all
174#ant jar
729e4ab9 175
57a6839d 176# 3. Configure ICU4C, build and test without new data first, to verify that
3d1f044b
A
177# there are no pre-existing errors. Here <platform> is the runConfigureICU
178# code for the platform you are building, e.g. Linux, MacOSX, Cygwin.
729e4ab9
A
179
180cd $ICU4C_DIR/source
3d1f044b 181./runConfigureICU <platform>
729e4ab9
A
182make all 2>&1 | tee /tmp/icu4c-oldData-makeAll.txt
183make check 2>&1 | tee /tmp/icu4c-oldData-makeCheck.txt
184
57a6839d 185# 4. Build the new ICU4C data files; these include .txt files and .mk files.
729e4ab9
A
186# These new files will replace whatever was already present in the ICU4C sources.
187# This process uses ant with ICU's data/build.xml and data/icu-config.xml to
188# operate (via CLDR's ant/CLDRConverterTool.java and ant/CLDRBuild.java) the
189# necessary CLDR tools including LDML2ICUConverter, ConvertTransforms, etc.
57a6839d 190# This process will take several minutes.
729e4ab9 191# Keep a log so you can investigate anything that looks suspicious.
0f5d89e8 192#
3d1f044b
A
193# Running "ant setup" is not required, but it will print useful errors to
194# debug issues with your path when it fails.
195#
196# If you see timeout errors when building the rbnf data, for example, then you are
197# likely not using a CLDR dtd cache; see "CLDR dtd caching" above. If you are using
198# a dtd cache and are still having timeout problems, the IP address of your system
199# may have been blocked due to previous excessive access. In this case you may need
200# to contact a Unicode sysadmin to restore access.
201#
202# Unfortunately, even if you have your DTD cache variable enabled, you may still
203# get blocked and unable to populate your cache because of multiple successive
204# requests to download the required DTD files. It is recommended that you
205# pre-populate your cache as shown above in step 1d.
729e4ab9
A
206
207cd $ICU4C_DIR/source/data
3d1f044b 208ant setup
729e4ab9 209ant clean
f3c0d7a5 210ant all 2>&1 | tee /tmp/cldr-newData-buildLog.txt
729e4ab9 211
57a6839d 212# 5. Check which data files have modifications, which have been added or removed
729e4ab9
A
213# (if there are no changes, you may not need to proceed further). Make sure the
214# list seems reasonable.
215
3d1f044b 216git status
729e4ab9 217
3d1f044b
A
218# 6. Fix any errors, investigate any warnings. Currently for example there are
219# a few warnings of the following form in rbnf files:
220# [cldr-build] Warning: no version match with: $Revisionā˜¹$
729e4ab9
A
221#
222# Fixing may entail modifying CLDR source data or tools - for example,
57a6839d
A
223# updating the validSubLocales for collation data (file a bug if appropriate).
224# Repeat steps 4-5 until there are no build errors and no unexpected
729e4ab9
A
225# warnings.
226
57a6839d 227# 7. Now rebuild ICU4C with the new data and run make check tests.
729e4ab9 228# Again, keep a log so you can investigate the errors.
729e4ab9 229cd $ICU4C_DIR/source
3d1f044b
A
230
231# 7a. If any files were added or removed (likely), re-run configure:
232./runConfigureICU <platform>
233make clean
234
235# 7b. Now do the rebuild.
729e4ab9
A
236make check 2>&1 | tee /tmp/icu4c-newData-makeCheck.txt
237
57a6839d 238# 8. Investigate each test case failure. The first run processing new CLDR data
729e4ab9 239# from the Survey Tool can result in thousands of failures (in many cases, one
51004dcb 240# CLDR data fix can resolve hundreds of test failures). If the error is caused
729e4ab9 241# by bad CLDR data, then file a CLDR bug, fix the data, and regenerate from
57a6839d 242# step 4. If the data is OK but the testcase needs to be updated because the
729e4ab9
A
243# data has legitimately changed, then update the testcase. You will check in
244# the updated testcases along with the new ICU data at the end of this process.
51004dcb
A
245# Note that if the new data has any differences in structure, you will have to
246# update test/testdata/structLocale.txt or /tsutil/cldrtest/TestLocaleStructure
247# may fail.
57a6839d 248# Repeat steps 4-7 until there are no errors.
729e4ab9 249
57a6839d 250# 9. Now run the make check tests in exhaustive mode:
729e4ab9
A
251
252cd $ICU4C_DIR/source
253export INTLTEST_OPTS="-e"
254export CINTLTST_OPTS="-e"
255make check 2>&1 | tee /tmp/icu4c-newData-makeCheckEx.txt
256
57a6839d
A
257# 10. Again, investigate each failure, fixing CLDR data or ICU test cases as
258# appropriate, and repeating steps 4-7 and 9 until there are no errors.
729e4ab9 259
57a6839d 260# 11. Now with ICU4J, build and test without new data first, to verify that
729e4ab9
A
261# there are no pre-existing errors (or at least to have the pre-existing errors
262# as a base for comparison):
263
264cd $ICU4J_ROOT
265ant all 2>&1 | tee /tmp/icu4j-oldData-antAll.txt
266ant check 2>&1 | tee /tmp/icu4j-oldData-antCheck.txt
267
3d1f044b
A
268# 12. Transfer the data to ICU4J:
269cd $ICU4C_DIR/source
270
271# 12a. You need to reconfigure ICU4C to include the unicore data.
272ICU_DATA_BUILDTOOL_OPTS=--include_uni_core_data ./runConfigureICU <platform>
729e4ab9 273
3d1f044b 274# 12b. Now build the jar files.
729e4ab9 275cd $ICU4C_DIR/source/data
3d1f044b
A
276# The following 2 lines are required to include the unicore data:
277 make clean
278 make -j6
729e4ab9 279make icu4j-data-install
f3c0d7a5
A
280cd $ICU4C_DIR/source/test/testdata
281make icu4j-data-install
729e4ab9 282
57a6839d 283# 13. Now rebuild ICU4J with the new data and run tests:
729e4ab9
A
284# Keep a log so you can investigate the errors.
285
286cd $ICU4J_ROOT
287ant check 2>&1 | tee /tmp/icu4j-newData-antCheck.txt
288
57a6839d 289# 14. Investigate test case failures; fix test cases and repeat from step 12,
3d1f044b 290# or fix CLDR data and repeat from step 4, as appropriate, until there are no
729e4ab9
A
291# more failures in ICU4C or ICU4J (except failures that were present before you
292# began testing the new CLDR data).
293
3d1f044b 294# 15. Check the file changes; then git add or git rm as necessary, and
729e4ab9
A
295# commit the changes.
296
3d1f044b
A
297cd $HOME/icu/
298cd ..
299git status
f3c0d7a5 300# add or remove as necessary
f3c0d7a5 301# commit
729e4ab9 302
f3c0d7a5
A
303# 16. For an official CLDR data integration into ICU, now tag the CLDR and
304# ICU sources with an appropriate CLDR milestone (you can check previous
729e4ab9
A
305# tags for format), e.g.:
306
307svn copy svn+ssh://unicode.org/repos/cldr/trunk \
308svn+ssh://unicode.org/repos/cldr/tags/release-NNN \
309--parents -m "cldrbug nnnn: tag cldr sources for NNN"
310
3d1f044b
A
311cd $HOME/icu/
312git tag ...
313
729e4ab9 314