Skip to content

[build] Remove last vestiges of ICU for anything other than Foundation #40659

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -305,23 +305,6 @@ set(SWIFT_ANDROID_NDK_CLANG_VERSION "12.0.8" CACHE STRING
set(SWIFT_ANDROID_DEPLOY_DEVICE_PATH "" CACHE STRING
"Path on an Android device where build products will be pushed. These are used when running the test suite against the device")

#
# User-configurable ICU specific options for Android, FreeBSD, Linux, Haiku, and WASI.
#

foreach(sdk ANDROID;FREEBSD;LINUX;WINDOWS;HAIKU;WASI)
foreach(arch aarch64;armv6;armv7;i686;powerpc64;powerpc64le;s390x;wasm32;x86_64)
set(SWIFT_${sdk}_${arch}_ICU_UC "" CACHE STRING
"Path to a directory containing the icuuc library for ${sdk}")
set(SWIFT_${sdk}_${arch}_ICU_UC_INCLUDE "" CACHE STRING
"Path to a directory containing headers for icuuc for ${sdk}")
set(SWIFT_${sdk}_${arch}_ICU_I18N "" CACHE STRING
"Path to a directory containing the icui18n library for ${sdk}")
set(SWIFT_${sdk}_${arch}_ICU_I18N_INCLUDE "" CACHE STRING
"Path to a directory containing headers icui18n for ${sdk}")
endforeach()
endforeach()

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought that @Azoy removed this in the initial pass?

Copy link
Member Author

@finagolfin finagolfin Dec 24, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like he just left this definition in because otherwise all these build-script-related inputs that you told him not to worry about wouldmay have errored, which I'm now finally removing.

#
# User-configurable Darwin-specific options.
#
Expand Down
6 changes: 1 addition & 5 deletions docs/WindowsBuild.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ structure should resemble:
┕ usr/...
```

Note that only ICU is required for building the toolchain, and SQLite is only
Note that ICU is only required for building Foundation, and SQLite is only
needed for building llbuild and onwards. The ICU project provides binaries,
alternatively, see the ICU project for details on building ICU from source.

Expand Down Expand Up @@ -134,10 +134,6 @@ cmake -B "S:\b\1" ^
-D LLVM_EXTERNAL_CMARK_SOURCE_DIR=S:\cmark ^
-D LLVM_EXTERNAL_SWIFT_SOURCE_DIR=S:\swift ^
-D SWIFT_PATH_TO_LIBDISPATCH_SOURCE=S:\swift-corelibs-libdispatch ^
-D SWIFT_WINDOWS_x86_64_ICU_I18N_INCLUDE=S:\Library\icu-67\usr\include ^
-D SWIFT_WINDOWS_x86_64_ICU_I18N=S:\Library\icu-67\usr\lib\icuin67.lib ^
-D SWIFT_WINDOWS_x86_64_ICU_UC_INCLUDE=S:\Library\icu-67\usr\include ^
-D SWIFT_WINDOWS_x86_64_ICU_UC=S:\Library\icu-67\usr\lib\icuuc67.lib ^
-G Ninja ^
-S S:\llvm-project\llvm

Expand Down
7 changes: 1 addition & 6 deletions docs/WindowsCrossCompile.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,14 @@ the `build-script` invocation to achieve this. You will need to expand out the
path where `llvm-ar` and `llvm-ranlib` are built. These are needed to correctly
build the static libraries. Note that cross-compiling will require the use of
`lld`. Ensure that `lld-link.exe` is available to clang via your path.
Additionally, the ICU headers and libraries need to be provided for the build.

#### macOS

```bash
--extra-cmake-options=-DSWIFT_BUILD_RUNTIME_WITH_HOST_COMPILER=FALSE,\
-DCMAKE_AR=<path to llvm-ar>,\
-DCMAKE_RANLIB=<path to llvm-ranlib>,\
-DSWIFT_SDKS='OSX;WINDOWS',\
-DSWIFT_WINDOWS_x86_64_ICU_I18N_INCLUDE=<path to ICU i18n includes>,\
-DSWIFT_WINDOWS_x86_64_ICU_UC_INCLUDE=<path to ICU UC includes>,\
-DSWIFT_WINDOWS_x86_64_ICU_I18N=<path to ICU i18n lib>,\
-DSWIFT_WINDOWS_x86_64_ICU_UC=<path to ICU UC lib>
-DSWIFT_SDKS='OSX;WINDOWS'
```

#### Linux
Expand Down
10 changes: 1 addition & 9 deletions stdlib/cmake/modules/AddSwiftStdlib.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -1152,17 +1152,9 @@ function(add_swift_target_library_single target name)
target_link_libraries("${target}" INTERFACE ${SWIFTLIB_SINGLE_LINK_LIBRARIES})
endif()

# Don't add the icucore target.
set(SWIFTLIB_SINGLE_LINK_LIBRARIES_WITHOUT_ICU)
foreach(item ${SWIFTLIB_SINGLE_LINK_LIBRARIES})
if(NOT "${item}" STREQUAL "icucore")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this was only needed because of this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this was for filtering out icucore which was being added. Removing the filtering is fine.

list(APPEND SWIFTLIB_SINGLE_LINK_LIBRARIES_WITHOUT_ICU "${item}")
endif()
endforeach()

if(target_static)
_list_add_string_suffix(
"${SWIFTLIB_SINGLE_LINK_LIBRARIES_WITHOUT_ICU}"
"${SWIFTLIB_SINGLE_LINK_LIBRARIES}"
"-static"
target_static_depends)
# FIXME: should this be target_link_libraries?
Expand Down
11 changes: 0 additions & 11 deletions test/stdlib/Character.swift
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,12 @@ var testCharacters = [
"\u{0061}\u{0300}\u{0300}\u{0300}\u{0300}", // UTF-8: 9 bytes
]

// Only run it on ObjC platforms. Supported Linux versions do not have a
// recent enough ICU
#if _runtime(_ObjC)
testCharacters += [
"\u{0061}\u{0300}\u{0300}\u{0300}\u{0300}\u{0300}", // UTF-8: 11 bytes
"\u{0061}\u{0300}\u{0300}\u{0300}\u{0300}\u{0300}\u{0300}", // UTF-8: 13 bytes
"\u{0061}\u{0300}\u{0300}\u{0300}\u{0300}\u{0300}\u{0300}\u{0300}", // UTF-8: 15 bytes
"\u{0061}\u{0300}\u{0300}\u{0300}\u{0300}\u{0300}\u{0300}\u{0300}\u{0300}", // UTF-8: 17 bytes
]
#endif

testCharacters += [
// U+00A9 COPYRIGHT SIGN
Expand All @@ -105,8 +101,6 @@ testCharacters += [
"\u{00a9}\u{0300}\u{0300}\u{0300}\u{0300}", // UTF-8: 10 bytes
]

// Only run it on recent enough versions of ICU
#if _runtime(_ObjC)
if #available(iOS 11.0, macOS 10.13, tvOS 11.0, watchOS 4.0, *) {
testCharacters += [
"\u{00a9}\u{0300}\u{0300}\u{0300}\u{0300}\u{0300}", // UTF-8: 12 bytes
Expand All @@ -117,7 +111,6 @@ if #available(iOS 11.0, macOS 10.13, tvOS 11.0, watchOS 4.0, *) {
"👩‍👩‍👦‍👦", // UTF-8: 25 bytes
]
}
#endif

func randomGraphemeCluster(_ minSize: Int, _ maxSize: Int) -> String {
let n = Int.random(in: (minSize + 1) ..< maxSize)
Expand Down Expand Up @@ -224,9 +217,6 @@ CharacterTests.test("CR-LF") {
}

CharacterTests.test("Unicode 9 grapheme breaking") {
// Only run it on ObjC platforms. Supported Linux versions do not have a
// recent enough ICU for Unicode 9 support.
#if _runtime(_ObjC)
// Check for Unicode 9 or later
guard #available(iOS 10.0, macOS 10.12, *) else { return }

Expand All @@ -241,7 +231,6 @@ CharacterTests.test("Unicode 9 grapheme breaking") {
let skinTone = "👋👋🏻👋🏼👋🏽👋🏾👋🏿"
expectEqual(6, skinTone.count)
expectEqual(skinTone.reversed().count, skinTone.count)
#endif
}

/// Test that a given `String` can be transformed into a `Character` and back
Expand Down
5 changes: 0 additions & 5 deletions test/stdlib/CharacterProperties.swift
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,7 @@ CharacterPropertiesTests.test("Casing") {

expectEqual("SS", Character("ß").uppercased())

// Some versions of ICU on Linux (62.1) have a bug producing the wrong value
// when lowercasing "ẞ". Darwin platforms never shipped this version, so
// conditionally test based on platform.
#if canImport(Darwin)
expectEqual("ß", Character("ẞ").lowercased())
#endif

expectEqual("и", Character("И").lowercased())
expectEqual("И", Character("и").uppercased())
Expand Down
2 changes: 0 additions & 2 deletions utils/build-presets.ini
Original file line number Diff line number Diff line change
Expand Up @@ -921,7 +921,6 @@ test-optimized
lit-args=-v --time-tests

build-ninja
libicu
libcxx

android
Expand All @@ -942,7 +941,6 @@ host-test
install-prefix=/usr
install-llvm
install-swift
install-libicu
install-libcxx

skip-test-linux
Expand Down
13 changes: 0 additions & 13 deletions utils/build-script-impl
Original file line number Diff line number Diff line change
Expand Up @@ -2064,19 +2064,6 @@ for host in "${ALL_HOSTS[@]}"; do
-DSWIFT_PATH_TO_LIBDISPATCH_STATIC_BUILD:PATH="$(build_directory ${host} libdispatch_static)"
)

if [[ ! "${SKIP_BUILD_LIBICU}" ]] ; then
LIBICU_BUILD_DIR="$(build_directory ${host} libicu)"
ICU_TMPINSTALL=${LIBICU_BUILD_DIR}/tmp_install
cmake_options=(
"${cmake_options[@]}"
-DSWIFT_PATH_TO_LIBICU_SOURCE:PATH="${LIBICU_SOURCE_DIR}"
-DSWIFT_PATH_TO_LIBICU_BUILD:PATH="${LIBICU_BUILD_DIR}"
-DSWIFT_${SWIFT_HOST_VARIANT_SDK}_${SWIFT_HOST_VARIANT_ARCH}_ICU_UC_INCLUDE:STRING="${ICU_TMPINSTALL}/include"
-DSWIFT_${SWIFT_HOST_VARIANT_SDK}_${SWIFT_HOST_VARIANT_ARCH}_ICU_I18N_INCLUDE:STRING="${ICU_TMPINSTALL}/include"
-DSWIFT_${SWIFT_HOST_VARIANT_SDK}_${SWIFT_HOST_VARIANT_ARCH}_ICU_STATICLIB:BOOL=TRUE
)
fi

if [[ "${SWIFT_SDKS}" ]] ; then
cmake_options=(
"${cmake_options[@]}"
Expand Down
8 changes: 0 additions & 8 deletions utils/build-windows-toolchain.bat
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,6 @@ cmake ^
-D PYTHON_EXECUTABLE=%PYTHON_HOME%\python.exe ^
-D SWIFT_PATH_TO_LIBDISPATCH_SOURCE="%SourceRoot%\swift-corelibs-libdispatch" ^
-D EXPERIMENTAL_STRING_PROCESSING_SOURCE_DIR=%SourceRoot%\swift-experimental-string-processing ^
-D SWIFT_WINDOWS_x86_64_ICU_UC_INCLUDE="%BuildRoot%\Library\icu-67.1\include\unicode" ^
-D SWIFT_WINDOWS_x86_64_ICU_UC="%BuildRoot%\Library\icu-67.1\lib64\icuuc.lib" ^
-D SWIFT_WINDOWS_x86_64_ICU_I18N_INCLUDE="%BuildRoot%\Library\icu-67.1\include" ^
-D SWIFT_WINDOWS_x86_64_ICU_I18N="%BuildRoot%\Library\icu-67.1\lib64\icuin.lib" ^

-G Ninja ^
-S llvm-project\llvm || (exit /b)
Expand Down Expand Up @@ -233,10 +229,6 @@ cmake ^
-D SWIFT_NATIVE_SWIFT_TOOLS_PATH=%BuildRoot%\1\bin ^
-D SWIFT_PATH_TO_LIBDISPATCH_SOURCE=%SourceRoot%\swift-corelibs-libdispatch ^
-D EXPERIMENTAL_STRING_PROCESSING_SOURCE_DIR=%SourceRoot%\swift-experimental-string-processing ^
-D SWIFT_WINDOWS_x86_64_ICU_UC_INCLUDE="%BuildRoot%\Library\icu-67.1\include\unicode" ^
-D SWIFT_WINDOWS_x86_64_ICU_UC="%BuildRoot%\Library\icu-67.1\lib64\icuuc.lib" ^
-D SWIFT_WINDOWS_x86_64_ICU_I18N_INCLUDE="%BuildRoot%\Library\icu-67.1\include" ^
-D SWIFT_WINDOWS_x86_64_ICU_I18N="%BuildRoot%\Library\icu-67.1\lib64\icuin.lib" ^

-D SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY=YES ^
-D SWIFT_ENABLE_EXPERIMENTAL_DISTRIBUTED=YES ^
Expand Down
4 changes: 0 additions & 4 deletions utils/build-windows.bat
Original file line number Diff line number Diff line change
Expand Up @@ -257,10 +257,6 @@ cmake^
-DLLVM_DIR:PATH=%build_root%\llvm\lib\cmake\llvm^
-DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON^
-DSWIFT_INCLUDE_DOCS:BOOL=NO^
-DSWIFT_WINDOWS_x86_64_ICU_UC_INCLUDE:PATH=%source_root%\icu-%icu_version%\include\unicode^
-DSWIFT_WINDOWS_x86_64_ICU_UC:PATH=%source_root%\icu-%icu_version%\lib64\icuuc.lib^
-DSWIFT_WINDOWS_x86_64_ICU_I18N_INCLUDE:PATH=%source_root%\icu-%icu_version%\include^
-DSWIFT_WINDOWS_x86_64_ICU_I18N:PATH=%source_root%\icu-%icu_version%\lib64\icuin.lib^
-DSWIFT_BUILD_DYNAMIC_STDLIB:BOOL=YES^
-DSWIFT_BUILD_DYNAMIC_SDK_OVERLAY:BOOL=YES^
-DSWIFT_BUILD_STATIC_STDLIB:BOOL=NO^
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

from . import cmark
from . import libcxx
from . import libicu
from . import llvm
from . import product
from . import swift
Expand Down Expand Up @@ -52,5 +51,4 @@ def get_dependencies(cls):
return [cmark.CMark,
llvm.LLVM,
libcxx.LibCXX,
libicu.LibICU,
swift.Swift]
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
from . import cmark
from . import earlyswiftdriver
from . import libcxx
from . import libicu
from . import llvm
from . import product
from ..cmake import CMakeOptions
Expand Down Expand Up @@ -183,5 +182,4 @@ def get_dependencies(cls):
return [cmark.CMark,
earlyswiftdriver.EarlySwiftDriver,
llvm.LLVM,
libcxx.LibCXX,
libicu.LibICU]
libcxx.LibCXX]