1*0e209d39SAndroid Build Coastguard Worker# ICU version upgrade 2*0e209d39SAndroid Build Coastguard Worker 3*0e209d39SAndroid Build Coastguard WorkerUpgrade the ICU on Android to the new upstream version. The new upstream versions can be found at 4*0e209d39SAndroid Build Coastguard Workerhttps://github.com/unicode-org/icu/releases. 5*0e209d39SAndroid Build Coastguard Worker 6*0e209d39SAndroid Build Coastguard WorkerThe below contains the steps and commands in order to upgrade the ICU version in the AOSP. 7*0e209d39SAndroid Build Coastguard Worker 8*0e209d39SAndroid Build Coastguard Worker# Prerequisites 9*0e209d39SAndroid Build Coastguard Worker1. Install the prerequisite tools 10*0e209d39SAndroid Build Coastguard Worker * See http://site.icu-project.org/repository 11*0e209d39SAndroid Build Coastguard Worker * [git-lts](https://git-lfs.github.com/) has to be installed to pull binaries correctly from the github. 12*0e209d39SAndroid Build Coastguard Worker2. Generate a github read-access token and setup a local ~/.m2/setting.xml 13*0e209d39SAndroid Build Coastguard Worker * See http://cldr.unicode.org/development/maven. This is required to download 14*0e209d39SAndroid Build Coastguard Worker the prebuilt ICU to break the circular dependency between CLDR and icu. 15*0e209d39SAndroid Build Coastguard Worker3. Check out aosp/main 16*0e209d39SAndroid Build Coastguard Worker * http://go/repo-init/aosp-main-with-phones 17*0e209d39SAndroid Build Coastguard Worker 18*0e209d39SAndroid Build Coastguard Worker# Steps 19*0e209d39SAndroid Build Coastguard Worker1. Create a new branch in AOSP 20*0e209d39SAndroid Build Coastguard Worker * The branch is a staging branch to **rebase** Android-specific patches onto the new upstream versions. 21*0e209d39SAndroid Build Coastguard Worker * See detailed instruction at http://g3doc/company/teams/android-build-team/playbook/create_branch#creating-new-git-branches. 22*0e209d39SAndroid Build Coastguard Worker * **Choose a branch name** 23*0e209d39SAndroid Build Coastguard Worker * Create aosp/icu{version} branch, e.g. `aosp/icu67` in the `external/icu` project 24*0e209d39SAndroid Build Coastguard Worker forked from `aosp/main` 25*0e209d39SAndroid Build Coastguard Worker * For the external/cldr project, we don't need a new branch. 26*0e209d39SAndroid Build Coastguard Worker We use the **`aosp/upstream-release-cldr** as the mirror of the upstream release branch. 27*0e209d39SAndroid Build Coastguard Worker We don’t modify this branch with Android patches, but merge this branch 28*0e209d39SAndroid Build Coastguard Worker into aosp/main where the Android patches are located. 29*0e209d39SAndroid Build Coastguard Worker2. Configure the versions and temp directory 30*0e209d39SAndroid Build Coastguard Worker 31*0e209d39SAndroid Build Coastguard Worker 2a. Customize the following environment variables. 32*0e209d39SAndroid Build Coastguard Worker The following example targets the ICU 71.1 and CLDR 41.0 version. 33*0e209d39SAndroid Build Coastguard Worker ```shell 34*0e209d39SAndroid Build Coastguard Worker export ICU_VERSION=71 35*0e209d39SAndroid Build Coastguard Worker export ICU_MINOR_VERSION=1 36*0e209d39SAndroid Build Coastguard Worker export CLDR_VERSION=41 37*0e209d39SAndroid Build Coastguard Worker export ICU_UPGRADE_BUG=1234567890 # buganizer bug 38*0e209d39SAndroid Build Coastguard Worker # Initially empty directory to store upstream source 39*0e209d39SAndroid Build Coastguard Worker export UPSTREAM_CLDR_GIT=/media/user/disk/icu-git/cldr 40*0e209d39SAndroid Build Coastguard Worker export UPSTREAM_ICU_GIT=/media/user/disk/icu-git/icu 41*0e209d39SAndroid Build Coastguard Worker ``` 42*0e209d39SAndroid Build Coastguard Worker 43*0e209d39SAndroid Build Coastguard Worker 2b. Build the clean source of AOSP 44*0e209d39SAndroid Build Coastguard Worker ```shell 45*0e209d39SAndroid Build Coastguard Worker source build/envsetup.sh 46*0e209d39SAndroid Build Coastguard Worker lunch sdk_phone_x86_64-userdebug 47*0e209d39SAndroid Build Coastguard Worker m 48*0e209d39SAndroid Build Coastguard Worker ``` 49*0e209d39SAndroid Build Coastguard Worker3. Copy the CLDR sources into the `upstream-release-cldr` branch 50*0e209d39SAndroid Build Coastguard Worker 51*0e209d39SAndroid Build Coastguard Worker 3a. Copy sources 52*0e209d39SAndroid Build Coastguard Worker ```shell 53*0e209d39SAndroid Build Coastguard Worker export CLDR_UPSTREAM_BRANCH=release-${CLDR_VERSION} 54*0e209d39SAndroid Build Coastguard Worker 55*0e209d39SAndroid Build Coastguard Worker cd ${ANDROID_BUILD_TOP}/external/cldr 56*0e209d39SAndroid Build Coastguard Worker git fetch aosp upstream-release-cldr 57*0e209d39SAndroid Build Coastguard Worker git branch ${CLDR_UPSTREAM_BRANCH} --track aosp/upstream-release-cldr 58*0e209d39SAndroid Build Coastguard Worker git checkout ${CLDR_UPSTREAM_BRANCH} 59*0e209d39SAndroid Build Coastguard Worker 60*0e209d39SAndroid Build Coastguard Worker git clone https://github.com/unicode-org/cldr.git ${UPSTREAM_CLDR_GIT} 61*0e209d39SAndroid Build Coastguard Worker 62*0e209d39SAndroid Build Coastguard Worker git --git-dir=${UPSTREAM_CLDR_GIT}/.git --work-tree=${UPSTREAM_CLDR_GIT} fetch 63*0e209d39SAndroid Build Coastguard Worker git --git-dir=${UPSTREAM_CLDR_GIT}/.git --work-tree=${UPSTREAM_CLDR_GIT} checkout ${CLDR_UPSTREAM_BRANCH} 64*0e209d39SAndroid Build Coastguard Worker rm -rf * 65*0e209d39SAndroid Build Coastguard Worker cp -r ${UPSTREAM_CLDR_GIT}/* . 66*0e209d39SAndroid Build Coastguard Worker git clean -dfX # Remove ignored files 67*0e209d39SAndroid Build Coastguard Worker git add -A 68*0e209d39SAndroid Build Coastguard Worker git commit -F- <<EOF 69*0e209d39SAndroid Build Coastguard Worker Copy upstream ${CLDR_UPSTREAM_BRANCH} 70*0e209d39SAndroid Build Coastguard Worker 71*0e209d39SAndroid Build Coastguard Worker Bug: ${ICU_UPGRADE_BUG} 72*0e209d39SAndroid Build Coastguard Worker Test: n/a 73*0e209d39SAndroid Build Coastguard Worker EOF 74*0e209d39SAndroid Build Coastguard Worker # Upload this CL to upstream-release-cldr branch 75*0e209d39SAndroid Build Coastguard Worker repo upload --cbr . 76*0e209d39SAndroid Build Coastguard Worker ``` 77*0e209d39SAndroid Build Coastguard Worker 78*0e209d39SAndroid Build Coastguard Worker 3b. Merge the upstream sources with patches in `aosp/main` 79*0e209d39SAndroid Build Coastguard Worker ```shell 80*0e209d39SAndroid Build Coastguard Worker export CLDR_BRANCH=cldr${CLDR_VERSION}-main 81*0e209d39SAndroid Build Coastguard Worker git branch ${CLDR_BRANCH} --track aosp/main 82*0e209d39SAndroid Build Coastguard Worker git checkout ${CLDR_BRANCH} 83*0e209d39SAndroid Build Coastguard Worker git merge ${CLDR_UPSTREAM_BRANCH} -m " 84*0e209d39SAndroid Build Coastguard Worker Merge CLDR ${CLDR_VERSION} in upstream-release-cldr into aosp/main 85*0e209d39SAndroid Build Coastguard Worker 86*0e209d39SAndroid Build Coastguard Worker Bug: ${ICU_UPGRADE_BUG} 87*0e209d39SAndroid Build Coastguard Worker Test: external/icu/tools/updatecldrdata.py 88*0e209d39SAndroid Build Coastguard Worker " 89*0e209d39SAndroid Build Coastguard Worker ``` 90*0e209d39SAndroid Build Coastguard Worker 91*0e209d39SAndroid Build Coastguard Worker 3c. Resolve any merge conflicts with the Android-specific patches. 92*0e209d39SAndroid Build Coastguard Worker Continue creating the merge commit 93*0e209d39SAndroid Build Coastguard Worker ```shell 94*0e209d39SAndroid Build Coastguard Worker git merge --continue 95*0e209d39SAndroid Build Coastguard Worker ``` 96*0e209d39SAndroid Build Coastguard Worker 97*0e209d39SAndroid Build Coastguard Worker 3d. Upload the CL to main branch 98*0e209d39SAndroid Build Coastguard Worker ```shell 99*0e209d39SAndroid Build Coastguard Worker repo upload --cbr . 100*0e209d39SAndroid Build Coastguard Worker ``` 101*0e209d39SAndroid Build Coastguard Worker 102*0e209d39SAndroid Build Coastguard Worker4. Copy ICU upstream sources into external/icu 103*0e209d39SAndroid Build Coastguard Worker```shell 104*0e209d39SAndroid Build Coastguard Workercd ${ANDROID_BUILD_TOP}/external/icu 105*0e209d39SAndroid Build Coastguard Workerexport ICU_BRANCH=icu${ICU_VERSION} 106*0e209d39SAndroid Build Coastguard Workerexport UPSTREAM_RELEASE_TAG=release-${ICU_VERSION}-${ICU_MINOR_VERSION} 107*0e209d39SAndroid Build Coastguard Workergit fetch aosp ${ICU_BRANCH} 108*0e209d39SAndroid Build Coastguard Workergit branch ${ICU_BRANCH} --track aosp/${ICU_BRANCH} 109*0e209d39SAndroid Build Coastguard Workergit checkout ${ICU_BRANCH} 110*0e209d39SAndroid Build Coastguard Worker 111*0e209d39SAndroid Build Coastguard Worker# Clone the upstream CLDR repo locally to ${UPSTREAM_ICU_GIT} 112*0e209d39SAndroid Build Coastguard Workertest -d ${UPSTREAM_ICU_GIT} || git clone https://github.com/unicode-org/icu.git ${UPSTREAM_ICU_GIT} 113*0e209d39SAndroid Build Coastguard Worker 114*0e209d39SAndroid Build Coastguard Workergit --git-dir=${UPSTREAM_ICU_GIT}/.git --work-tree=${UPSTREAM_ICU_GIT} fetch 115*0e209d39SAndroid Build Coastguard Workergit --git-dir=${UPSTREAM_ICU_GIT}/.git --work-tree=${UPSTREAM_ICU_GIT} checkout ${UPSTREAM_RELEASE_TAG} 116*0e209d39SAndroid Build Coastguard Workerfind icu4j/ -type f,d ! -regex ".*/\(Android.mk\|Android.bp\|adjust_icudt_path.mk\|liblayout-jarjar-rules.txt\|.gitignore\|AndroidTest.xml\)" -delete 117*0e209d39SAndroid Build Coastguard Workerfind icu4c/ -type f,d ! -regex ".*/\(Android.mk\|Android.bp\|.gitignore\|AndroidTest.xml\)" -delete 118*0e209d39SAndroid Build Coastguard Workercp -r ${UPSTREAM_ICU_GIT}/icu4j . 119*0e209d39SAndroid Build Coastguard Workercp -r ${UPSTREAM_ICU_GIT}/icu4c . 120*0e209d39SAndroid Build Coastguard Workergit checkout HEAD -- icu4c/.gitignore icu4j/.gitignore # Android has extra .gitignores. Use our version. 121*0e209d39SAndroid Build Coastguard Workerrm -r tools/cldr 122*0e209d39SAndroid Build Coastguard Workercp -r ${UPSTREAM_ICU_GIT}/tools/cldr tools/cldr 123*0e209d39SAndroid Build Coastguard Worker 124*0e209d39SAndroid Build Coastguard Workergit add -A 125*0e209d39SAndroid Build Coastguard Workergit commit -F- <<EOF 126*0e209d39SAndroid Build Coastguard WorkerCopy ICU ${UPSTREAM_RELEASE_TAG} into aosp/${ICU_BRANCH} 127*0e209d39SAndroid Build Coastguard Worker 128*0e209d39SAndroid Build Coastguard WorkerCopy the files with the following commands: 129*0e209d39SAndroid Build Coastguard Workerfind icu4j/ -type f,d ! -regex ".*/\(Android.mk\|Android.bp\|adjust_icudt_path.mk\|liblayout-jarjar-rules.txt\|.gitignore\|AndroidTest.xml\)" -delete 130*0e209d39SAndroid Build Coastguard Workerfind icu4c/ -type f,d ! -regex ".*/\(Android.mk\|Android.bp\|.gitignore\|AndroidTest.xml\)" -delete 131*0e209d39SAndroid Build Coastguard Workercp -r \${UPSTREAM_ICU_GIT}/icu4j . 132*0e209d39SAndroid Build Coastguard Workercp -r \${UPSTREAM_ICU_GIT}/icu4c . 133*0e209d39SAndroid Build Coastguard Workergit checkout HEAD -- icu4c/.gitignore icu4j/.gitignore 134*0e209d39SAndroid Build Coastguard Workerrm -r tools/cldr 135*0e209d39SAndroid Build Coastguard Workercp -r \${UPSTREAM_ICU_GIT}/tools/cldr tools/cldr 136*0e209d39SAndroid Build Coastguard WorkerEOF 137*0e209d39SAndroid Build Coastguard Worker``` 138*0e209d39SAndroid Build Coastguard Worker 139*0e209d39SAndroid Build Coastguard Worker5. Apply Android-specific patches into `external/icu` 140*0e209d39SAndroid Build Coastguard Worker 141*0e209d39SAndroid Build Coastguard Worker 5a. Cherry-pick the patches from the last staging branch. For example using the following query for ICU 71 patches 142*0e209d39SAndroid Build Coastguard Worker * https://r.android.com/q/%2522Android+patch%2522+branch:icu71+status:merged 143*0e209d39SAndroid Build Coastguard Worker * The cherry-pick command is 144*0e209d39SAndroid Build Coastguard Worker ```shell 145*0e209d39SAndroid Build Coastguard Worker git cherry-pick <first_patch_in_the_chain>~1..<last_patch_in_the_chain> 146*0e209d39SAndroid Build Coastguard Worker ``` 147*0e209d39SAndroid Build Coastguard Worker 5b. Cherry-pick the patches since the ICU upgrade 148*0e209d39SAndroid Build Coastguard Worker * Find the patches with this query. 149*0e209d39SAndroid Build Coastguard Worker https://r.android.com/q/%2522Android+patch%2522+project:platform/external/icu+status:merged+-owner:automerger+-owner:android-build-coastguard-worker%2540google.com+branch:main 150*0e209d39SAndroid Build Coastguard Worker 151*0e209d39SAndroid Build Coastguard Worker6. Regenerate and commit the artifacts 152*0e209d39SAndroid Build Coastguard Worker 153*0e209d39SAndroid Build Coastguard Worker 6a. Update icu source data files 154*0e209d39SAndroid Build Coastguard Worker ```shell 155*0e209d39SAndroid Build Coastguard Worker croot external/icu 156*0e209d39SAndroid Build Coastguard Worker tools/updatecldrdata.py 157*0e209d39SAndroid Build Coastguard Worker 158*0e209d39SAndroid Build Coastguard Worker git add -A 159*0e209d39SAndroid Build Coastguard Worker git commit -F- <<EOF 160*0e209d39SAndroid Build Coastguard Worker Regenerated source data files with Android CLDR patches 161*0e209d39SAndroid Build Coastguard Worker 162*0e209d39SAndroid Build Coastguard Worker Source data files updated using: 163*0e209d39SAndroid Build Coastguard Worker tools/updatecldrdata.py 164*0e209d39SAndroid Build Coastguard Worker 165*0e209d39SAndroid Build Coastguard Worker Test: n/a 166*0e209d39SAndroid Build Coastguard Worker EOF 167*0e209d39SAndroid Build Coastguard Worker ``` 168*0e209d39SAndroid Build Coastguard Worker 169*0e209d39SAndroid Build Coastguard Worker 6b. Update icu binary data files 170*0e209d39SAndroid Build Coastguard Worker ```shell 171*0e209d39SAndroid Build Coastguard Worker tools/updateicudata.py 172*0e209d39SAndroid Build Coastguard Worker git add -A 173*0e209d39SAndroid Build Coastguard Worker git commit -F- <<EOF 174*0e209d39SAndroid Build Coastguard Worker Regenerated binary data files with Android CLDR patches 175*0e209d39SAndroid Build Coastguard Worker 176*0e209d39SAndroid Build Coastguard Worker Binary data files updated using: 177*0e209d39SAndroid Build Coastguard Worker tools/updateicudata.py 178*0e209d39SAndroid Build Coastguard Worker 179*0e209d39SAndroid Build Coastguard Worker Test: n/a 180*0e209d39SAndroid Build Coastguard Worker EOF 181*0e209d39SAndroid Build Coastguard Worker ``` 182*0e209d39SAndroid Build Coastguard Worker 183*0e209d39SAndroid Build Coastguard Worker 6c. Pin the public API surface temporarily 184*0e209d39SAndroid Build Coastguard Worker * We will later expose the new APIs after submitting the version upgrade CLs. 185*0e209d39SAndroid Build Coastguard Worker ```shell 186*0e209d39SAndroid Build Coastguard Worker ./tools/srcgen/generate_allowlisted_public_api.sh 187*0e209d39SAndroid Build Coastguard Worker git add -A 188*0e209d39SAndroid Build Coastguard Worker git commit -F- <<EOF 189*0e209d39SAndroid Build Coastguard Worker Pin the current API list 190*0e209d39SAndroid Build Coastguard Worker 191*0e209d39SAndroid Build Coastguard Worker Test: ./tools/srcgen/generate_allowlisted_public_api.sh 192*0e209d39SAndroid Build Coastguard Worker EOF 193*0e209d39SAndroid Build Coastguard Worker ``` 194*0e209d39SAndroid Build Coastguard Worker 195*0e209d39SAndroid Build Coastguard Worker 6d. Regenerate android_icu4j/ 196*0e209d39SAndroid Build Coastguard Worker * Commands 197*0e209d39SAndroid Build Coastguard Worker ```shell 198*0e209d39SAndroid Build Coastguard Worker tools/srcgen/generate_android_icu4j.sh 199*0e209d39SAndroid Build Coastguard Worker 200*0e209d39SAndroid Build Coastguard Worker git add -A 201*0e209d39SAndroid Build Coastguard Worker git commit -F- <<EOF 202*0e209d39SAndroid Build Coastguard Worker Regenerate android_icu4j/ from icu4j/ 203*0e209d39SAndroid Build Coastguard Worker 204*0e209d39SAndroid Build Coastguard Worker android_icu4j files updated using: 205*0e209d39SAndroid Build Coastguard Worker tools/srcgen/generate_android_icu4j.sh 206*0e209d39SAndroid Build Coastguard Worker 207*0e209d39SAndroid Build Coastguard Worker Test: n/a 208*0e209d39SAndroid Build Coastguard Worker EOF 209*0e209d39SAndroid Build Coastguard Worker ``` 210*0e209d39SAndroid Build Coastguard Worker * If any java patches are not applied perfectly, remove the .orig and 211*0e209d39SAndroid Build Coastguard Worker .rej files with the following command 212*0e209d39SAndroid Build Coastguard Worker ```shell 213*0e209d39SAndroid Build Coastguard Worker find android_icu4j/ -name *.orig -delete 214*0e209d39SAndroid Build Coastguard Worker # Please manually update and resolve conflict of the java doc in android_icu4j/ 215*0e209d39SAndroid Build Coastguard Worker git commit -amend 216*0e209d39SAndroid Build Coastguard Worker # Regenerate the patch files 217*0e209d39SAndroid Build Coastguard Worker ./tools/srcgen/javadoc_patches/create_patches.sh 218*0e209d39SAndroid Build Coastguard Worker git add -A && git commit -F- <<EOF 219*0e209d39SAndroid Build Coastguard Worker Regenerate java doc patches 220*0e209d39SAndroid Build Coastguard Worker 221*0e209d39SAndroid Build Coastguard Worker Test: n/a 222*0e209d39SAndroid Build Coastguard Worker EOF 223*0e209d39SAndroid Build Coastguard Worker ``` 224*0e209d39SAndroid Build Coastguard Worker 225*0e209d39SAndroid Build Coastguard Worker 6e. Re-genereate libandroidicu/ sources 226*0e209d39SAndroid Build Coastguard Worker ```shell 227*0e209d39SAndroid Build Coastguard Worker ./tools/icu4c_srcgen/generate_libandroidicu.py 228*0e209d39SAndroid Build Coastguard Worker git add -A && git commit -F- <<EOF 229*0e209d39SAndroid Build Coastguard Worker Regenerate libandroidicu 230*0e209d39SAndroid Build Coastguard Worker 231*0e209d39SAndroid Build Coastguard Worker The command: 232*0e209d39SAndroid Build Coastguard Worker ./tools/icu4c_srcgen/generate_libandroidicu.py 233*0e209d39SAndroid Build Coastguard Worker 234*0e209d39SAndroid Build Coastguard Worker Test: n/a 235*0e209d39SAndroid Build Coastguard Worker EOF 236*0e209d39SAndroid Build Coastguard Worker ``` 237*0e209d39SAndroid Build Coastguard Worker 238*0e209d39SAndroid Build Coastguard Worker 6f. Regenerate libicu/ sources 239*0e209d39SAndroid Build Coastguard Worker * Commands 240*0e209d39SAndroid Build Coastguard Worker ```shell 241*0e209d39SAndroid Build Coastguard Worker ./tools/icu4c_srcgen/generate_ndk.py 242*0e209d39SAndroid Build Coastguard Worker 243*0e209d39SAndroid Build Coastguard Worker git add -A && git commit -a -F- <<EOF 244*0e209d39SAndroid Build Coastguard Worker Regenerate libicu.so and ICU4C CTS headers 245*0e209d39SAndroid Build Coastguard Worker 246*0e209d39SAndroid Build Coastguard Worker The command: 247*0e209d39SAndroid Build Coastguard Worker ./tools/icu4c_srcgen/generate_ndk.py 248*0e209d39SAndroid Build Coastguard Worker 249*0e209d39SAndroid Build Coastguard Worker Test: n/a 250*0e209d39SAndroid Build Coastguard Worker EOF 251*0e209d39SAndroid Build Coastguard Worker ``` 252*0e209d39SAndroid Build Coastguard Worker * Review the changes in libicu/ndk_headers/unicode. Check that 253*0e209d39SAndroid Build Coastguard Worker no ABI change is in the C struct or API signature. 254*0e209d39SAndroid Build Coastguard Worker ```shell 255*0e209d39SAndroid Build Coastguard Worker git diff HEAD~1 ./libicu/ndk_headers/ 256*0e209d39SAndroid Build Coastguard Worker ``` 257*0e209d39SAndroid Build Coastguard Worker * May need to run this to update .patch files 258*0e209d39SAndroid Build Coastguard Worker ```shell 259*0e209d39SAndroid Build Coastguard Worker # Manually update doxygen doc in the .h headers in libicu/ndk_headers 260*0e209d39SAndroid Build Coastguard Worker ./tools/icu4c_srcgen/doc_patches/create_patches.sh 261*0e209d39SAndroid Build Coastguard Worker git add -A && git commit -F- <<EOF 262*0e209d39SAndroid Build Coastguard Worker Regenerate patches in libicu headers 263*0e209d39SAndroid Build Coastguard Worker EOF 264*0e209d39SAndroid Build Coastguard Worker ``` 265*0e209d39SAndroid Build Coastguard Worker 266*0e209d39SAndroid Build Coastguard Worker 6g. [Not required for every ICU release] Increment Distro major version 267*0e209d39SAndroid Build Coastguard Worker * See https://android.googlesource.com/platform/system/timezone/+/main/README.android 268*0e209d39SAndroid Build Coastguard Worker for details. Usually, it’s needed only when it’s the first ICU upgrade 269*0e209d39SAndroid Build Coastguard Worker in the Android dessert release. 270*0e209d39SAndroid Build Coastguard Worker 271*0e209d39SAndroid Build Coastguard Worker 6h. Generate time zone files 272*0e209d39SAndroid Build Coastguard Worker ```shell 273*0e209d39SAndroid Build Coastguard Worker cd $ANDROID_BUILD_TOP/system/timezone 274*0e209d39SAndroid Build Coastguard Worker repo start ${ICU_BRANCH} . 275*0e209d39SAndroid Build Coastguard Worker ./update-tzdata.py 276*0e209d39SAndroid Build Coastguard Worker git add -A 277*0e209d39SAndroid Build Coastguard Worker git commit -F- <<EOF 278*0e209d39SAndroid Build Coastguard Worker Regenerate data files for ICU ${ICU_VERSION} upgrade 279*0e209d39SAndroid Build Coastguard Worker 280*0e209d39SAndroid Build Coastguard Worker Binary data files updated using: 281*0e209d39SAndroid Build Coastguard Worker system/timezone/update-tzdata.py 282*0e209d39SAndroid Build Coastguard Worker 283*0e209d39SAndroid Build Coastguard Worker This updates the ICU version number inside of icu_tzdata.dat but doesn't 284*0e209d39SAndroid Build Coastguard Worker change the timezone data itself. 285*0e209d39SAndroid Build Coastguard Worker 286*0e209d39SAndroid Build Coastguard Worker Bug: ${ICU_UPGRADE_BUG} 287*0e209d39SAndroid Build Coastguard Worker Test: n/a 288*0e209d39SAndroid Build Coastguard Worker EOF 289*0e209d39SAndroid Build Coastguard Worker 290*0e209d39SAndroid Build Coastguard Worker # If only the build time in icu4c/source/data/misc/zoneinfo64.txt, this step isn't needed. 291*0e209d39SAndroid Build Coastguard Worker cd $ANDROID_BUILD_TOP/external/icu 292*0e209d39SAndroid Build Coastguard Worker git add -A 293*0e209d39SAndroid Build Coastguard Worker git commit -F- <<EOF 294*0e209d39SAndroid Build Coastguard Worker Regenerate tz-related data files 295*0e209d39SAndroid Build Coastguard Worker 296*0e209d39SAndroid Build Coastguard Worker Data files updated using: 297*0e209d39SAndroid Build Coastguard Worker system/timezone/update-tzdata.py 298*0e209d39SAndroid Build Coastguard Worker 299*0e209d39SAndroid Build Coastguard Worker Bug: ${ICU_UPGRADE_BUG} 300*0e209d39SAndroid Build Coastguard Worker Test: n/a 301*0e209d39SAndroid Build Coastguard Worker EOF 302*0e209d39SAndroid Build Coastguard Worker ``` 303*0e209d39SAndroid Build Coastguard Worker 304*0e209d39SAndroid Build Coastguard Worker 6i. Update the version numbers in the METADATA 305*0e209d39SAndroid Build Coastguard Worker 1. Update the external/icu/README.version 306*0e209d39SAndroid Build Coastguard Worker 2. Update version and upgrade date in external/cldr/METADATA 307*0e209d39SAndroid Build Coastguard Worker 3. `git commit` the file change 308*0e209d39SAndroid Build Coastguard Worker 309*0e209d39SAndroid Build Coastguard Worker 6j. Regenerate frameworks/base/libs/androidfw/LocaleDataTables.cpp 310*0e209d39SAndroid Build Coastguard Worker ```shell 311*0e209d39SAndroid Build Coastguard Worker croot frameworks/base 312*0e209d39SAndroid Build Coastguard Worker ./tools/localedata/extract_icu_data.py $ANDROID_BUILD_TOP > libs/androidfw/LocaleDataTables.cpp 313*0e209d39SAndroid Build Coastguard Worker git commit -a -F- <<EOF 314*0e209d39SAndroid Build Coastguard Worker Regenerate LocaleDataTables.cpp due to ICU ${ICU_VERSION} upgrade 315*0e209d39SAndroid Build Coastguard Worker 316*0e209d39SAndroid Build Coastguard Worker The command: 317*0e209d39SAndroid Build Coastguard Worker ./tools/localedata/extract_icu_data.py \$ANDROID_BUILD_TOP > libs/androidfw/LocaleDataTables.cpp 318*0e209d39SAndroid Build Coastguard Worker 319*0e209d39SAndroid Build Coastguard Worker Bug: ${ICU_UPGRADE_BUG} 320*0e209d39SAndroid Build Coastguard Worker Test: atest FrameworksCoreTests:android.text.format 321*0e209d39SAndroid Build Coastguard Worker EOF 322*0e209d39SAndroid Build Coastguard Worker ``` 323*0e209d39SAndroid Build Coastguard Worker7. Build and run test 324*0e209d39SAndroid Build Coastguard Worker 325*0e209d39SAndroid Build Coastguard Worker 7a. Build by `m droid cts` 326*0e209d39SAndroid Build Coastguard Worker 327*0e209d39SAndroid Build Coastguard Worker 7b. Run the device tests by `atest CtsIcu4cTestCases CtsIcuTestCases CtsLibcoreTestCases CtsLibcoreOjTestCases CtsBionicTestCases CtsTextTestCases minikin_tests -- --abi x86_64 # the primary ABI` 328*0e209d39SAndroid Build Coastguard Worker 329*0e209d39SAndroid Build Coastguard Worker 7c. Run the host-side test by 330*0e209d39SAndroid Build Coastguard Worker * ICU4J host-side test `ant check` 331*0e209d39SAndroid Build Coastguard Worker * ICU4C host-side test `make CINTLTST_OPTS=-w INTLTEST_OPTS=-w check` 332*0e209d39SAndroid Build Coastguard Worker (Currently, it has some failing tests. No of failures?) 333*0e209d39SAndroid Build Coastguard Worker 334*0e209d39SAndroid Build Coastguard Worker 7d. If libcore/ tests are changed, verify the change 335*0e209d39SAndroid Build Coastguard Worker * To verify the test change in ART MTS, run `m mts && mts-tradefed run mts-art` on Android S. 336*0e209d39SAndroid Build Coastguard Worker * To verify the test change on LUCI bot, run `art/tools/run-libcore-tests.sh --mode=host`, because LUCI uses older ICU versions. 337*0e209d39SAndroid Build Coastguard Worker8. Upload the CLs to gerrit for code reviews from `aosp/icu${ICU_VERSION}` in `external/icu` and `aosp/upstream-release-cldr` in `external/cldr` 338*0e209d39SAndroid Build Coastguard Worker```shell 339*0e209d39SAndroid Build Coastguard Workerrepo upload --cbr -o uploadvalidator~skip --no-verify . 340*0e209d39SAndroid Build Coastguard Worker``` 341*0e209d39SAndroid Build Coastguard Worker9. Merge `aosp/icu*` branch to aosp/main 342*0e209d39SAndroid Build Coastguard Worker```shell 343*0e209d39SAndroid Build Coastguard Workercd $ANDROID_BUILD_TOP/external/icu 344*0e209d39SAndroid Build Coastguard Workerrepo start icu${ICU_VERSION}-main . 345*0e209d39SAndroid Build Coastguard Workergit merge --no-ff icu${ICU_VERSION} -m " 346*0e209d39SAndroid Build Coastguard WorkerMerge branch aosp/icu${ICU_VERSION} into aosp/main 347*0e209d39SAndroid Build Coastguard Worker 348*0e209d39SAndroid Build Coastguard WorkerBug: ${ICU_UPGRADE_BUG} 349*0e209d39SAndroid Build Coastguard WorkerTest: atest CtsIcu4cTestCases CtsIcuTestCases CtsLibcoreTestCases CtsLibcoreOjTestCases CtsBionicTestCases CtsTextTestCases minikin_tests 350*0e209d39SAndroid Build Coastguard Worker" 351*0e209d39SAndroid Build Coastguard Worker``` 352*0e209d39SAndroid Build Coastguard Worker10. Upload and submit changes from external/icu, external/cldr, libcore, frameworks/base, system/timezone 353*0e209d39SAndroid Build Coastguard Worker 354*0e209d39SAndroid Build Coastguard Worker 10a. `repo upload --cbr -o uploadvalidator~skip --no-verify .` 355*0e209d39SAndroid Build Coastguard Worker 356*0e209d39SAndroid Build Coastguard Worker 10b. Code review the diff in `android_icu4j/src/main/tests/android/icu/extratest/expected_transliteration_id_list.txt` 357*0e209d39SAndroid Build Coastguard Worker * If a transliteration id is removed from the list, it may introduce 358*0e209d39SAndroid Build Coastguard Worker app compatibility issues if the app depends on them. However, app 359*0e209d39SAndroid Build Coastguard Worker has been warned to check the availability before invoking them. 360*0e209d39SAndroid Build Coastguard Worker https://developer.android.com/reference/android/icu/text/Transliterator#getAvailableIDs() 361*0e209d39SAndroid Build Coastguard Worker11. After submitting all the CLs to aosp/main, expose the new stable ICU4J APIs to Android SDK 362*0e209d39SAndroid Build Coastguard Worker```shell 363*0e209d39SAndroid Build Coastguard Workerrm tools/srcgen/allowlisted-public-api.txt 364*0e209d39SAndroid Build Coastguard Worker./tools/generate_android_icu4j.sh 365*0e209d39SAndroid Build Coastguard Worker# Modify Icu4jTransform.java to allowlist more classes if needed. Check the error message for the details 366*0e209d39SAndroid Build Coastguard Workerm update-api droid 367*0e209d39SAndroid Build Coastguard Worker 368*0e209d39SAndroid Build Coastguard Workergit commit -a -F- <<EOF 369*0e209d39SAndroid Build Coastguard WorkerExpose the new stable APIs from ICU4J ${ICU_VERSION} 370*0e209d39SAndroid Build Coastguard Worker 371*0e209d39SAndroid Build Coastguard WorkerAccording to the upstream API coverage report external/icu/icu4j/coverage-exclusion.txt, 372*0e209d39SAndroid Build Coastguard Workerthe methods should have API coverage running in the existing CtsIcuTestCases. 373*0e209d39SAndroid Build Coastguard Worker 374*0e209d39SAndroid Build Coastguard WorkerBug: ${ICU_UPGRADE_BUG} 375*0e209d39SAndroid Build Coastguard WorkerTest: atest CtsIcuTestCases 376*0e209d39SAndroid Build Coastguard WorkerEOF 377*0e209d39SAndroid Build Coastguard Worker``` 378*0e209d39SAndroid Build Coastguard Worker12. Send email android-libcore@ and icu-team@ to announce this. 379*0e209d39SAndroid Build Coastguard Worker 1. Some Android teams may have dependency on the new ICU version for other features. 380*0e209d39SAndroid Build Coastguard Worker 2. Email template 381*0e209d39SAndroid Build Coastguard Worker ```text 382*0e209d39SAndroid Build Coastguard Worker Hi, Libcore and ICU team, 383*0e209d39SAndroid Build Coastguard Worker 384*0e209d39SAndroid Build Coastguard Worker ICU <version> just landed Android AOSP. 385*0e209d39SAndroid Build Coastguard Worker https://android.googlesource.com/platform/external/icu/+/main/README.version 386*0e209d39SAndroid Build Coastguard Worker as well as Android S (or Android 12). 387*0e209d39SAndroid Build Coastguard Worker https://googleplex-android.googlesource.com/platform/external/icu/+/sc-dev/README.version 388*0e209d39SAndroid Build Coastguard Worker 389*0e209d39SAndroid Build Coastguard Worker Note: 390*0e209d39SAndroid Build Coastguard Worker - Contains bug fixes / build changes with a small set of API methods added. 391*0e209d39SAndroid Build Coastguard Worker - Unicode stays at version 14, and no new version has been published yet. 392*0e209d39SAndroid Build Coastguard Worker ``` 393*0e209d39SAndroid Build Coastguard Worker 394*0e209d39SAndroid Build Coastguard Worker 395*0e209d39SAndroid Build Coastguard Worker## Historic version of this doc 396*0e209d39SAndroid Build Coastguard Workerhttp://g3doc/third_party/icu/g3doc/update/android