Skip to content

Target sdk aliases and exclusions #3411

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
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
2 changes: 2 additions & 0 deletions cmake/modules/AddSwift.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -1111,6 +1111,8 @@ function(add_swift_library name)
if("${SWIFTLIB_TARGET_SDKS}" STREQUAL "")
set(SWIFTLIB_TARGET_SDKS ${SWIFT_SDKS})
endif()
list_replace(SWIFTLIB_TARGET_SDKS ALL_POSIX_PLATFORMS "ALL_APPLE_PLATFORMS;ANDROID;CYGWIN;FREEBSD;LINUX")
list_replace(SWIFTLIB_TARGET_SDKS ALL_APPLE_PLATFORMS "IOS;IOS_SIMULATOR;TVOS;TVOS_SIMULATOR;WATCHOS;WATCHOS_SIMULATOR;OSX")

# All Swift code depends on the standard library, except for the standard
# library itself.
Expand Down
12 changes: 12 additions & 0 deletions cmake/modules/SwiftList.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,15 @@ function(_list_escape_for_shell input_list result_var_name)
set("${result_var_name}" "${result}" PARENT_SCOPE)
endfunction()

function(list_replace input_list old new)
set(replaced_list)
foreach(item ${${input_list}})
if(${item} STREQUAL ${old})
list(APPEND replaced_list ${new})
else()
list(APPEND replaced_list ${item})
endif()
endforeach()
set("${input_list}" "${replaced_list}" PARENT_SCOPE)
endfunction()

3 changes: 3 additions & 0 deletions stdlib/private/StdlibCollectionUnittest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ if(SWIFT_HOST_VARIANT MATCHES "${SWIFT_DARWIN_VARIANTS}")
Foundation)
endif()

# TODO: support this on non-POSIX platforms. It cannot be currently as it
# depends on pthreads.
add_swift_library(swiftStdlibCollectionUnittest ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_STDLIB
# This file should be listed the first. Module name is inferred from the
# filename.
Expand All @@ -28,6 +30,7 @@ add_swift_library(swiftStdlibCollectionUnittest ${SWIFT_STDLIB_LIBRARY_BUILD_TYP

SWIFT_MODULE_DEPENDS StdlibUnittest
SWIFT_COMPILE_FLAGS ${swift_stdlib_unittest_compile_flags}
TARGET_SDKS ALL_POSIX_PLATFORMS
FRAMEWORK_DEPENDS ${swift_stdlib_unittest_framework_depends}
INSTALL_IN_COMPONENT stdlib-experimental)

3 changes: 3 additions & 0 deletions stdlib/private/StdlibUnittest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ if(SWIFT_HOST_VARIANT MATCHES "${SWIFT_DARWIN_VARIANTS}")
list(APPEND swift_stdlib_unittest_framework_depends Foundation)
endif()

# TODO: support this on non-POSIX platforms. It cannot be currently as it
# depends on pthreads.
add_swift_library(swiftStdlibUnittest ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_STDLIB
# This file should be listed the first. Module name is inferred from the
# filename.
Expand All @@ -40,6 +42,7 @@ add_swift_library(swiftStdlibUnittest ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_STD
SWIFT_MODULE_DEPENDS_LINUX Glibc
SWIFT_MODULE_DEPENDS_FREEBSD Glibc
SWIFT_COMPILE_FLAGS ${swift_stdlib_unittest_compile_flags}
TARGET_SDKS ALL_POSIX_PLATFORMS
FRAMEWORK_DEPENDS ${swift_stdlib_unittest_framework_depends}
INSTALL_IN_COMPONENT stdlib-experimental)

1 change: 1 addition & 0 deletions stdlib/private/SwiftPrivatePthreadExtras/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ add_swift_library(swiftSwiftPrivatePthreadExtras ${SWIFT_STDLIB_LIBRARY_BUILD_TY
SWIFT_MODULE_DEPENDS_LINUX Glibc
SWIFT_MODULE_DEPENDS_FREEBSD Glibc
SWIFT_COMPILE_FLAGS ${STDLIB_SIL_SERIALIZE_ALL}
TARGET_SDKS ALL_POSIX_PLATFORMS
INSTALL_IN_COMPONENT stdlib-experimental)