]>
Commit | Line | Data |
---|---|---|
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 | 11 | # - ICU4C (the destination for the new data, and the source for some of it) |
51004dcb A |
12 | # (Either check out ICU4C from Subversion, or download the additional |
13 | # icu4c-*-data.zip file so that the icu/source/data/ directory is fully | |
14 | # populated.) | |
729e4ab9 A |
15 | # |
16 | # For an official CLDR data integration into ICU, these should be clean, freshly | |
17 | # checked-out. For released CLDR sources, an alternative to checking out sources | |
18 | # for a given version is downloading the zipped sources for the common (core.zip) | |
19 | # and tools (tools.zip) directory subtrees from the Data column in | |
20 | # [http://cldr.unicode.org/index/downloads]. | |
21 | # | |
22 | # The versions of each of these must match. Included with the release notes for | |
23 | # ICU is the version number and/or a CLDR svn tag name for the revision of CLDR | |
24 | # that was the source of the data for that release of ICU. | |
25 | # | |
26 | # Note: Some versions of the OpenJDK will not build the CLDR java utilities. | |
27 | # If you see compilation errors complaining about type incompatibilities with | |
28 | # functions on generic classes, try switching to the Sun JDK. | |
29 | # | |
30 | # Besides a standard JDK, the process also requires ant | |
31 | # (http://ant.apache.org/), | |
32 | # plus the xml-apis.jar from the Apache xalan package | |
33 | # (http://xml.apache.org/xalan-j/downloads.html). | |
34 | # | |
35 | # Note: Enough things can (and will) fail in this process that it is best to | |
36 | # run the commands separately from an interactive shell. They should all | |
37 | # copy and paste without problems. | |
38 | # | |
39 | # It is often useful to save logs of the output of many of the steps in this | |
40 | # process. The commands below put log files in /tmp; you may want to put them | |
41 | # somewhere else. | |
42 | # | |
43 | #---- | |
44 | # | |
0f5d89e8 A |
45 | # IP address whitelisting |
46 | # | |
47 | # Parts of the build process (notably building the new ICU data filescin step 4) | |
48 | # require http: access to files in the CLDR repository; for example, processing | |
49 | # the files in icu4c/source/data/xml/ may require access to | |
50 | # http://www.unicode.org/repos/cldr/trunk/common/dtd/ldml.dtd | |
51 | # | |
52 | # The IP address of the system requesting such access be whitelisted with Unicode, | |
53 | # otherwise there may be timeout failures; contact Rick McGowan. | |
54 | # | |
55 | #---- | |
56 | # | |
729e4ab9 A |
57 | # There are several environment variables that need to be defined. |
58 | # | |
59 | # a) Java- and ant-related variables | |
60 | # | |
61 | # JAVA_HOME: Path to JDK (a directory, containing e.g. bin/java, bin/javac, | |
62 | # etc.); on many systems this can be set using | |
63 | # `/usr/libexec/java_home`. | |
64 | # | |
57a6839d | 65 | # ANT_OPTS: You may want to set: |
729e4ab9 | 66 | # |
f3c0d7a5 | 67 | # -Xmx3072m, to give Java more memory; otherwise it may run out |
729e4ab9 A |
68 | # of heap. |
69 | # | |
729e4ab9 A |
70 | # b) CLDR-related variables |
71 | # | |
72 | # CLDR_DIR: Path to root of CLDR sources, below which are the common and | |
57a6839d A |
73 | # tools directories. |
74 | # CLDR_CLASSES: Defined relative to CLDR_DIR. It only needs to be set if you | |
75 | # are not running ant jar for CLDR and have a non-default output | |
76 | # folder for cldr-tools classes. | |
729e4ab9 | 77 | # |
57a6839d A |
78 | # c) ICU-related variables |
79 | # These variables only need to be set if you're directly reusing the | |
80 | # commands below. | |
729e4ab9 A |
81 | # |
82 | # ICU4C_DIR: Path to root of ICU4C sources, below which is the source dir. | |
83 | # | |
84 | # ICU4J_ROOT: Path to root of ICU4J sources, below which is the main dir. | |
729e4ab9 A |
85 | # |
86 | #---- | |
87 | # | |
88 | # If you are adding or removing locales, or specific kinds of locale data, | |
89 | # there are some xml files in the ICU sources that need to be updated (these xml | |
90 | # files are used in addition to the CLDR files as inputs to the CLDR data build | |
91 | # process for ICU): | |
92 | # | |
0f5d89e8 | 93 | # icu4c/source/data/icu-config.xml - Update <locales> to add or remove |
729e4ab9 A |
94 | # CLDR locales for inclusion in ICU. Update <paths> to prefer |
95 | # alt forms for certain paths, or to exclude certain paths; note | |
96 | # that <paths> items can only have draft or alt attributes. | |
97 | # | |
51004dcb A |
98 | # Note that if a language-only locale (e.g. "de") is included in |
99 | # <locales>, then all region sublocales for that language that | |
100 | # are present in CLDR data (e.g. "de_AT", "de_BE", "de_CH", etc.) | |
101 | # should also be included in <locales>, per PMC policy decision | |
102 | # 2012-05-02 (see http://bugs.icu-project.org/trac/ticket/9298). | |
103 | # | |
0f5d89e8 | 104 | # icu4c/source/data/build.xml - If you are adding or removing break |
729e4ab9 A |
105 | # iterators, you need to update <fileset id="brkitr" ...> under |
106 | # <target name="clean" ...> to clean the correct set of files. | |
107 | # | |
0f5d89e8 | 108 | # icu4c/source/data/xml/ - If you are adding a new locale, break |
57a6839d A |
109 | # iterator, collation tailoring, or rule-based number formatter, |
110 | # you may need to add a corresponding xml file in (respectively) | |
111 | # the main/, brkitr/, collation/, or rbnf/ subdirectory here. | |
729e4ab9 A |
112 | # |
113 | #---- | |
114 | # | |
115 | # For an official CLDR data integration into ICU, there are some additional | |
116 | # considerations: | |
117 | # | |
118 | # a) Don't commit anything in ICU sources (and possibly any changes in CLDR | |
119 | # sources, depending on their nature) until you have finished testing and | |
120 | # resolving build issues and test failures for both ICU4C and ICU4J. | |
121 | # | |
122 | # b) There are version numbers that may need manual updating in CLDR (other | |
123 | # version numbers get updated automatically, based on these): | |
124 | # | |
125 | # common/dtd/ldml.dtd - update cldrVersion | |
126 | # common/dtd/ldmlBCP47.dtd - update cldrVersion | |
127 | # common/dtd/ldmlSupplemental.dtd - update cldrVersion | |
128 | # tools/java/org/unicode/cldr/util/CLDRFile.java - update GEN_VERSION | |
129 | # | |
130 | # c) After everything is committed, you will need to tag the CLDR, ICU4J, and | |
131 | # ICU4C sources that ended up being used for the integration; see step 17 | |
132 | # below. | |
133 | # | |
134 | ################################################################################ | |
135 | ||
136 | # 1a. Java and ant variables, adjust for your system | |
729e4ab9 A |
137 | |
138 | export JAVA_HOME=`/usr/libexec/java_home` | |
f3c0d7a5 | 139 | export ANT_OPTS="-Xmx3072m" |
729e4ab9 A |
140 | |
141 | # 1b. CLDR variables, adjust for your setup; with cygwin it might be e.g. | |
142 | # CLDR_DIR=`cygpath -wp /build/cldr` | |
143 | ||
144 | export CLDR_DIR=$HOME/cldr/trunk | |
729e4ab9 A |
145 | #export CLDR_CLASSES=$CLDR_DIR/tools/java/classes |
146 | ||
147 | # 1c. ICU variables | |
148 | ||
f3c0d7a5 A |
149 | export ICU4C_DIR=$HOME/icu/trunk/icu4c |
150 | export ICU4J_ROOT=$HOME/icu/trunk/icu4j | |
729e4ab9 | 151 | |
57a6839d | 152 | # 2. Build the CLDR Java tools |
729e4ab9 A |
153 | |
154 | cd $CLDR_DIR/tools/java | |
155 | ant jar | |
156 | ||
57a6839d | 157 | # 3. Configure ICU4C, build and test without new data first, to verify that |
729e4ab9 A |
158 | # there are no pre-existing errors (configure shown here for MacOSX, adjust |
159 | # for your platform). | |
160 | ||
161 | cd $ICU4C_DIR/source | |
162 | ./runConfigureICU MacOSX | |
163 | make all 2>&1 | tee /tmp/icu4c-oldData-makeAll.txt | |
164 | make check 2>&1 | tee /tmp/icu4c-oldData-makeCheck.txt | |
165 | ||
57a6839d | 166 | # 4. Build the new ICU4C data files; these include .txt files and .mk files. |
729e4ab9 A |
167 | # These new files will replace whatever was already present in the ICU4C sources. |
168 | # This process uses ant with ICU's data/build.xml and data/icu-config.xml to | |
169 | # operate (via CLDR's ant/CLDRConverterTool.java and ant/CLDRBuild.java) the | |
170 | # necessary CLDR tools including LDML2ICUConverter, ConvertTransforms, etc. | |
57a6839d | 171 | # This process will take several minutes. |
729e4ab9 | 172 | # Keep a log so you can investigate anything that looks suspicious. |
0f5d89e8 A |
173 | # |
174 | # If you see timeout errors when building the rbnf data, for example, then the | |
175 | # system you are building on likely does not have its IP address whitelisted with | |
176 | # Unicode for access to the CLDR repository, see note on "IP address whitelisting" | |
177 | # near the top of this file. | |
729e4ab9 A |
178 | |
179 | cd $ICU4C_DIR/source/data | |
180 | ant clean | |
f3c0d7a5 | 181 | ant all 2>&1 | tee /tmp/cldr-newData-buildLog.txt |
729e4ab9 | 182 | |
57a6839d | 183 | # 5. Check which data files have modifications, which have been added or removed |
729e4ab9 A |
184 | # (if there are no changes, you may not need to proceed further). Make sure the |
185 | # list seems reasonable. | |
186 | ||
187 | svn status | |
188 | ||
57a6839d | 189 | # 6. Fix any errors, investigate any warnings. Some warnings are expected, |
729e4ab9 A |
190 | # including warnings for missing versions in locale names which specify some |
191 | # collationvariants, e.g. | |
192 | # [cldr-build] WARNING (ja_JP_TRADITIONAL): No version #?? | |
193 | # [cldr-build] WARNING (zh_TW_STROKE): No version #?? | |
194 | # and warnings for some empty collation bundles, e.g. | |
195 | # [cldr-build] WARNING (en): warning: No collations found. Bundle will ... | |
196 | # [cldr-build] WARNING (to): warning: No collations found. Bundle will ... | |
197 | # | |
198 | # Fixing may entail modifying CLDR source data or tools - for example, | |
57a6839d A |
199 | # updating the validSubLocales for collation data (file a bug if appropriate). |
200 | # Repeat steps 4-5 until there are no build errors and no unexpected | |
729e4ab9 A |
201 | # warnings. |
202 | ||
57a6839d | 203 | # 7. Now rebuild ICU4C with the new data and run make check tests. |
729e4ab9 A |
204 | # Again, keep a log so you can investigate the errors. |
205 | ||
206 | cd $ICU4C_DIR/source | |
207 | make check 2>&1 | tee /tmp/icu4c-newData-makeCheck.txt | |
208 | ||
57a6839d | 209 | # 8. Investigate each test case failure. The first run processing new CLDR data |
729e4ab9 | 210 | # from the Survey Tool can result in thousands of failures (in many cases, one |
51004dcb | 211 | # CLDR data fix can resolve hundreds of test failures). If the error is caused |
729e4ab9 | 212 | # by bad CLDR data, then file a CLDR bug, fix the data, and regenerate from |
57a6839d | 213 | # step 4. If the data is OK but the testcase needs to be updated because the |
729e4ab9 A |
214 | # data has legitimately changed, then update the testcase. You will check in |
215 | # the updated testcases along with the new ICU data at the end of this process. | |
51004dcb A |
216 | # Note that if the new data has any differences in structure, you will have to |
217 | # update test/testdata/structLocale.txt or /tsutil/cldrtest/TestLocaleStructure | |
218 | # may fail. | |
57a6839d | 219 | # Repeat steps 4-7 until there are no errors. |
729e4ab9 | 220 | |
57a6839d | 221 | # 9. Now run the make check tests in exhaustive mode: |
729e4ab9 A |
222 | |
223 | cd $ICU4C_DIR/source | |
224 | export INTLTEST_OPTS="-e" | |
225 | export CINTLTST_OPTS="-e" | |
226 | make check 2>&1 | tee /tmp/icu4c-newData-makeCheckEx.txt | |
227 | ||
57a6839d A |
228 | # 10. Again, investigate each failure, fixing CLDR data or ICU test cases as |
229 | # appropriate, and repeating steps 4-7 and 9 until there are no errors. | |
729e4ab9 | 230 | |
57a6839d | 231 | # 11. Now with ICU4J, build and test without new data first, to verify that |
729e4ab9 A |
232 | # there are no pre-existing errors (or at least to have the pre-existing errors |
233 | # as a base for comparison): | |
234 | ||
235 | cd $ICU4J_ROOT | |
236 | ant all 2>&1 | tee /tmp/icu4j-oldData-antAll.txt | |
237 | ant check 2>&1 | tee /tmp/icu4j-oldData-antCheck.txt | |
238 | ||
f3c0d7a5 | 239 | # 12. Now build the new data and test data for ICU4J |
729e4ab9 A |
240 | |
241 | cd $ICU4C_DIR/source/data | |
242 | make icu4j-data-install | |
f3c0d7a5 A |
243 | cd $ICU4C_DIR/source/test/testdata |
244 | make icu4j-data-install | |
729e4ab9 | 245 | |
57a6839d | 246 | # 13. Now rebuild ICU4J with the new data and run tests: |
729e4ab9 A |
247 | # Keep a log so you can investigate the errors. |
248 | ||
249 | cd $ICU4J_ROOT | |
250 | ant check 2>&1 | tee /tmp/icu4j-newData-antCheck.txt | |
251 | ||
57a6839d A |
252 | # 14. Investigate test case failures; fix test cases and repeat from step 12, |
253 | # or fix CLDR data and repeat from step 4, as appropriate, until; there are no | |
729e4ab9 A |
254 | # more failures in ICU4C or ICU4J (except failures that were present before you |
255 | # began testing the new CLDR data). | |
256 | ||
57a6839d | 257 | # 15. Check the file changes; then svn add or svn remove as necessary, and |
729e4ab9 A |
258 | # commit the changes. |
259 | ||
57a6839d | 260 | cd $ICU4C_DIR/source |
729e4ab9 | 261 | svn status |
f3c0d7a5 | 262 | # add or remove as necessary |
729e4ab9 A |
263 | |
264 | cd $ICU4J_ROOT | |
265 | svn status | |
f3c0d7a5 A |
266 | # add or remove as necessary |
267 | ||
268 | cd $HOME/icu/trunk/ | |
269 | # commit | |
729e4ab9 | 270 | |
f3c0d7a5 A |
271 | # 16. For an official CLDR data integration into ICU, now tag the CLDR and |
272 | # ICU sources with an appropriate CLDR milestone (you can check previous | |
729e4ab9 A |
273 | # tags for format), e.g.: |
274 | ||
275 | svn copy svn+ssh://unicode.org/repos/cldr/trunk \ | |
276 | svn+ssh://unicode.org/repos/cldr/tags/release-NNN \ | |
277 | --parents -m "cldrbug nnnn: tag cldr sources for NNN" | |
278 | ||
f3c0d7a5 A |
279 | svn copy svn+ssh://source.icu-project.org/repos/icu/trunk \ |
280 | svn+ssh://source.icu-project.org/repos/icu/tags/cldr-NNN \ | |
729e4ab9 A |
281 | --parents -m 'ticket:mmmm: tag the version used for integrating CLDR NNN' |
282 |