Skip to content

Commit

Permalink
ICU-22921 Add windows script doing jar extraction
Browse files Browse the repository at this point in the history
  • Loading branch information
mihnita committed Jan 8, 2025
1 parent 9eafd8c commit ba5cf31
Show file tree
Hide file tree
Showing 2 changed files with 115 additions and 5 deletions.
21 changes: 16 additions & 5 deletions icu4c/source/data/icu4j-readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,15 @@ In the following,

*Windows*
- Add ICU_DATA_BUILDTOOL_OPTS as a system environment variable with value "--include_uni_core_data"
- Build $icu4c_root\source\allinone\allinone.sln in Visual Studio
set ICU_DATA_BUILDTOOL_OPTS=--include_uni_core_data
- Build %icu4c_root%\source\allinone\allinone.sln in Visual Studio
You can also do it from command line (adjust Platform if needed):
msbuild %icu4c_root%\source\allinone\allinone.sln /p:Configuration=Release /p:Platform=x64 /p:SkipUWP=true

For more instructions on downloading and building ICU4C,
see the ICU4C readme at:
https://htmlpreview.github.io/?https://github.com/unicode-org/icu/blob/main/icu4c/readme.html#HowToBuild
(Windows: build as 'x86, Release' otherwise you will have to set 'CFG' differently below.)
(Windows: build as 'x64, Release' otherwise you will have to set 'CFG' differently below.)

*NOTE* You should do a full rebuild after any data changes.

Expand All @@ -43,10 +46,13 @@ platform.

*Windows*

2a. On Developer Command Prompt for VS, cd to $icu4c_root\source\data.
2a. On Developer Command Prompt for VS do
cd %icu4c_root%\source\data
nmake -f makedata.mak ICUMAKE=%icu4c_root%\source\data\ CFG=x64\Release JAR="%jdk_bin%\jar" ICU4J_ROOT=%icu4j_root% icu4j-data-install

2b. On Developer Command Prompt for VS,
nmake -f makedata.mak ICUMAKE=$icu4c_root\source\data\ CFG=x86\Release JAR="$jdk_bin\jar" ICU4J_ROOT=$icu4j_root icu4j-data-install
2b. Do
cd %icu4j_root%
.\extract-data-files.bat

Continue with step 3 below, in Java:

Expand All @@ -64,6 +70,11 @@ platform.

(You can omit the JAR if it's just jar.)

2e. Do
cd $icu4j_root
./extract-data-files.sh


Continue with step 3, in Java:

Step 2 on either platform will produce two files: icudata.jar and
Expand Down
99 changes: 99 additions & 0 deletions icu4j/extract-data-files.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
@echo off
rem Copyright (C) 2023 and later: Unicode, Inc. and others.
rem License & terms of use: http://www.unicode.org/copyright.html

rem Check that all the .jar files are present

cd %icu4j_root%

set JAR_FILE=main\shared\data\icudata.jar
if exist %JAR_FILE% goto icutzdata
echo Missing %JAR_FILE%
goto:EOF

:icutzdata
set JAR_FILE=main\shared\data\icutzdata.jar
if exist %JAR_FILE% goto testdata
echo Missing %JAR_FILE%
goto:EOF

:testdata
set JAR_FILE=main\shared\data\testdata.jar
if exist %JAR_FILE% goto alljarsok
echo Missing %JAR_FILE%
goto:EOF

:alljarsok

rem Unpack the pre-built .jar files with data only

echo Unpacking icudata.jar
cd %icu4j_root%
rd /s/q main\core\src\main\resources\com\ibm\icu\impl\data\icudata
rem jar cannot extract to folder, and /C does now seem to work on Windows.
rem We have to switch folder explicitly
cd main\core\src\main\resources
jar xf %icu4j_root%\main\shared\data\icudata.jar
rd /s/q META-INF
cd %icu4j_root%

echo Moving charset data
rd /s/q main\charset\src\main\resources\com\ibm\icu\impl\data\icudata
md main\charset\src\main\resources\com\ibm\icu\impl\data\icudata
move main\core\src\main\resources\com\ibm\icu\impl\data\icudata\*.cnv main\charset\src\main\resources\com\ibm\icu\impl\data\icudata\
move main\core\src\main\resources\com\ibm\icu\impl\data\icudata\cnvalias.icu main\charset\src\main\resources\com\ibm\icu\impl\data\icudata\

echo Moving currency data
rd /s/q main\currdata\src\main\resources\com\ibm\icu\impl\data\icudata
md main\currdata\src\main\resources\com\ibm\icu\impl\data\icudata
move main\core\src\main\resources\com\ibm\icu\impl\data\icudata\curr main\currdata\src\main\resources\com\ibm\icu\impl\data\icudata\curr

echo Moving collate data
rd /s/q main\collate\src\main\resources\com\ibm\icu\impl\data\icudata
md main\collate\src\main\resources\com\ibm\icu\impl\data\icudata
move main\core\src\main\resources\com\ibm\icu\impl\data\icudata\coll main\collate\src\main\resources\com\ibm\icu\impl\data\icudata\coll

echo Moving langdata data
rd /s/q main\langdata\src\main\resources\com\ibm\icu\impl\data\icudata
md main\langdata\src\main\resources\com\ibm\icu\impl\data\icudata
move main\core\src\main\resources\com\ibm\icu\impl\data\icudata\lang main\langdata\src\main\resources\com\ibm\icu\impl\data\icudata\lang

echo Moving regiondata data
rd /s/q main\regiondata\src\main\resources\com\ibm\icu\impl\data\icudata
md main\regiondata\src\main\resources\com\ibm\icu\impl\data\icudata
move main\core\src\main\resources\com\ibm\icu\impl\data\icudata\region main\regiondata\src\main\resources\com\ibm\icu\impl\data\icudata\region

echo Moving translit data
rd /s/q main\translit\src\main\resources\com\ibm\icu\impl\data\icudata
md main\translit\src\main\resources\com\ibm\icu\impl\data\icudata
move main\core\src\main\resources\com\ibm\icu\impl\data\icudata\translit main\translit\src\main\resources\com\ibm\icu\impl\data\icudata\translit

echo Unpacking icutzdata.jar
rem This unzips together with other existing core files
rem So we don't remove the folder
cd %icu4j_root%\main\core\src\main\resources
jar xf %icu4j_root%\main\shared\data\icutzdata.jar
rd /s/q META-INF

echo Unpacking testdata.jar
cd %icu4j_root%
rd /s/q main\core\src\test\resources\com\ibm\icu\dev\data\testdata
cd main\core\src\test\resources
jar xf %icu4j_root%\main\shared\data\testdata.jar
rd /s/q META-INF
cd %icu4j_root%

echo Removing jar files
echo icudata.jar
del main\shared\data\icudata.jar
echo icutzdata.jar
del main\shared\data\icutzdata.jar
echo testdata.jar
del main\shared\data\testdata.jar

rem remove shared folder, if empty
rd /q main\shared\data
rd /q main\shared

echo DONE
:EOF

0 comments on commit ba5cf31

Please sign in to comment.