doc: Update tools/icu/README.md

- remove TODOs: the one about defaults has been
addressed, and the one about testing is a work
item that doesn't belong in a doc.
- add some background information

Fixes: https://github.com/nodejs/node/issues/7843

PR-URL: https://github.com/nodejs/node/pull/16939
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
This commit is contained in:
Steven R. Loomis 2017-11-10 10:40:55 -08:00
parent 4a498335f5
commit 07712d1eb8
No known key found for this signature in database
GPG Key ID: 3932080F4FB419E3

View File

@ -1,4 +1,15 @@
# Notes about the icu directory. # Notes about the `tools/icu` subdirectory
This directory contains tools, data, and information about the [http://icu-project.org](ICU) (International Components for Unicode) integration. ICU is used to provide internationalization functionality.
- `patches/` are one-off patches, actually entire source file replacements, organized by ICU version number.
- `icu_small.json` controls the "small" (English only) ICU. It is input to `icutrim.py`
- `icu-generic.gyp` is the build file used for most ICU builds within ICU. <!-- have fun -->
- `icu-system.gyp` is an alternate build file used when `--with-intl=system-icu` is invoked. It builds against the `pkg-config` located ICU.
- `iculslocs.cc` is source for the `iculslocs` utility, invoked by `icutrim.py` as part of repackaging. Not used separately. See source for more details.
- `no-op.cc` — empty function to convince gyp to use a C++ compiler.
- `README.md` — you are here
- `shrink-icu-src.py` — this is used during upgrade (see guide below)
## How to upgrade ICU ## How to upgrade ICU
@ -12,13 +23,13 @@
make make
``` ```
(The equivalent `vcbuild.bat` commands should work also. Note that we use the `.tgz` and not the `.zip` here, > _Note_ in theory, the equivalent `vcbuild.bat` commands should work also,
that is because of line endings.) but the commands below are makefile-centric.
- (note- may need to make changes in `icu-generic.gyp` or `tools/icu/patches` for - If there are ICU version-specific changes needed, you may need to make changes in `icu-generic.gyp` or add patch files to `tools/icu/patches`.
version specific stuff) - Specifically, look for the lists in `sources!` in the `icu-generic.gyp` for files to exclude.
- Verify the node build works - Verify the node build works:
```shell ```shell
make test-ci make test-ci
@ -27,13 +38,12 @@ make test-ci
Also running Also running
<!-- eslint-disable strict --> <!-- eslint-disable strict -->
```js ```js
new Intl.DateTimeFormat('es', {month: 'long'}).format(new Date(9E8)); new Intl.DateTimeFormat('es', {month: 'long'}).format(new Date(9E8));
``` ```
…Should return `January` not `enero`. …Should return `January` not `enero`.
(TODO here: improve [testing](https://github.com/nodejs/Intl/issues/16))
- Now, copy `deps/icu` over to `deps/icu-small` - Now, copy `deps/icu` over to `deps/icu-small`
@ -43,25 +53,25 @@ python tools/icu/shrink-icu-src.py
- Now, do a clean rebuild of node to test: - Now, do a clean rebuild of node to test:
(TODO: fix this when these options become default)
```shell ```shell
./configure --with-intl=small-icu --with-icu-source=deps/icu-small make -k distclean
./configure
make make
``` ```
- Test this newly default-generated Node.js - Test this newly default-generated Node.js
<!-- eslint-disable strict --> <!-- eslint-disable strict -->
```js ```js
process.versions.icu; process.versions.icu;
new Intl.DateTimeFormat('es', {month: 'long'}).format(new Date(9E8)); new Intl.DateTimeFormat('es', {month: 'long'}).format(new Date(9E8));
``` ```
(should return your updated ICU version number, and also `January` again.) (This should print your updated ICU version number, and also `January` again.)
- You are ready to check in the updated `deps/small-icu`. You are ready to check in the updated `deps/small-icu`. This is a big commit,
This is a big commit, so make this a separate commit from other changes. so make this a separate commit from the smaller changes.
- Now, rebuild the Node license. - Now, rebuild the Node license.
@ -85,22 +95,23 @@ make test-ci
- commit the change to `configure` along with the updated `LICENSE` file. - commit the change to `configure` along with the updated `LICENSE` file.
- Note: To simplify review, I often will “pre-land” this patch, meaning that I run the patch through `curl -L https://github.com/nodejs/node/pull/xxx.patch | git am -3 --whitespace=fix` per the collaborators guide… and then push that patched branch into my PR's branch. This reduces the whitespace changes that show up in the PR, since the final land will eliminate those anyway.
----- -----
## Notes about these tools ## Postscript about the tools
The files in this directory were written for the node.js effort. It's The files in this directory were written for the node.js effort.
the intent of their author (Steven R. Loomis / srl295) to merge them It was the intent of their author (Steven R. Loomis / srl295) to
upstream into ICU, pending much discussion within the ICU-PMC. merge them upstream into ICU, pending much discussion within the
ICU-TC.
`icu_small.json` is somewhat node-specific as it specifies a "small ICU" `icu_small.json` is somewhat node-specific as it specifies a "small ICU"
configuration file for the `icutrim.py` script. `icutrim.py` and configuration file for the `icutrim.py` script. `icutrim.py` and
`iculslocs.cpp` may themselves be superseded by components built into `iculslocs.cpp` may themselves be superseded by components built into
ICU in the future. ICU in the future. As of this writing, however, the tools are separate
entities within Node, although theyare being scrutinized by interested
The following tickets were opened during this work, and their members of the ICU-TC. The “upstream” ICU bugs are given below.
resolution may inform the reader as to the current state of icu-trim
upstream:
* [#10919](http://bugs.icu-project.org/trac/ticket/10919) * [#10919](http://bugs.icu-project.org/trac/ticket/10919)
(experimental branch - may copy any source patches here) (experimental branch - may copy any source patches here)
@ -108,7 +119,3 @@ upstream:
(data packaging improvements) (data packaging improvements)
* [#10923](http://bugs.icu-project.org/trac/ticket/10923) * [#10923](http://bugs.icu-project.org/trac/ticket/10923)
(rewrite data building in python) (rewrite data building in python)
When/if components (not including the `.json` file) are merged into
ICU, this code and `configure` will be updated to detect and use those
variants rather than the ones in this directory.