From ba5cf31f770058ad1d3a3502de7a084a2cfd0862 Mon Sep 17 00:00:00 2001 From: Mihai Nita Date: Sat, 4 Jan 2025 03:09:51 -0800 Subject: [PATCH] ICU-22921 Add windows script doing jar extraction --- icu4c/source/data/icu4j-readme.txt | 21 +++++-- icu4j/extract-data-files.bat | 99 ++++++++++++++++++++++++++++++ 2 files changed, 115 insertions(+), 5 deletions(-) create mode 100644 icu4j/extract-data-files.bat diff --git a/icu4c/source/data/icu4j-readme.txt b/icu4c/source/data/icu4j-readme.txt index 2bc699e13c61..8ee8d7dc5474 100644 --- a/icu4c/source/data/icu4j-readme.txt +++ b/icu4c/source/data/icu4j-readme.txt @@ -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. @@ -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: @@ -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 diff --git a/icu4j/extract-data-files.bat b/icu4j/extract-data-files.bat new file mode 100644 index 000000000000..585194ab04e4 --- /dev/null +++ b/icu4j/extract-data-files.bat @@ -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