2 # This Source Code Form is subject to the terms of the Mozilla Public
3 # License, v. 2.0. If a copy of the MPL was not distributed with this
4 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 # Update the icu4x binary data for a given release:
9 # Usage: update-icu4x.sh <URL of ICU GIT> <release tag name>
10 # update-icu4x.sh https://github.com/unicode-org/icu4x.git icu@0.3.0
12 # Update to the main branch:
13 # Usage: update-icu4x.sh <URL of ICU GIT> <branch>
14 # update-icu4x.sh https://github.com/unicode-org/icu4x.git main
17 echo "Usage: update-icu4x.sh <URL of ICU4X GIT> <release tag name> <CLDR version>"
18 echo "Example: update-icu4x.sh https://github.com/unicode-org/icu4x.git icu@0.3.0 39.0.0"
22 # Make a log function so the output is easy to read.
26 printf "${CYAN}[update-icu4x]${CLEAR} $*\n"
29 # Specify locale and time zone information for consistent output and reproduceability.
31 export LANG
=en_US.UTF-8
33 export LC_ALL
=en_US.UTF-8
35 # Define all of the paths.
37 top_src_dir
=$
(cd -- "$(dirname "$0")/.." >/dev
/null
2>&1 ; pwd -P)
38 data_dir
=${top_src_dir}/config
/external
/icu4x
39 data_file
=${data_dir}/icu4x.postcard
40 git_info_file
=${data_dir}/ICU4X-GIT-INFO
42 log
"Remove the old data"
46 tmpclonedir
=$
(mktemp
-d)
47 git clone
--depth 1 --branch $2 $1 ${tmpclonedir}
49 log
"Change the directory to the cloned repo"
53 log
"Run the icu4x-datagen tool to regenerate the data."
54 log
"Saving the data to: ${data_file}"
56 # TODO(Bug 1741262) - Should locales be filtered as well? It doesn't appear that the existing ICU
57 # data builder is using any locale filtering.
59 # TODO(Bug 1741264) - Keys are not supported yet: https://github.com/unicode-org/icu4x/issues/192
61 # Include this resource key in the output. Accepts multiple arguments.
62 # --key-file <KEY_FILE>
63 # Path to text file with resource keys to include, one per line. Empty lines and
64 # lines starting with '#' are ignored.
65 cargo run
--bin icu4x-datagen
-- \
73 log
"Record the current cloned git information to:"
75 # (This ensures that if ICU modifications are performed properly, it's always
76 # possible to run the command at the top of this script and make no changes to
78 git
-C ${tmpclonedir} log
-1 > ${git_info_file}
80 log
"Clean up the tmp directory"