From 92b52ae6e379893c61be626dda3278bfc75dab9b Mon Sep 17 00:00:00 2001 From: Mihai Nita Date: Wed, 29 Jan 2025 01:51:15 -0800 Subject: [PATCH] ICU-23025 Fix cldr-to-icu deletes code files --- tools/cldr/cldr-to-icu/README.md | 6 +++--- .../main/java/org/unicode/icu/tool/cldrtoicu/Cldr2Icu.java | 4 +++- .../org/unicode/icu/tool/cldrtoicu/Cldr2IcuCliOptions.java | 5 ++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/tools/cldr/cldr-to-icu/README.md b/tools/cldr/cldr-to-icu/README.md index 295a23135ed..9cd186cb71a 100644 --- a/tools/cldr/cldr-to-icu/README.md +++ b/tools/cldr/cldr-to-icu/README.md @@ -160,7 +160,7 @@ You can run it with `--help` for all the options supported. * Outputting a subset of the supplemental data into a specified directory: ```sh - java -jar target/cldr-to-icu-1.0-SNAPSHOT-jar-with-dependencies.jar --outDir=/tmp/cldr --outputTypes=plurals,dayPeriods --dontGenCode=true + java -jar target/cldr-to-icu-1.0-SNAPSHOT-jar-with-dependencies.jar --outDir=/tmp/cldr --outputTypes=plurals,dayPeriods --dontGenCode ``` Note: Output types can be listed with mixedCase, lower_underscore or UPPER_UNDERSCORE. Pass `-DoutputTypes=help` to see the full list. @@ -168,9 +168,9 @@ You can run it with `--help` for all the options supported. * Outputting only a subset of locale IDs (and all the supplemental data): ```sh - java -jar target/cldr-to-icu-1.0-SNAPSHOT-jar-with-dependencies.jar --outDir=/tmp/cldr --outputTypes=plurals,dayPeriods --dontGenCode=true + java -jar target/cldr-to-icu-1.0-SNAPSHOT-jar-with-dependencies.jar --outDir=/tmp/cldr --outputTypes=plurals,dayPeriods --dontGenCode - java -jar target/cldr-to-icu-1.0-SNAPSHOT-jar-with-dependencies.jar --outDir=/tmp/cldr --localeIdFilter='(zh|yue).*' --dontGenCode=true + java -jar target/cldr-to-icu-1.0-SNAPSHOT-jar-with-dependencies.jar --outDir=/tmp/cldr --localeIdFilter='(zh|yue).*' --dontGenCode ``` * Overriding the default CLDR version string (which normally matches the CLDR library code): diff --git a/tools/cldr/cldr-to-icu/src/main/java/org/unicode/icu/tool/cldrtoicu/Cldr2Icu.java b/tools/cldr/cldr-to-icu/src/main/java/org/unicode/icu/tool/cldrtoicu/Cldr2Icu.java index b63b062d0e6..ca59d9a6514 100644 --- a/tools/cldr/cldr-to-icu/src/main/java/org/unicode/icu/tool/cldrtoicu/Cldr2Icu.java +++ b/tools/cldr/cldr-to-icu/src/main/java/org/unicode/icu/tool/cldrtoicu/Cldr2Icu.java @@ -53,7 +53,9 @@ public class Cldr2Icu { private void clean() { outputDirectories(); - generateCode("clean"); + if (!options.dontGenCode) { + generateCode("clean"); + } } private void generate() { diff --git a/tools/cldr/cldr-to-icu/src/main/java/org/unicode/icu/tool/cldrtoicu/Cldr2IcuCliOptions.java b/tools/cldr/cldr-to-icu/src/main/java/org/unicode/icu/tool/cldrtoicu/Cldr2IcuCliOptions.java index 14a4ded5987..d9b46014438 100644 --- a/tools/cldr/cldr-to-icu/src/main/java/org/unicode/icu/tool/cldrtoicu/Cldr2IcuCliOptions.java +++ b/tools/cldr/cldr-to-icu/src/main/java/org/unicode/icu/tool/cldrtoicu/Cldr2IcuCliOptions.java @@ -61,8 +61,7 @@ class Cldr2IcuCliOptions { String genJavaCodeDir; private static final String DONT_GEN_CODE = "dontGenCode"; - private static final String DONT_GEN_CODE_DESC = "Set this to true to prevent the generation of" - + " ICU source files"; + private static final String DONT_GEN_CODE_DESC = "Set this to prevent the generation of ICU source files"; private static final String DONT_GEN_CODE_DEFAULT = "false"; boolean dontGenCode; @@ -131,7 +130,7 @@ class Cldr2IcuCliOptions { private static final String OUTPUT_TYPES_LIST_DEFAULT = "false"; private static final String FORCE_DELETE = "forceDelete"; - private static final String FORCE_DELETE_DESC = "Override to force the 'clean' task to delete files it cannot" + private static final String FORCE_DELETE_DESC = "Specify to force the 'clean' task to delete files it cannot" + " determine to be auto-generated by this tool. This is useful if the file header changes since" + " the heading is what's used to recognize auto-generated files."; private static final String FORCE_DELETE_DEFAULT = "false";