README.android
1This directory contains tools for ICU updates.
2
3Data update tools
4=================
5
6updateicudata.py
7 - regerates the ICU data files.
8 ICU and CTS tests for libcore should be run before and
9 after.
10
11See $ANDROID_BUILD_TOP/system/timezone for tools related to time zone updates.
12
13Source code updates
14===================
15
16The source code in android_icu4j is generated from the source code in icu4j.
17
18Changes to upstream ICU4J can fall into one of three categories:
19
201) Back-ported upstream ICU patches or other ICU behavior changes made for Android that cannot be
21upstreamed.
222) Mechanical changes related to ICU4J being repackaged on Android under android.icu, the exposure
23of a subset of ICU in the Android SDK, or Android's platform or documentation build process.
243) JavaDoc patches to replace ICU documentation that is incorrect/confusing for Android developers.
25
26Do not change the code in android_icu4j/src or android_icu4j/resources directly: instead you
27change the icu4j source, the transformation rules used by currysrc or the javadoc patch files.
28
29All changes made to icu4j should be accompanied by changes in android_icu4j and vice versa.
30
31Regenerating android_icu4j
32--------------------------
33
34After making changes (described below) the source code can be regenerated using:
35
36source build/envsetup.sh
37lunch
38
39cd external/icu/tools/srcgen
40./generate_android_icu4j.sh
41
42The code in android_icu4j will be regenerated and should contain the changes you made
43in icu4j. Confirm the diffs are what you intended. Commit both at the same time.
44
45Applying upstream and behavioral patches to ICU4J
46-------------------------------------------------
47
48Upstream patches and other code changes that modify ICU4J behavior are made in the icu4j
49source code before android_icu4j is generated. Apply ICU patches as normal and confirm that the
50ICU tests pass.
51
52Modifying the code gen
53----------------------
54
55android_icu4j is initially generated using a Java tool found in tools/srcgen.
56
57The "rules" that transform the source are configured in
58src/main/java/com/android/icu4j/srcgen/Icu4jTransform.java.
59
60Adding a Javadoc local patch
61----------------------------
62
63ICU4J has Javadoc patches specific to Android only and they can't be upstreamed.
64
65To reduce the maintenance cost of reapplying these changes when we upgrade ICU we store the patches
66in the javadoc_patches directory. The use of the patch command also helps detect when changes
67have been made to the upstream documentation being replaced that might otherwise be missed.
68
69Changes are stored in separate files, one for each source file. This avoids maintaining a monolithic
70patch file.
71
72Javadoc changes are applied by the generate_android_icu4j.sh script automatically during post-srcgen
73step.
74
75WARNING: DO NOT add any behavioral changes in these patches. Behavioral code changes should be made
76to icu4j directly.
77
78To add a new Javadoc local patch:
79
801. Run ./generate_android_icu4j.sh
812. Use your IDE to change the required javadoc under android_icu4j
823. Run javadoc_patches/create_patches_i.sh
834. Run ./generate_android_icu4j.sh again
84
85Re-generate all javadoc patches
86-------------------------------
87
88If you want to regenerate all of the Javadoc patch files you can do so by running:
89
90./javadoc_patches/create_patches.sh
91
92