Update update-tzdata.py tool to generate ICU4J data jars

The ICU4J changes are not necessary for use on Android (since
we use the ICU4C .dat file), but updating them ensures that
the .jars in sync with everything else and the jars are currently
required for host tests.

Change-Id: Ie56b31af87e8fbd27a6489af8287e4b6a7be6b8f
This commit is contained in:
Neil Fuller 2015-04-09 09:22:25 +01:00
parent 957f6188fa
commit 4d3abcb033

View file

@ -33,9 +33,12 @@ CheckDirExists(bionic_libc_zoneinfo_dir, 'bionic/libc/zoneinfo')
CheckDirExists(bionic_libc_tools_zoneinfo_dir, 'bionic/libc/tools/zoneinfo')
print 'Found bionic in %s ...' % bionic_dir
# Find the icu4c directory.
icu_dir = os.path.realpath('%s/../external/icu/icu4c/source' % bionic_dir)
CheckDirExists(icu_dir, 'external/icu/icu4c/source')
# Find the icu directory.
icu_dir = os.path.realpath('%s/../external/icu' % bionic_dir)
icu4c_dir = os.path.realpath('%s/icu4c/source' % icu_dir)
icu4j_dir = os.path.realpath('%s/icu4j' % icu_dir)
CheckDirExists(icu4c_dir, 'external/icu/icu4c/source')
CheckDirExists(icu4j_dir, 'external/icu/icu4j')
print 'Found icu in %s ...' % icu_dir
@ -116,14 +119,14 @@ def BuildIcuToolsAndData(data_filename):
# Build the ICU tools.
print 'Configuring ICU tools...'
subprocess.check_call(['%s/runConfigureICU' % icu_dir, 'Linux'])
subprocess.check_call(['%s/runConfigureICU' % icu4c_dir, 'Linux'])
# Run the ICU tools.
os.chdir('tools/tzcode')
# The tz2icu tool only picks up icuregions and icuzones in they are in the CWD
for icu_data_file in [ 'icuregions', 'icuzones']:
icu_data_file_source = '%s/tools/tzcode/%s' % (icu_dir, icu_data_file)
icu_data_file_source = '%s/tools/tzcode/%s' % (icu4c_dir, icu_data_file)
icu_data_file_symlink = './%s' % icu_data_file
os.symlink(icu_data_file_source, icu_data_file_symlink)
@ -134,7 +137,7 @@ def BuildIcuToolsAndData(data_filename):
subprocess.check_call(['make'])
# Copy the source file to its ultimate destination.
icu_txt_data_dir = '%s/data/misc' % icu_dir
icu_txt_data_dir = '%s/data/misc' % icu4c_dir
print 'Copying zoneinfo64.txt to %s ...' % icu_txt_data_dir
shutil.copy('zoneinfo64.txt', icu_txt_data_dir)
@ -143,7 +146,7 @@ def BuildIcuToolsAndData(data_filename):
subprocess.check_call(['make', 'INCLUDE_UNI_CORE_DATA=1', '-j32'])
# Copy the .dat file to its ultimate destination.
icu_dat_data_dir = '%s/stubdata' % icu_dir
icu_dat_data_dir = '%s/stubdata' % icu4c_dir
datfiles = glob.glob('data/out/tmp/icudt??l.dat')
if len(datfiles) != 1:
print 'ERROR: Unexpectedly found %d .dat files (%s). Halting.' % (len(datfiles), datfiles)
@ -152,6 +155,20 @@ def BuildIcuToolsAndData(data_filename):
print 'Copying %s to %s ...' % (datfile, icu_dat_data_dir)
shutil.copy(datfile, icu_dat_data_dir)
# Generate the ICU4J .jar files
os.chdir('%s/data' % icu_working_dir)
subprocess.check_call(['make', 'icu4j-data'])
# Copy the ICU4J .jar files to their ultimate destination.
icu_jar_data_dir = '%s/main/shared/data' % icu4j_dir
jarfiles = glob.glob('out/icu4j/*.jar')
if len(jarfiles) != 2:
print 'ERROR: Unexpectedly found %d .jar files (%s). Halting.' % (len(jarfiles), jarfiles)
sys.exit(1)
for jarfile in jarfiles:
print 'Copying %s to %s ...' % (jarfile, icu_jar_data_dir)
shutil.copy(jarfile, icu_jar_data_dir)
# Switch back to the original working cwd.
os.chdir(original_working_dir)