CI+LibUnicode: Remove the UCD from the system

This commit is contained in:
Timothy Flynn 2024-06-21 16:41:14 -04:00 committed by Andreas Kling
parent 2ba7b4c529
commit 9220a89d2f
Notes: sideshowbarker 2024-07-17 06:51:48 +09:00
6 changed files with 20 additions and 57 deletions

View file

@ -76,14 +76,6 @@ runs:
restore-keys: |
TimeZoneData-${{ hashFiles('Meta/CMake/time_zone_data.cmake') }}
- name: 'UnicodeData cache'
uses: actions/cache@v4
with:
path: ${{ inputs.download_cache_path }}/UCD
key: UnicodeData-${{ hashFiles('Meta/CMake/unicode_data.cmake') }}-${{ steps.date-stamp.outputs.timestamp }}
restore-keys: |
UnicodeData-${{ hashFiles('Meta/CMake/unicode_data.cmake') }}
- name: Export vcpkg GitHub Actions cache environment variables
uses: actions/github-script@v7
with:

View file

@ -15,7 +15,6 @@ First, make sure you have a working toolchain and can build and run Ladybird. Go
* Edit the `ladybird.config` file (In Qt Creator, hit ^K or CMD+K on a Mac to open the search dialog, type the name of the file and hit return to open it)
* Add the following `#define`s to the file:
```
#define ENABLE_UNICODE_DATA 1
#define ENABLE_COMPILETIME_FORMAT_CHECK
#define SANITIZE_PTRS 1
```

View file

