From d0fc61e79bc3580c9557c22de3299623a9099c6c Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Tue, 15 Feb 2022 12:20:58 -0500 Subject: [PATCH] LibUnicode: Extract the BCP 47 package from the CLDR This package was originally meant to be included in CLDR version 40, but was missed in their release scripts. This has been resolved: https://unicode-org.atlassian.net/browse/CLDR-15158 Unfortunately, the CLDR was re-released with the same version number. So to bust the build's CLDR cache, change the "version" used to detect that we need to redownload the CLDR. --- Meta/CMake/unicode_data.cmake | 14 +++++++++++--- .../LibUnicode/GenerateUnicodeLocale.cpp | 2 ++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/Meta/CMake/unicode_data.cmake b/Meta/CMake/unicode_data.cmake index f371ee5235..1d89f13253 100644 --- a/Meta/CMake/unicode_data.cmake +++ b/Meta/CMake/unicode_data.cmake @@ -1,7 +1,11 @@ include(${CMAKE_CURRENT_LIST_DIR}/utils.cmake) set(UCD_VERSION 14.0.0) -set(CLDR_VERSION 40.0.0) +set(CLDR_VERSION 40.0.0-updated) + +# FIXME: When the CLDR is bumped to version 41, we can remove this. A bugfix to the CLDR was released with the same +# version number, so the CLDR_VERSION number above is a fake number to force a redownload. +set(CLDR_REAL_VERSION 40.0.0) set(UCD_PATH "${CMAKE_BINARY_DIR}/UCD" CACHE PATH "Download location for UCD files") set(CLDR_PATH "${CMAKE_BINARY_DIR}/CLDR" CACHE PATH "Download location for CLDR files") @@ -60,9 +64,12 @@ set(WORD_BREAK_PROP_PATH "${UCD_PATH}/WordBreakProperty.txt") set(SENTENCE_BREAK_PROP_URL "https://www.unicode.org/Public/${UCD_VERSION}/ucd/auxiliary/SentenceBreakProperty.txt") set(SENTENCE_BREAK_PROP_PATH "${UCD_PATH}/SentenceBreakProperty.txt") -set(CLDR_ZIP_URL "https://github.com/unicode-org/cldr-json/releases/download/${CLDR_VERSION}/cldr-${CLDR_VERSION}-json-modern.zip") +set(CLDR_ZIP_URL "https://github.com/unicode-org/cldr-json/releases/download/${CLDR_REAL_VERSION}/cldr-${CLDR_REAL_VERSION}-json-modern.zip") set(CLDR_ZIP_PATH "${CLDR_PATH}/cldr.zip") +set(CLDR_BCP47_SOURCE cldr-bcp47) +set(CLDR_BCP47_PATH "${CLDR_PATH}/${CLDR_BCP47_SOURCE}") + set(CLDR_CORE_SOURCE cldr-core) set(CLDR_CORE_PATH "${CLDR_PATH}/${CLDR_CORE_SOURCE}") @@ -114,6 +121,7 @@ if (ENABLE_UNICODE_DATABASE_DOWNLOAD) download_file("${SENTENCE_BREAK_PROP_URL}" "${SENTENCE_BREAK_PROP_PATH}") download_file("${CLDR_ZIP_URL}" "${CLDR_ZIP_PATH}") + extract_cldr_file("${CLDR_BCP47_SOURCE}" "${CLDR_BCP47_PATH}") extract_cldr_file("${CLDR_CORE_SOURCE}" "${CLDR_CORE_PATH}") extract_cldr_file("${CLDR_DATES_SOURCE}" "${CLDR_DATES_PATH}") extract_cldr_file("${CLDR_LOCALES_SOURCE}" "${CLDR_LOCALES_PATH}") @@ -182,7 +190,7 @@ if (ENABLE_UNICODE_DATABASE_DOWNLOAD) "${UNICODE_META_TARGET_PREFIX}" "${UNICODE_LOCALE_HEADER}" "${UNICODE_LOCALE_IMPLEMENTATION}" - arguments -r "${CLDR_CORE_PATH}" -l "${CLDR_LOCALES_PATH}" -m "${CLDR_MISC_PATH}" -n "${CLDR_NUMBERS_PATH}" -d "${CLDR_DATES_PATH}" + arguments -b "${CLDR_BCP47_PATH}" -r "${CLDR_CORE_PATH}" -l "${CLDR_LOCALES_PATH}" -m "${CLDR_MISC_PATH}" -n "${CLDR_NUMBERS_PATH}" -d "${CLDR_DATES_PATH}" ) invoke_generator( "UnicodeNumberFormat" diff --git a/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateUnicodeLocale.cpp b/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateUnicodeLocale.cpp index 64de8b3727..b8d3fb7479 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateUnicodeLocale.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateUnicodeLocale.cpp @@ -1462,6 +1462,7 @@ ErrorOr serenity_main(Main::Arguments arguments) { StringView generated_header_path; StringView generated_implementation_path; + StringView bcp47_path; StringView core_path; StringView locale_names_path; StringView misc_path; @@ -1471,6 +1472,7 @@ ErrorOr serenity_main(Main::Arguments arguments) Core::ArgsParser args_parser; args_parser.add_option(generated_header_path, "Path to the Unicode locale header file to generate", "generated-header-path", 'h', "generated-header-path"); args_parser.add_option(generated_implementation_path, "Path to the Unicode locale implementation file to generate", "generated-implementation-path", 'c', "generated-implementation-path"); + args_parser.add_option(bcp47_path, "Path to cldr-bcp47 directory", "bcp47-path", 'b', "bcp47-path"); args_parser.add_option(core_path, "Path to cldr-core directory", "core-path", 'r', "core-path"); args_parser.add_option(locale_names_path, "Path to cldr-localenames directory", "locale-names-path", 'l', "locale-names-path"); args_parser.add_option(misc_path, "Path to cldr-misc directory", "misc-path", 'm', "misc-path");