Bug 1826905 [wpt PR 39420] - view-transition: Add WPTs for damage tracking when new...
[gecko.git] / intl / update-icu4x.sh
blobfdb2a20c0552a306ecec0e513b9ba2ca41df29a6
1 #!/bin/sh
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/.
6 set -e
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
16 if [ $# -lt 2 ]; then
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"
19 exit 1
22 # Make a log function so the output is easy to read.
23 log() {
24 CYAN='\033[0;36m'
25 CLEAR='\033[0m'
26 printf "${CYAN}[update-icu4x]${CLEAR} $*\n"
29 # Specify locale and time zone information for consistent output and reproduceability.
30 export TZ=UTC
31 export LANG=en_US.UTF-8
32 export LANGUAGE=en_US
33 export LC_ALL=en_US.UTF-8
35 # Define all of the paths.
36 original_pwd=$(pwd)
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"
43 rm -f ${data_file}
45 log "Clone ICU4X"
46 tmpclonedir=$(mktemp -d)
47 git clone --depth 1 --branch $2 $1 ${tmpclonedir}
49 log "Change the directory to the cloned repo"
50 log ${tmpclonedir}
51 cd ${tmpclonedir}
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
60 # --keys <KEYS>...
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 -- \
66 --cldr-tag $3 \
67 --all-keys \
68 --all-locales \
69 --format blob \
70 --out ${data_file} \
71 -v \
73 log "Record the current cloned git information to:"
74 log ${git_info_file}
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
77 # the tree.)
78 git -C ${tmpclonedir} log -1 > ${git_info_file}
80 log "Clean up the tmp directory"
81 cd ${original_pwd}
82 rm -rf ${tmpclonedir}