@ -17,7 +17,6 @@ serenity_option(ENABLE_ADOBE_ICC_PROFILES_DOWNLOAD ON CACHE BOOL "Enable downloa
serenity_option(ENABLE_COMPILETIME_HEADER_CHECK OFF CACHE BOOL "Enable compiletime check that each library header compiles stand-alone")
serenity_option(ENABLE_TIME_ZONE_DATABASE_DOWNLOAD ON CACHE BOOL "Enable download of the IANA Time Zone Database at build time")
serenity_option(ENABLE_UNICODE_DATABASE_DOWNLOAD ON CACHE BOOL "Enable download of Unicode UCD files at build time")
serenity_option(ENABLE_PUBLIC_SUFFIX_DOWNLOAD ON CACHE BOOL "Enable download of the Public Suffix List at build time")
serenity_option(INCLUDE_WASM_SPEC_TESTS OFF CACHE BOOL "Download and include the WebAssembly spec testsuite")
serenity_option(INCLUDE_FLAC_SPEC_TESTS OFF CACHE BOOL "Download and include the FLAC spec testsuite")

View file

@ -1,52 +1,27 @@
include(${CMAKE_CURRENT_LIST_DIR}/utils.cmake)
set(UCD_VERSION "15.1.0")
set(UCD_SHA256 "cb1c663d053926500cd501229736045752713a066bd75802098598b7a7056177")
set(EMOJI_SHA256 "d876ee249aa28eaa76cfa6dfaa702847a8d13b062aa488d465d0395ee8137ed9")
set(UCD_PATH "${SERENITY_CACHE_DIR}/UCD" CACHE PATH "Download location for UCD files")
set(UCD_VERSION_FILE "${UCD_PATH}/version.txt")
set(UCD_ZIP_URL "https://www.unicode.org/Public/${UCD_VERSION}/ucd/UCD.zip")
set(UCD_ZIP_PATH "${UCD_PATH}/UCD.zip")
string(REGEX REPLACE "([0-9]+\\.[0-9]+)\\.[0-9]+" "\\1" EMOJI_VERSION "${UCD_VERSION}")
set(EMOJI_TEST_URL "https://www.unicode.org/Public/emoji/${EMOJI_VERSION}/emoji-test.txt")
set(EMOJI_TEST_PATH "${UCD_PATH}/emoji-test.txt")
set(EMOJI_RES_PATH "${SerenityOS_SOURCE_DIR}/Base/res/emoji")
set(EMOJI_FILE_LIST_PATH "${SerenityOS_SOURCE_DIR}/Meta/emoji-file-list.txt")
if (ENABLE_UNICODE_DATABASE_DOWNLOAD)
remove_path_if_version_changed("${UCD_VERSION}" "${UCD_VERSION_FILE}" "${UCD_PATH}")
set(EMOJI_DATA_HEADER EmojiData.h)
set(EMOJI_DATA_IMPLEMENTATION EmojiData.cpp)
if (ENABLE_NETWORK_DOWNLOADS)
download_file("${UCD_ZIP_URL}" "${UCD_ZIP_PATH}" SHA256 "${UCD_SHA256}")
download_file("${EMOJI_TEST_URL}" "${EMOJI_TEST_PATH}" SHA256 "${EMOJI_SHA256}")
else()
message(STATUS "Skipping download of ${UCD_ZIP_URL}, expecting the archive to have been extracted to ${UCD_ZIP_PATH}")
message(STATUS "Skipping download of ${EMOJI_TEST_URL}, expecting the file to be at ${EMOJI_TEST_PATH}")
endif()
invoke_generator(
"EmojiData"
Lagom::GenerateEmojiData
"${EMOJI_FILE_LIST_PATH}"
"${EMOJI_DATA_HEADER}"
"${EMOJI_DATA_IMPLEMENTATION}"
arguments -f "${EMOJI_FILE_LIST_PATH}" -r "${EMOJI_RES_PATH}"
set(EMOJI_DATA_HEADER EmojiData.h)
set(EMOJI_DATA_IMPLEMENTATION EmojiData.cpp)
# This will make this command only run when the modified time of the directory changes,
# which only happens if files within it are added or deleted, but not when a file is modified.
# This is fine for this use-case, because the contents of a file changing should not affect
# the generated emoji data.
dependencies "${EMOJI_RES_PATH}"
)
invoke_generator(
"EmojiData"
Lagom::GenerateEmojiData
"${UCD_VERSION_FILE}"
"${EMOJI_DATA_HEADER}"
"${EMOJI_DATA_IMPLEMENTATION}"
arguments "${EMOJI_INSTALL_ARG}" -f "${EMOJI_FILE_LIST_PATH}" -r "${EMOJI_RES_PATH}"
# This will make this command only run when the modified time of the directory changes,
# which only happens if files within it are added or deleted, but not when a file is modified.
# This is fine for this use-case, because the contents of a file changing should not affect
# the generated emoji.txt file.
dependencies "${EMOJI_RES_PATH}" "${EMOJI_FILE_LIST_PATH}"
)
set(UNICODE_DATA_SOURCES
${EMOJI_DATA_HEADER}
${EMOJI_DATA_IMPLEMENTATION}
)
endif()
set(UNICODE_DATA_SOURCES
${EMOJI_DATA_HEADER}
${EMOJI_DATA_IMPLEMENTATION}
)

View file

@ -21,7 +21,7 @@ if (${ENABLE_LAGOM_LADYBIRD} OR $CACHE{ENABLE_LAGOM_LADYBIRD})
endif()
# This is required for CMake (when invoked for a Lagom-only build) to
# ignore any files downloading during the build, e.g. UnicodeData.txt.
# ignore any files downloading during the build, e.g. public_suffix_list.dat.
# https://cmake.org/cmake/help/latest/policy/CMP0058.html
cmake_policy(SET CMP0058 NEW)

View file

@ -16,5 +16,3 @@ serenity_lib(LibUnicode unicode)
find_package(ICU REQUIRED COMPONENTS data uc)
target_include_directories(LibUnicode PRIVATE ${ICU_INCLUDE_DIRS})
target_link_libraries(LibUnicode PUBLIC ${ICU_LIBRARIES})
target_compile_definitions(LibUnicode PRIVATE ENABLE_UNICODE_DATA=$<BOOL:${ENABLE_UNICODE_DATABASE_DOWNLOAD}>)