diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000000..3d6164e5f5 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,128 @@ +##===----------------------------------------------------------------------===## +## +## This source file is part of the Swift open source project +## +## Copyright (c) 2024 Apple Inc. and the Swift project authors +## Licensed under Apache License v2.0 +## +## See LICENSE.txt for license information +## See CONTRIBUTORS.md for the list of Swift project authors +## +## SPDX-License-Identifier: Apache-2.0 +## +##===----------------------------------------------------------------------===## + +cmake_minimum_required(VERSION 3.24) + +list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules) + +if(POLICY CMP0156) + # Deduplicate linked libraries where appropriate + cmake_policy(SET CMP0156 NEW) +endif() + +if(POLICY CMP0157) + # New Swift build model: improved incremental build performance and LSP support + cmake_policy(SET CMP0157 NEW) +endif() + +if (NOT DEFINED CMAKE_C_COMPILER) + set(CMAKE_C_COMPILER clang) +endif() + +project(Foundation + LANGUAGES C Swift) + +if(NOT SWIFT_SYSTEM_NAME) + if(CMAKE_SYSTEM_NAME STREQUAL Darwin) + set(SWIFT_SYSTEM_NAME macosx) + else() + set(SWIFT_SYSTEM_NAME "$") + endif() +endif() + +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) +set(CMAKE_Swift_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/swift) + +# Fetchable dependcies +include(FetchContent) +if (_SwiftFoundationICU_SourceDIR) + FetchContent_Declare(SwiftFoundationICU + SOURCE_DIR ${_SwiftFoundationICU_SourceDIR}) +else() + FetchContent_Declare(SwiftFoundationICU + GIT_REPOSITORY https://github.com/apple/swift-foundation-icu.git + GIT_TAG 0.0.8) +endif() + +if (_SwiftFoundation_SourceDIR) + FetchContent_Declare(SwiftFoundation + SOURCE_DIR ${_SwiftFoundation_SourceDIR}) +else() + FetchContent_Declare(SwiftFoundation + GIT_REPOSITORY https://github.com/apple/swift-foundation.git + GIT_TAG main) +endif() +FetchContent_MakeAvailable(SwiftFoundationICU SwiftFoundation) + +# Precompute module triple for installation +if(NOT SwiftFoundation_MODULE_TRIPLE) + set(module_triple_command "${CMAKE_Swift_COMPILER}" -print-target-info) + if(CMAKE_Swift_COMPILER_TARGET) + list(APPEND module_triple_command -target ${CMAKE_Swift_COMPILER_TARGET}) + endif() + execute_process(COMMAND ${module_triple_command} OUTPUT_VARIABLE target_info_json) + string(JSON module_triple GET "${target_info_json}" "target" "moduleTriple") + set(SwiftFoundation_MODULE_TRIPLE "${module_triple}" CACHE STRING "swift module triple used for installed swiftmodule and swiftinterface files") + mark_as_advanced(SwiftFoundation_MODULE_TRIPLE) +endif() + +# System dependencies (fail fast if dependencies are missing) +find_package(LibXml2 REQUIRED) +find_package(CURL REQUIRED) +find_package(dispatch CONFIG REQUIRED) + +# Common build flags (_CFURLSessionInterface, _CFXMLInterface, CoreFoundation) +list(APPEND _Foundation_common_build_flags + "-DDEPLOYMENT_RUNTIME_SWIFT" + "-DCF_BUILDING_CF" + "-DDEPLOYMENT_ENABLE_LIBDISPATCH" + "-DHAVE_STRUCT_TIMESPEC" + "-DSWIFT_CORELIBS_FOUNDATION_HAS_THREADS" + "-Wno-shorten-64-to-32" + "-Wno-deprecated-declarations" + "-Wno-unreachable-code" + "-Wno-conditional-uninitialized" + "-Wno-unused-variable" + "-Wno-unused-function" + "-Wno-microsoft-enum-forward-reference" + "-fconstant-cfstrings" + "-fexceptions" # TODO: not on OpenBSD + "-fdollars-in-identifiers" + "-fno-common" + "-fcf-runtime-abi=swift" + "-fblocks") + +if(CMAKE_BUILD_TYPE STREQUAL Debug) + list(APPEND _Foundation_common_build_flags + "-DDEBUG") +endif() + +# Swift build flags (Foundation, FoundationNetworking, FoundationXML) +set(_Foundation_swift_build_flags) +list(APPEND _Foundation_swift_build_flags + "-DDEPLOYMENT_RUNTIME_SWIFT" + "-DSWIFT_CORELIBS_FOUNDATION_HAS_THREADS") + +if(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "Android") + list(APPEND _Foundation_common_build_flags + "-D_GNU_SOURCE" + "-I/usr/lib/swift") # dispatch +endif() + +include(FoundationSwiftSupport) + +add_subdirectory(Sources) +add_subdirectory(cmake/modules) diff --git a/Package.swift b/Package.swift index 3d8d20b094..e31b1f1a18 100644 --- a/Package.swift +++ b/Package.swift @@ -78,7 +78,7 @@ let package = Package( dependencies: [ .package( url: "https://github.com/apple/swift-foundation-icu", - from: "0.0.5" + from: "0.0.7" ), .package( url: "https://github.com/apple/swift-foundation", @@ -121,7 +121,7 @@ let package = Package( .target( name: "_CoreFoundation", dependencies: [ - .product(name: "FoundationICU", package: "swift-foundation-icu"), + .product(name: "_FoundationICU", package: "swift-foundation-icu"), ], path: "Sources/CoreFoundation", cSettings: coreFoundationBuildSettings diff --git a/Sources/CMakeLists.txt b/Sources/CMakeLists.txt new file mode 100644 index 0000000000..457edf4d2b --- /dev/null +++ b/Sources/CMakeLists.txt @@ -0,0 +1,20 @@ +##===----------------------------------------------------------------------===## +## +## This source file is part of the Swift open source project +## +## Copyright (c) 2024 Apple Inc. and the Swift project authors +## Licensed under Apache License v2.0 +## +## See LICENSE.txt for license information +## See CONTRIBUTORS.md for the list of Swift project authors +## +## SPDX-License-Identifier: Apache-2.0 +## +##===----------------------------------------------------------------------===## + +add_subdirectory(CoreFoundation) +add_subdirectory(_CFXMLInterface) +add_subdirectory(_CFURLSessionInterface) +add_subdirectory(Foundation) +add_subdirectory(FoundationXML) +add_subdirectory(FoundationNetworking) diff --git a/Sources/CoreFoundation/CFBundle_Locale.c b/Sources/CoreFoundation/CFBundle_Locale.c index 22ef762ac7..dc78774861 100644 --- a/Sources/CoreFoundation/CFBundle_Locale.c +++ b/Sources/CoreFoundation/CFBundle_Locale.c @@ -15,9 +15,9 @@ #include "CFPreferences.h" #if __HAS_APPLE_ICU__ -#include +#include <_foundation_unicode/ualoc.h> #endif -#include +#include <_foundation_unicode/uloc.h> #include static CFStringRef _CFBundleCopyLanguageFoundInLocalizations(CFArrayRef localizations, CFStringRef language); diff --git a/Sources/CoreFoundation/CFCharacterSet.c b/Sources/CoreFoundation/CFCharacterSet.c index 8a65277d5f..2bfbb61358 100644 --- a/Sources/CoreFoundation/CFCharacterSet.c +++ b/Sources/CoreFoundation/CFCharacterSet.c @@ -20,8 +20,8 @@ #include #include #include "CFPriv.h" -#include -#include +#include <_foundation_unicode/uchar.h> +#include <_foundation_unicode/uset.h> #define BITSPERBYTE 8 /* (CHAR_BIT * sizeof(unsigned char)) */ #define LOG_BPB 3 diff --git a/Sources/CoreFoundation/CFDateIntervalFormatter.c b/Sources/CoreFoundation/CFDateIntervalFormatter.c index 5d470fbd9b..0e02f2161b 100644 --- a/Sources/CoreFoundation/CFDateIntervalFormatter.c +++ b/Sources/CoreFoundation/CFDateIntervalFormatter.c @@ -20,7 +20,7 @@ #include "CFLocale.h" #include "CFTimeZone.h" -#include +#include <_foundation_unicode/udateintervalformat.h> #if TARGET_OS_WASI #define LOCK() do {} while (0) diff --git a/Sources/CoreFoundation/CFICUConverters.c b/Sources/CoreFoundation/CFICUConverters.c index b63565d1b3..78b60b3fc7 100644 --- a/Sources/CoreFoundation/CFICUConverters.c +++ b/Sources/CoreFoundation/CFICUConverters.c @@ -13,8 +13,8 @@ #include "CFICUConverters.h" #include "CFStringEncodingExt.h" #include "CFUniChar.h" -#include -#include +#include <_foundation_unicode/ucnv.h> +#include <_foundation_unicode/uversion.h> #include "CFInternal.h" #include diff --git a/Sources/CoreFoundation/CFLocale.c b/Sources/CoreFoundation/CFLocale.c index 3b8b483a6f..6c6f8a6a6d 100644 --- a/Sources/CoreFoundation/CFLocale.c +++ b/Sources/CoreFoundation/CFLocale.c @@ -24,18 +24,18 @@ #include "CFLocaleInternal.h" #include #if TARGET_OS_MAC || TARGET_OS_WIN32 || TARGET_OS_LINUX || TARGET_OS_BSD || TARGET_OS_WASI -#include // ICU locales -#include // ICU locale data -#include -#include // ICU currency functions -#include // ICU Unicode sets -#include // ICU low-level utilities -#include // ICU message formatting -#include -#include // ICU numbering systems -#include -#if U_ICU_VERSION_MAJOR_NUM > 53 && __has_include() -#include +#include <_foundation_unicode/uloc.h> // ICU locales +#include <_foundation_unicode/ulocdata.h> // ICU locale data +#include <_foundation_unicode/ucal.h> +#include <_foundation_unicode/ucurr.h> // ICU currency functions +#include <_foundation_unicode/uset.h> // ICU Unicode sets +#include <_foundation_unicode/putil.h> // ICU low-level utilities +#include <_foundation_unicode/umsg.h> // ICU message formatting +#include <_foundation_unicode/ucol.h> +#include <_foundation_unicode/unumsys.h> // ICU numbering systems +#include <_foundation_unicode/uvernum.h> +#if U_ICU_VERSION_MAJOR_NUM > 53 && __has_include(<_foundation_unicode/uameasureformat.h>) +#include <_foundation_unicode/uameasureformat.h> extern int32_t uameasfmt_getUnitsForUsage( const char* locale, @@ -1745,7 +1745,7 @@ static bool __CFLocaleCopyTemperatureUnit(CFLocaleRef locale, bool user, CFTypeR if (!done) { char localeID[ULOC_FULLNAME_CAPACITY+ULOC_KEYWORD_AND_VALUES_CAPACITY]; if (CFStringGetCString(locale->_identifier, localeID, sizeof(localeID)/sizeof(char), kCFStringEncodingASCII)) { -#if U_ICU_VERSION_MAJOR_NUM > 53 && __has_include() +#if U_ICU_VERSION_MAJOR_NUM > 53 && __has_include(<_foundation_unicode/uameasureformat.h>) UErrorCode icuStatus = U_ZERO_ERROR; UAMeasureUnit unit; int32_t unitCount = uameasfmt_getUnitsForUsage(localeID, "temperature", "weather", &unit, 1, &icuStatus); diff --git a/Sources/CoreFoundation/CFLocaleIdentifier.c b/Sources/CoreFoundation/CFLocaleIdentifier.c index 88ea819818..de4bc4c602 100644 --- a/Sources/CoreFoundation/CFLocaleIdentifier.c +++ b/Sources/CoreFoundation/CFLocaleIdentifier.c @@ -59,7 +59,7 @@ #include #include #if TARGET_OS_MAC || TARGET_OS_WIN32 || TARGET_OS_LINUX || TARGET_OS_BSD -#include +#include <_foundation_unicode/uloc.h> #else #define ULOC_KEYWORD_SEPARATOR '@' #define ULOC_FULLNAME_CAPACITY 56 diff --git a/Sources/CoreFoundation/CFRegularExpression.c b/Sources/CoreFoundation/CFRegularExpression.c index 093847825e..7788fec5c8 100644 --- a/Sources/CoreFoundation/CFRegularExpression.c +++ b/Sources/CoreFoundation/CFRegularExpression.c @@ -15,7 +15,7 @@ #include "CFInternal.h" #define U_SHOW_DRAFT_API 1 #define U_SHOW_INTERNAL_API 1 -#include +#include <_foundation_unicode/uregex.h> #define STACK_BUFFER_SIZE 256 diff --git a/Sources/CoreFoundation/CFString.c b/Sources/CoreFoundation/CFString.c index 48d2bb383f..1de46dac05 100644 --- a/Sources/CoreFoundation/CFString.c +++ b/Sources/CoreFoundation/CFString.c @@ -27,7 +27,7 @@ #include "CFString_Internal.h" #include "CFRuntime_Internal.h" #include -#include +#include <_foundation_unicode/uchar.h> #if TARGET_OS_MAC || TARGET_OS_WIN32 || TARGET_OS_LINUX || TARGET_OS_BSD #include "CFConstantKeys.h" #include "CFStringLocalizedFormattingInternal.h" diff --git a/Sources/CoreFoundation/CFStringTransform.c b/Sources/CoreFoundation/CFStringTransform.c index bed21ccb83..ab88558db7 100644 --- a/Sources/CoreFoundation/CFStringTransform.c +++ b/Sources/CoreFoundation/CFStringTransform.c @@ -19,7 +19,7 @@ #include "CFUniChar.h" #include "CFPriv.h" #include "CFInternal.h" -#include +#include <_foundation_unicode/utrans.h> static const char *__CFStringTransformGetICUIdentifier(CFStringRef identifier); diff --git a/Sources/CoreFoundation/CFStringUtilities.c b/Sources/CoreFoundation/CFStringUtilities.c index 1767b9de15..8f48bf3d34 100644 --- a/Sources/CoreFoundation/CFStringUtilities.c +++ b/Sources/CoreFoundation/CFStringUtilities.c @@ -19,8 +19,8 @@ #include #include #if TARGET_OS_MAC || TARGET_OS_WIN32 || TARGET_OS_LINUX || TARGET_OS_WASI -#include -#include +#include <_foundation_unicode/ucol.h> +#include <_foundation_unicode/ucoleitr.h> #endif #include diff --git a/Sources/CoreFoundation/CFTimeZone.c b/Sources/CoreFoundation/CFTimeZone.c index 24f6d7384d..e959bdc264 100644 --- a/Sources/CoreFoundation/CFTimeZone.c +++ b/Sources/CoreFoundation/CFTimeZone.c @@ -21,9 +21,9 @@ #include #include #include -#include -#include -#include +#include <_foundation_unicode/ucal.h> +#include <_foundation_unicode/udat.h> +#include <_foundation_unicode/ustring.h> #include "CFDateFormatter.h" #if TARGET_OS_MAC || TARGET_OS_LINUX || TARGET_OS_BSD || TARGET_OS_WASI #include diff --git a/Sources/CoreFoundation/CMakeLists.txt b/Sources/CoreFoundation/CMakeLists.txt new file mode 100644 index 0000000000..b5e62d7943 --- /dev/null +++ b/Sources/CoreFoundation/CMakeLists.txt @@ -0,0 +1,125 @@ +##===----------------------------------------------------------------------===## +## +## This source file is part of the Swift open source project +## +## Copyright (c) 2024 Apple Inc. and the Swift project authors +## Licensed under Apache License v2.0 +## +## See LICENSE.txt for license information +## See CONTRIBUTORS.md for the list of Swift project authors +## +## SPDX-License-Identifier: Apache-2.0 +## +##===----------------------------------------------------------------------===## + +add_library(CoreFoundation STATIC + CFApplicationPreferences.c + CFArray.c + CFAttributedString.c + CFBag.c + CFBase.c + CFBasicHash.c + CFBigNumber.c + CFBinaryHeap.c + CFBinaryPList.c + CFBitVector.c + CFBuiltinConverters.c + CFBundle_Binary.c + CFBundle_DebugStrings.c + CFBundle_Executable.c + CFBundle_Grok.c + CFBundle_InfoPlist.c + CFBundle_Locale.c + CFBundle_Main.c + CFBundle_ResourceFork.c + CFBundle_Resources.c + CFBundle_SplitFileName.c + CFBundle_Strings.c + CFBundle_Tables.c + CFBundle.c + CFBurstTrie.c + CFCalendar_Enumerate.c + CFCalendar.c + CFCharacterSet.c + CFConcreteStreams.c + CFData.c + CFDate.c + CFDateComponents.c + CFDateFormatter.c + CFDateInterval.c + CFDateIntervalFormatter.c + CFDictionary.c + CFError.c + CFFileUtilities.c + CFICUConverters.c + CFKnownLocations.c + CFListFormatter.c + CFLocale.c + CFLocaleIdentifier.c + CFLocaleKeys.c + CFNumber.c + CFNumberFormatter.c + CFOldStylePList.c + CFPlatform.c + CFPlatformConverters.c + CFPlugIn.c + CFPreferences.c + CFPropertyList.c + CFRegularExpression.c + CFRelativeDateTimeFormatter.c + CFRunArray.c + CFRunLoop.c + CFRuntime.c + CFSet.c + CFSocket.c + CFSocketStream.c + CFSortFunctions.c + CFStorage.c + CFStream.c + CFString.c + CFStringEncodingConverter.c + CFStringEncodingDatabase.c + CFStringEncodings.c + CFStringScanner.c + CFStringTransform.c + CFStringUtilities.c + CFSystemDirectories.c + CFTimeZone.c + CFTree.c + CFUniChar.c + CFUnicodeDecomposition.c + CFUnicodePrecomposition.c + CFURL.c + CFURLAccess.c + CFURLComponents_URIParser.c + CFURLComponents.c + CFUtilities.c + CFUUID.c + CFWindowsUtilities.c + CFXMLPreferencesDomain.c + data.c + runtime.c + uuid.c) + +target_include_directories(CoreFoundation + PUBLIC + include + PRIVATE + internalInclude) + +target_compile_options(CoreFoundation PRIVATE + "SHELL:$<$:${_Foundation_common_build_flags}>") + +target_precompile_headers(CoreFoundation PRIVATE internalInclude/CoreFoundation_Prefix.h) + +target_link_libraries(CoreFoundation + PRIVATE + _FoundationICU + dispatch) + +set_property(GLOBAL APPEND PROPERTY Foundation_EXPORTS CoreFoundation) + +install(DIRECTORY + include/ + DESTINATION + lib/swift/CoreFoundation) diff --git a/Sources/CoreFoundation/include/CoreFoundation.h b/Sources/CoreFoundation/include/CoreFoundation.h index 64d38adff0..a66e7e614d 100644 --- a/Sources/CoreFoundation/include/CoreFoundation.h +++ b/Sources/CoreFoundation/include/CoreFoundation.h @@ -76,7 +76,7 @@ #include "ForSwiftFoundationOnly.h" -#if TARGET_OS_OSX || TARGET_OS_IPHONE || TARGET_OS_WIN32 +#if TARGET_OS_OSX || TARGET_OS_IPHONE || TARGET_OS_WIN32 || TARGET_OS_LINUX #include "CFMessagePort.h" #include "CFPlugIn.h" #include "CFRunLoop.h" diff --git a/Sources/CoreFoundation/module.modulemap b/Sources/CoreFoundation/include/module.modulemap similarity index 73% rename from Sources/CoreFoundation/module.modulemap rename to Sources/CoreFoundation/include/module.modulemap index 0b54915621..fab2d38e13 100644 --- a/Sources/CoreFoundation/module.modulemap +++ b/Sources/CoreFoundation/include/module.modulemap @@ -1,4 +1,4 @@ -framework module _CoreFoundation [extern_c] [system] { +module CoreFoundation { umbrella header "CoreFoundation.h" explicit module CFPlugInCOM { header "CFPlugInCOM.h" } diff --git a/Sources/CoreFoundation/static-module.map b/Sources/CoreFoundation/include/static-module.map similarity index 100% rename from Sources/CoreFoundation/static-module.map rename to Sources/CoreFoundation/include/static-module.map diff --git a/Sources/CoreFoundation/internalInclude/CFCalendar_Internal.h b/Sources/CoreFoundation/internalInclude/CFCalendar_Internal.h index 7e6bf35154..32e779916e 100644 --- a/Sources/CoreFoundation/internalInclude/CFCalendar_Internal.h +++ b/Sources/CoreFoundation/internalInclude/CFCalendar_Internal.h @@ -21,8 +21,8 @@ #include "CFDateComponents.h" #include "CFDateInterval.h" -#if __has_include() && !defined(__cplusplus) -#include +#if __has_include(<_foundation_unicode/ucal.h>) && !defined(__cplusplus) +#include <_foundation_unicode/ucal.h> #else typedef void *UCalendar; #endif diff --git a/Sources/CoreFoundation/internalInclude/CFICULogging.h b/Sources/CoreFoundation/internalInclude/CFICULogging.h index d521debf79..2d84299e95 100644 --- a/Sources/CoreFoundation/internalInclude/CFICULogging.h +++ b/Sources/CoreFoundation/internalInclude/CFICULogging.h @@ -15,15 +15,15 @@ #if !defined(__COREFOUNDATION_CFICULOGGING__) #define __COREFOUNDATION_CFICULOGGING__ 1 -#include -#include -#include -#include -#include -#include -#include -#if __has_include() -#include +#include <_foundation_unicode/ucal.h> +#include <_foundation_unicode/udatpg.h> +#include <_foundation_unicode/udat.h> +#include <_foundation_unicode/unum.h> +#include <_foundation_unicode/ulistformatter.h> +#include <_foundation_unicode/ucurr.h> +#include <_foundation_unicode/ustring.h> +#if __has_include(<_foundation_unicode/ureldatefmt.h>) +#include <_foundation_unicode/ureldatefmt.h> #endif #if !DEPLOYMENT_RUNTIME_SWIFT && __has_include() diff --git a/Sources/CoreFoundation/module.map b/Sources/CoreFoundation/module.map deleted file mode 100644 index 828ec7f806..0000000000 --- a/Sources/CoreFoundation/module.map +++ /dev/null @@ -1,4 +0,0 @@ -module _CoreFoundation [extern_c] [system] { - umbrella header "CoreFoundation.h" - explicit module CFPlugInCOM { header "CFPlugInCOM.h" } -} diff --git a/Sources/Foundation/Bridging.swift b/Sources/Foundation/Bridging.swift index 5ed8f7309a..4539058325 100644 --- a/Sources/Foundation/Bridging.swift +++ b/Sources/Foundation/Bridging.swift @@ -10,7 +10,7 @@ // //===----------------------------------------------------------------------===// -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation #if canImport(ObjectiveC) import ObjectiveC diff --git a/Sources/Foundation/Bundle.swift b/Sources/Foundation/Bundle.swift index 943feee8f0..b8b36d6426 100644 --- a/Sources/Foundation/Bundle.swift +++ b/Sources/Foundation/Bundle.swift @@ -7,7 +7,7 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation @_silgen_name("swift_getTypeContextDescriptor") private func _getTypeContextDescriptor(of cls: AnyClass) -> UnsafeRawPointer diff --git a/Sources/Foundation/CMakeLists.txt b/Sources/Foundation/CMakeLists.txt new file mode 100644 index 0000000000..ea2fd38d6b --- /dev/null +++ b/Sources/Foundation/CMakeLists.txt @@ -0,0 +1,166 @@ +##===----------------------------------------------------------------------===## +## +## This source file is part of the Swift open source project +## +## Copyright (c) 2024 Apple Inc. and the Swift project authors +## Licensed under Apache License v2.0 +## +## See LICENSE.txt for license information +## See CONTRIBUTORS.md for the list of Swift project authors +## +## SPDX-License-Identifier: Apache-2.0 +## +##===----------------------------------------------------------------------===## + +add_library(Foundation + AffineTransform.swift + Array.swift + Boxing.swift + Bridging.swift + Bundle.swift + ByteCountFormatter.swift + CGFloat.swift + CharacterSet.swift + Codable.swift + DateComponents.swift + DateComponentsFormatter.swift + DateFormatter.swift + DateInterval.swift + DateIntervalFormatter.swift + Decimal.swift + Dictionary.swift + DispatchData+DataProtocol.swift + EnergyFormatter.swift + Essentials.swift + ExtraStringAPIs.swift + FileHandle.swift + FileManager.swift + FileManager+POSIX.swift + FileManager+Win32.swift + Formatter.swift + FoundationErrors.swift + Host.swift + IndexPath.swift + IndexSet.swift + ISO8601DateFormatter.swift + JSONDecoder.swift + JSONEncoder.swift + JSONSerialization.swift + JSONSerialization+Parser.swift + LengthFormatter.swift + MassFormatter.swift + Measurement.swift + MeasurementFormatter.swift + Morphology.swift + Notification.swift + NotificationQueue.swift + NSArray.swift + NSAttributedString.swift + NSCache.swift + NSCalendar.swift + NSCFArray.swift + NSCFBoolean.swift + NSCFCharacterSet.swift + NSCFDictionary.swift + NSCFSet.swift + NSCFString.swift + NSCFTypeShims.swift + NSCharacterSet.swift + NSCoder.swift + NSComparisonPredicate.swift + NSCompoundPredicate.swift + NSConcreteValue.swift + NSData.swift + NSData+DataProtocol.swift + NSDate.swift + NSDateComponents.swift + NSDecimalNumber.swift + NSDictionary.swift + NSEnumerator.swift + NSError.swift + NSExpression.swift + NSGeometry.swift + NSIndexPath.swift + NSIndexSet.swift + NSKeyedArchiver.swift + NSKeyedArchiverHelpers.swift + NSKeyedCoderOldStyleArray.swift + NSKeyedUnarchiver.swift + NSLocale.swift + NSLock.swift + NSLog.swift + NSMeasurement.swift + NSNotification.swift + NSNull.swift + NSNumber.swift + NSObjCRuntime.swift + NSObject.swift + NSOrderedSet.swift + NSPathUtilities.swift + NSPersonNameComponents.swift + NSPlatform.swift + NSPredicate.swift + NSRange.swift + NSRegularExpression.swift + NSSet.swift + NSSortDescriptor.swift + NSSpecialValue.swift + NSString.swift + NSStringAPI.swift + NSSwiftRuntime.swift + NSTextCheckingResult.swift + NSTimeZone.swift + NSURL.swift + NSURLComponents.swift + NSURLError.swift + NSURLQueryItem.swift + NSUUID.swift + NSValue.swift + NumberFormatter.swift + Operation.swift + PersonNameComponents.swift + PersonNameComponentsFormatter.swift + Port.swift + PortMessage.swift + Process.swift + ProcessInfo.swift + Progress.swift + ProgressFraction.swift + PropertyListSerialization.swift + ReferenceConvertible.swift + RunLoop.swift + Scanner.swift + ScannerAPI.swift + Set.swift + Stream.swift + String.swift + StringEncodings.swift + Thread.swift + Timer.swift + Unit.swift + URL.swift + URLComponents.swift + URLQueryItem.swift + URLResourceKey.swift + UserDefaults.swift + UUID.swift + WinSDK+Extensions.swift) + +target_compile_options(Foundation PRIVATE + "SHELL:$<$:${_Foundation_swift_build_flags}>") + +target_link_libraries(Foundation + PUBLIC + CoreFoundation + FoundationEssentials + FoundationInternationalization) + +set_target_properties(Foundation PROPERTIES + INSTALL_RPATH "$ORIGIN" + BUILD_RPATH "$") + +target_link_libraries(Foundation PUBLIC + swiftDispatch) + +set_property(GLOBAL APPEND PROPERTY Foundation_EXPORTS Foundation) +_foundation_install_target(Foundation) diff --git a/Sources/Foundation/DateComponents.swift b/Sources/Foundation/DateComponents.swift index 6c5258b6bd..95865d25bb 100644 --- a/Sources/Foundation/DateComponents.swift +++ b/Sources/Foundation/DateComponents.swift @@ -10,7 +10,7 @@ // //===----------------------------------------------------------------------===// -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation extension DateComponents : ReferenceConvertible { public typealias ReferenceType = NSDateComponents diff --git a/Sources/Foundation/DateFormatter.swift b/Sources/Foundation/DateFormatter.swift index a793896274..dee69a03dd 100644 --- a/Sources/Foundation/DateFormatter.swift +++ b/Sources/Foundation/DateFormatter.swift @@ -7,7 +7,7 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation @_spi(SwiftCorelibsFoundation) import FoundationEssentials open class DateFormatter : Formatter { diff --git a/Sources/Foundation/DateInterval.swift b/Sources/Foundation/DateInterval.swift index 02b790f1f7..e84833d3bb 100644 --- a/Sources/Foundation/DateInterval.swift +++ b/Sources/Foundation/DateInterval.swift @@ -10,7 +10,7 @@ // //===----------------------------------------------------------------------===// -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation extension DateInterval : _ObjectiveCBridgeable { public static func _isBridgedToObjectiveC() -> Bool { diff --git a/Sources/Foundation/DateIntervalFormatter.swift b/Sources/Foundation/DateIntervalFormatter.swift index c5e4f24fee..7a08780b7c 100644 --- a/Sources/Foundation/DateIntervalFormatter.swift +++ b/Sources/Foundation/DateIntervalFormatter.swift @@ -7,7 +7,7 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation internal let kCFDateIntervalFormatterNoStyle = CFDateIntervalFormatterStyle.noStyle internal let kCFDateIntervalFormatterShortStyle = CFDateIntervalFormatterStyle.shortStyle diff --git a/Sources/Foundation/Dictionary.swift b/Sources/Foundation/Dictionary.swift index eb35e22e94..fa0b5079bf 100644 --- a/Sources/Foundation/Dictionary.swift +++ b/Sources/Foundation/Dictionary.swift @@ -7,7 +7,7 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation extension Dictionary : _ObjectiveCBridgeable { diff --git a/Sources/Foundation/FileHandle.swift b/Sources/Foundation/FileHandle.swift index 2b5f5e8262..72ab09a3f6 100644 --- a/Sources/Foundation/FileHandle.swift +++ b/Sources/Foundation/FileHandle.swift @@ -7,7 +7,7 @@ // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation #if canImport(Dispatch) import Dispatch #endif diff --git a/Sources/Foundation/FileManager+POSIX.swift b/Sources/Foundation/FileManager+POSIX.swift index f32e5aa2c0..5ec30db4ea 100644 --- a/Sources/Foundation/FileManager+POSIX.swift +++ b/Sources/Foundation/FileManager+POSIX.swift @@ -13,7 +13,7 @@ internal func &(left: UInt32, right: mode_t) -> mode_t { } #endif -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation #if os(WASI) import WASILibc @@ -27,7 +27,7 @@ internal var O_TRUNC: Int32 { _getConst_O_TRUNC() } internal var O_WRONLY: Int32 { _getConst_O_WRONLY() } #endif -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation extension FileManager { internal func _mountedVolumeURLs(includingResourceValuesForKeys propertyKeys: [URLResourceKey]?, options: VolumeEnumerationOptions = []) -> [URL]? { diff --git a/Sources/Foundation/FileManager+Win32.swift b/Sources/Foundation/FileManager+Win32.swift index f53fe3995b..1e8379600c 100644 --- a/Sources/Foundation/FileManager+Win32.swift +++ b/Sources/Foundation/FileManager+Win32.swift @@ -7,7 +7,7 @@ // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation #if os(Windows) import let WinSDK.INVALID_FILE_ATTRIBUTES diff --git a/Sources/Foundation/FileManager.swift b/Sources/Foundation/FileManager.swift index 64f5da9d76..6f1c7286d2 100644 --- a/Sources/Foundation/FileManager.swift +++ b/Sources/Foundation/FileManager.swift @@ -13,7 +13,7 @@ fileprivate let SF_IMMUTABLE: Int32 = 1 fileprivate let UF_HIDDEN: Int32 = 1 #endif -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation #if os(Windows) import CRT import WinSDK diff --git a/Sources/Foundation/Host.swift b/Sources/Foundation/Host.swift index 860a4812c0..b5205ebb76 100644 --- a/Sources/Foundation/Host.swift +++ b/Sources/Foundation/Host.swift @@ -7,7 +7,7 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation #if os(Windows) import WinSDK #endif diff --git a/Sources/Foundation/ISO8601DateFormatter.swift b/Sources/Foundation/ISO8601DateFormatter.swift index ffc03833d7..9949b787d0 100644 --- a/Sources/Foundation/ISO8601DateFormatter.swift +++ b/Sources/Foundation/ISO8601DateFormatter.swift @@ -7,7 +7,7 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation extension ISO8601DateFormatter { diff --git a/Sources/Foundation/JSONDecoder.swift b/Sources/Foundation/JSONDecoder.swift index f8cb339aac..aef6c2a0f6 100644 --- a/Sources/Foundation/JSONDecoder.swift +++ b/Sources/Foundation/JSONDecoder.swift @@ -10,7 +10,7 @@ // //===----------------------------------------------------------------------===// -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation /// A marker protocol used to determine whether a value is a `String`-keyed `Dictionary` /// containing `Decodable` values (in which case it should be exempt from key conversion strategies). diff --git a/Sources/Foundation/JSONEncoder.swift b/Sources/Foundation/JSONEncoder.swift index 71786f747e..df26ca3dca 100644 --- a/Sources/Foundation/JSONEncoder.swift +++ b/Sources/Foundation/JSONEncoder.swift @@ -10,7 +10,7 @@ // //===----------------------------------------------------------------------===// -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation /// A marker protocol used to determine whether a value is a `String`-keyed `Dictionary` /// containing `Encodable` values (in which case it should be exempt from key conversion strategies). diff --git a/Sources/Foundation/JSONSerialization.swift b/Sources/Foundation/JSONSerialization.swift index 549be815f5..e5f9eb0252 100644 --- a/Sources/Foundation/JSONSerialization.swift +++ b/Sources/Foundation/JSONSerialization.swift @@ -10,7 +10,7 @@ // //===----------------------------------------------------------------------===// -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation extension JSONSerialization { public struct ReadingOptions : OptionSet { diff --git a/Sources/Foundation/Measurement.swift b/Sources/Foundation/Measurement.swift index f9b30e64f5..028048675f 100644 --- a/Sources/Foundation/Measurement.swift +++ b/Sources/Foundation/Measurement.swift @@ -11,7 +11,7 @@ //===----------------------------------------------------------------------===// #if DEPLOYMENT_RUNTIME_SWIFT -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation #else @_exported import Foundation // Clang module import _SwiftCoreFoundationOverlayShims diff --git a/Sources/Foundation/NSArray.swift b/Sources/Foundation/NSArray.swift index 0c71b26436..096c090b51 100644 --- a/Sources/Foundation/NSArray.swift +++ b/Sources/Foundation/NSArray.swift @@ -7,7 +7,7 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation open class NSArray : NSObject, NSCopying, NSMutableCopying, NSSecureCoding, NSCoding, ExpressibleByArrayLiteral { private let _cfinfo = _CFInfo(typeID: CFArrayGetTypeID()) diff --git a/Sources/Foundation/NSAttributedString.swift b/Sources/Foundation/NSAttributedString.swift index d9e74b2b85..4f7523f179 100644 --- a/Sources/Foundation/NSAttributedString.swift +++ b/Sources/Foundation/NSAttributedString.swift @@ -7,7 +7,7 @@ // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation extension NSAttributedString { public struct Key: RawRepresentable, Equatable, Hashable { diff --git a/Sources/Foundation/NSCFArray.swift b/Sources/Foundation/NSCFArray.swift index 6a0e7d8e8f..fb94518e4a 100644 --- a/Sources/Foundation/NSCFArray.swift +++ b/Sources/Foundation/NSCFArray.swift @@ -8,7 +8,7 @@ // -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation internal final class _NSCFArray : NSMutableArray { deinit { diff --git a/Sources/Foundation/NSCFBoolean.swift b/Sources/Foundation/NSCFBoolean.swift index 706c601221..adb48ac535 100644 --- a/Sources/Foundation/NSCFBoolean.swift +++ b/Sources/Foundation/NSCFBoolean.swift @@ -8,7 +8,7 @@ // -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation internal class __NSCFBoolean : NSNumber { override var hash: Int { diff --git a/Sources/Foundation/NSCFCharacterSet.swift b/Sources/Foundation/NSCFCharacterSet.swift index 7db1632795..b4431b7547 100644 --- a/Sources/Foundation/NSCFCharacterSet.swift +++ b/Sources/Foundation/NSCFCharacterSet.swift @@ -6,7 +6,7 @@ // Copyright © 2016 Apple. All rights reserved. // -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation internal class _NSCFCharacterSet : NSMutableCharacterSet { diff --git a/Sources/Foundation/NSCFDictionary.swift b/Sources/Foundation/NSCFDictionary.swift index 1f031195d7..4d7269f588 100644 --- a/Sources/Foundation/NSCFDictionary.swift +++ b/Sources/Foundation/NSCFDictionary.swift @@ -8,7 +8,7 @@ // -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation internal final class _NSCFDictionary : NSMutableDictionary { deinit { diff --git a/Sources/Foundation/NSCFSet.swift b/Sources/Foundation/NSCFSet.swift index d65c9843db..6b90fd71d7 100644 --- a/Sources/Foundation/NSCFSet.swift +++ b/Sources/Foundation/NSCFSet.swift @@ -8,7 +8,7 @@ // -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation internal final class _NSCFSet : NSMutableSet { deinit { diff --git a/Sources/Foundation/NSCFString.swift b/Sources/Foundation/NSCFString.swift index f006f1db9b..40ee579f42 100644 --- a/Sources/Foundation/NSCFString.swift +++ b/Sources/Foundation/NSCFString.swift @@ -8,7 +8,7 @@ // -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation @usableFromInline internal class _NSCFString : NSMutableString { diff --git a/Sources/Foundation/NSCalendar.swift b/Sources/Foundation/NSCalendar.swift index 3ab8b16c65..25e1a7054a 100644 --- a/Sources/Foundation/NSCalendar.swift +++ b/Sources/Foundation/NSCalendar.swift @@ -7,7 +7,7 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation @_spi(SwiftCorelibsFoundation) @_exported import FoundationEssentials internal let kCFCalendarUnitEra = CFCalendarUnit.era @@ -23,7 +23,7 @@ internal let kCFCalendarUnitQuarter = CFCalendarUnit.quarter internal let kCFCalendarUnitWeekOfMonth = CFCalendarUnit.weekOfMonth internal let kCFCalendarUnitWeekOfYear = CFCalendarUnit.weekOfYear internal let kCFCalendarUnitYearForWeekOfYear = CFCalendarUnit.yearForWeekOfYear -internal let kCFCalendarUnitNanosecond = CFCalendarUnit(rawValue: CFOptionFlags(_CoreFoundation.kCFCalendarUnitNanosecond)) +internal let kCFCalendarUnitNanosecond = CFCalendarUnit(rawValue: CFOptionFlags(CoreFoundation.kCFCalendarUnitNanosecond)) internal func _CFCalendarUnitRawValue(_ unit: CFCalendarUnit) -> CFOptionFlags { return unit.rawValue diff --git a/Sources/Foundation/NSCharacterSet.swift b/Sources/Foundation/NSCharacterSet.swift index 08090529e7..b1491b340f 100644 --- a/Sources/Foundation/NSCharacterSet.swift +++ b/Sources/Foundation/NSCharacterSet.swift @@ -8,7 +8,7 @@ // -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation let kCFCharacterSetControl = CFCharacterSetPredefinedSet.control let kCFCharacterSetWhitespace = CFCharacterSetPredefinedSet.whitespace diff --git a/Sources/Foundation/NSConcreteValue.swift b/Sources/Foundation/NSConcreteValue.swift index dba8c1c7d6..ea796c8825 100644 --- a/Sources/Foundation/NSConcreteValue.swift +++ b/Sources/Foundation/NSConcreteValue.swift @@ -7,7 +7,7 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation internal class NSConcreteValue : NSValue { diff --git a/Sources/Foundation/NSData.swift b/Sources/Foundation/NSData.swift index 6125dc3491..21b1230d35 100644 --- a/Sources/Foundation/NSData.swift +++ b/Sources/Foundation/NSData.swift @@ -7,7 +7,7 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation #if !os(WASI) import Dispatch #endif diff --git a/Sources/Foundation/NSDate.swift b/Sources/Foundation/NSDate.swift index 2d9da87b8a..677d883c7e 100644 --- a/Sources/Foundation/NSDate.swift +++ b/Sources/Foundation/NSDate.swift @@ -7,7 +7,7 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation public typealias TimeInterval = Double diff --git a/Sources/Foundation/NSDateComponents.swift b/Sources/Foundation/NSDateComponents.swift index 9967f819c2..03757bb26e 100644 --- a/Sources/Foundation/NSDateComponents.swift +++ b/Sources/Foundation/NSDateComponents.swift @@ -8,7 +8,7 @@ // @_exported import FoundationEssentials -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation // This is a just used as an extensible struct, basically; diff --git a/Sources/Foundation/NSDictionary.swift b/Sources/Foundation/NSDictionary.swift index 47b147fb91..c1d118088a 100644 --- a/Sources/Foundation/NSDictionary.swift +++ b/Sources/Foundation/NSDictionary.swift @@ -8,7 +8,7 @@ // -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation #if !os(WASI) import Dispatch diff --git a/Sources/Foundation/NSError.swift b/Sources/Foundation/NSError.swift index 5fc309e1c6..d84e54e5c7 100644 --- a/Sources/Foundation/NSError.swift +++ b/Sources/Foundation/NSError.swift @@ -18,7 +18,7 @@ import Glibc import CRT #endif -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation public typealias NSErrorDomain = NSString diff --git a/Sources/Foundation/NSKeyedArchiver.swift b/Sources/Foundation/NSKeyedArchiver.swift index 13682c3ae2..c09c682222 100644 --- a/Sources/Foundation/NSKeyedArchiver.swift +++ b/Sources/Foundation/NSKeyedArchiver.swift @@ -7,7 +7,7 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation /// Archives created using the class method `archivedData(withRootObject:)` use this key /// for the root object in the hierarchy of encoded objects. The `NSKeyedUnarchiver` class method diff --git a/Sources/Foundation/NSKeyedArchiverHelpers.swift b/Sources/Foundation/NSKeyedArchiverHelpers.swift index e528acce7e..341936d851 100644 --- a/Sources/Foundation/NSKeyedArchiverHelpers.swift +++ b/Sources/Foundation/NSKeyedArchiverHelpers.swift @@ -7,7 +7,7 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation extension CFKeyedArchiverUID : _NSBridgeable { typealias NSType = _NSKeyedArchiverUID diff --git a/Sources/Foundation/NSKeyedCoderOldStyleArray.swift b/Sources/Foundation/NSKeyedCoderOldStyleArray.swift index 4bcf458c8c..72b48c0215 100644 --- a/Sources/Foundation/NSKeyedCoderOldStyleArray.swift +++ b/Sources/Foundation/NSKeyedCoderOldStyleArray.swift @@ -7,7 +7,7 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation internal final class _NSKeyedCoderOldStyleArray : NSObject, NSCopying, NSSecureCoding, NSCoding { diff --git a/Sources/Foundation/NSKeyedUnarchiver.swift b/Sources/Foundation/NSKeyedUnarchiver.swift index cd2784d20f..0c76f3a61b 100644 --- a/Sources/Foundation/NSKeyedUnarchiver.swift +++ b/Sources/Foundation/NSKeyedUnarchiver.swift @@ -7,7 +7,7 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation open class NSKeyedUnarchiver : NSCoder { enum InternalError: Error { diff --git a/Sources/Foundation/NSLocale.swift b/Sources/Foundation/NSLocale.swift index 5c3c33fa74..6d4215a12f 100644 --- a/Sources/Foundation/NSLocale.swift +++ b/Sources/Foundation/NSLocale.swift @@ -8,7 +8,7 @@ // -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation @_spi(SwiftCorelibsFoundation) @_exported import FoundationEssentials @_exported import FoundationInternationalization diff --git a/Sources/Foundation/NSLock.swift b/Sources/Foundation/NSLock.swift index a8866ae15b..fa56161caa 100644 --- a/Sources/Foundation/NSLock.swift +++ b/Sources/Foundation/NSLock.swift @@ -7,7 +7,7 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation #if canImport(Glibc) import Glibc diff --git a/Sources/Foundation/NSLog.swift b/Sources/Foundation/NSLog.swift index b1a8f568a5..ede48862b9 100644 --- a/Sources/Foundation/NSLog.swift +++ b/Sources/Foundation/NSLog.swift @@ -7,7 +7,7 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation /* Output from NSLogv is serialized, in that only one thread in a process can be doing * the writing/logging described above at a time. All attempts at writing/logging a diff --git a/Sources/Foundation/NSNumber.swift b/Sources/Foundation/NSNumber.swift index cd55f0023a..82d4481a99 100644 --- a/Sources/Foundation/NSNumber.swift +++ b/Sources/Foundation/NSNumber.swift @@ -8,7 +8,7 @@ // -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation @_spi(SwiftCorelibsFoundation) @_exported import FoundationEssentials internal let kCFNumberSInt8Type = CFNumberType.sInt8Type diff --git a/Sources/Foundation/NSObjCRuntime.swift b/Sources/Foundation/NSObjCRuntime.swift index 25761b372c..ce75a1fcc2 100644 --- a/Sources/Foundation/NSObjCRuntime.swift +++ b/Sources/Foundation/NSObjCRuntime.swift @@ -8,7 +8,7 @@ // -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation internal let kCFCompareLessThan = CFComparisonResult.compareLessThan internal let kCFCompareEqualTo = CFComparisonResult.compareEqualTo diff --git a/Sources/Foundation/NSObject.swift b/Sources/Foundation/NSObject.swift index 8d65b88cac..a2bbd0b77d 100644 --- a/Sources/Foundation/NSObject.swift +++ b/Sources/Foundation/NSObject.swift @@ -14,7 +14,7 @@ @_exported import Dispatch #endif -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation /// The `NSObjectProtocol` groups methods that are fundamental to all Foundation objects. /// diff --git a/Sources/Foundation/NSPathUtilities.swift b/Sources/Foundation/NSPathUtilities.swift index ee326d29ed..96c41c2816 100644 --- a/Sources/Foundation/NSPathUtilities.swift +++ b/Sources/Foundation/NSPathUtilities.swift @@ -7,7 +7,7 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation #if os(Windows) import WinSDK #elseif os(WASI) diff --git a/Sources/Foundation/NSRange.swift b/Sources/Foundation/NSRange.swift index 91ae61dd6c..3ec747b0db 100644 --- a/Sources/Foundation/NSRange.swift +++ b/Sources/Foundation/NSRange.swift @@ -9,7 +9,7 @@ #if DEPLOYMENT_RUNTIME_SWIFT -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation public struct _NSRange { public var location: Int diff --git a/Sources/Foundation/NSRegularExpression.swift b/Sources/Foundation/NSRegularExpression.swift index fc8a352540..24adba513a 100644 --- a/Sources/Foundation/NSRegularExpression.swift +++ b/Sources/Foundation/NSRegularExpression.swift @@ -10,7 +10,7 @@ /* NSRegularExpression is a class used to represent and apply regular expressions. An instance of this class is an immutable representation of a compiled regular expression pattern and various option flags. */ -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation extension NSRegularExpression { public struct Options : OptionSet { diff --git a/Sources/Foundation/NSSet.swift b/Sources/Foundation/NSSet.swift index 85bd2bcb95..7f2318d6de 100644 --- a/Sources/Foundation/NSSet.swift +++ b/Sources/Foundation/NSSet.swift @@ -8,7 +8,7 @@ // -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation open class NSSet : NSObject, NSCopying, NSMutableCopying, NSSecureCoding, NSCoding { private let _cfinfo = _CFInfo(typeID: CFSetGetTypeID()) diff --git a/Sources/Foundation/NSSortDescriptor.swift b/Sources/Foundation/NSSortDescriptor.swift index d99afe882a..03b52bd659 100644 --- a/Sources/Foundation/NSSortDescriptor.swift +++ b/Sources/Foundation/NSSortDescriptor.swift @@ -7,7 +7,7 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation // In swift-corelibs-foundation, key-value coding is not available. Since encoding and decoding a NSSortDescriptor requires interpreting key paths, NSSortDescriptor does not conform to NSCoding or NSSecureCoding in swift-corelibs-foundation only. open class NSSortDescriptor: NSObject, NSCopying { diff --git a/Sources/Foundation/NSString.swift b/Sources/Foundation/NSString.swift index aabefdfecb..d0a1649690 100644 --- a/Sources/Foundation/NSString.swift +++ b/Sources/Foundation/NSString.swift @@ -8,7 +8,7 @@ // -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation public typealias unichar = UInt16 diff --git a/Sources/Foundation/NSSwiftRuntime.swift b/Sources/Foundation/NSSwiftRuntime.swift index 73042c84aa..6d1aa0d372 100644 --- a/Sources/Foundation/NSSwiftRuntime.swift +++ b/Sources/Foundation/NSSwiftRuntime.swift @@ -8,7 +8,7 @@ // -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation // Re-export Darwin and Glibc by importing Foundation // This mimics the behavior of the swift sdk overlay on Darwin diff --git a/Sources/Foundation/NSTextCheckingResult.swift b/Sources/Foundation/NSTextCheckingResult.swift index d03b969007..d55176dc78 100644 --- a/Sources/Foundation/NSTextCheckingResult.swift +++ b/Sources/Foundation/NSTextCheckingResult.swift @@ -7,7 +7,7 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation /* NSTextCheckingType in this project is limited to regular expressions. */ extension NSTextCheckingResult { diff --git a/Sources/Foundation/NSTimeZone.swift b/Sources/Foundation/NSTimeZone.swift index 9a26a520f3..97480e96af 100644 --- a/Sources/Foundation/NSTimeZone.swift +++ b/Sources/Foundation/NSTimeZone.swift @@ -7,7 +7,7 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation @_spi(SwiftCorelibsFoundation) @_exported import FoundationEssentials open class NSTimeZone : NSObject, NSCopying, NSSecureCoding, NSCoding { diff --git a/Sources/Foundation/NSURL.swift b/Sources/Foundation/NSURL.swift index def389037f..70cdd49886 100644 --- a/Sources/Foundation/NSURL.swift +++ b/Sources/Foundation/NSURL.swift @@ -8,7 +8,7 @@ // -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation #if os(Windows) import WinSDK #endif diff --git a/Sources/Foundation/NSURLComponents.swift b/Sources/Foundation/NSURLComponents.swift index 470b9f3bc8..87583cd27e 100644 --- a/Sources/Foundation/NSURLComponents.swift +++ b/Sources/Foundation/NSURLComponents.swift @@ -7,7 +7,7 @@ // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation open class NSURLComponents: NSObject, NSCopying { diff --git a/Sources/Foundation/NSUUID.swift b/Sources/Foundation/NSUUID.swift index 722b32bdae..00acd6890f 100644 --- a/Sources/Foundation/NSUUID.swift +++ b/Sources/Foundation/NSUUID.swift @@ -8,7 +8,7 @@ // -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation open class NSUUID : NSObject, NSCopying, NSSecureCoding, NSCoding { internal var buffer = UnsafeMutablePointer.allocate(capacity: 16) diff --git a/Sources/Foundation/NotificationQueue.swift b/Sources/Foundation/NotificationQueue.swift index 2c0aa70d52..bf3e5d8e39 100644 --- a/Sources/Foundation/NotificationQueue.swift +++ b/Sources/Foundation/NotificationQueue.swift @@ -8,7 +8,7 @@ // #if canImport(Dispatch) -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation extension NotificationQueue { diff --git a/Sources/Foundation/NumberFormatter.swift b/Sources/Foundation/NumberFormatter.swift index 4754ce0d50..1fb0739cb4 100644 --- a/Sources/Foundation/NumberFormatter.swift +++ b/Sources/Foundation/NumberFormatter.swift @@ -7,7 +7,7 @@ // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation extension NumberFormatter { public enum Style : UInt { diff --git a/Sources/Foundation/Port.swift b/Sources/Foundation/Port.swift index 7ae84aaa35..c53263f0ef 100644 --- a/Sources/Foundation/Port.swift +++ b/Sources/Foundation/Port.swift @@ -7,7 +7,7 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation // MARK: Port and related types diff --git a/Sources/Foundation/Process.swift b/Sources/Foundation/Process.swift index d6a5045400..0f32045e49 100644 --- a/Sources/Foundation/Process.swift +++ b/Sources/Foundation/Process.swift @@ -8,7 +8,7 @@ // #if canImport(Dispatch) -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation #if os(Windows) import WinSDK import let WinSDK.HANDLE_FLAG_INHERIT diff --git a/Sources/Foundation/ProcessInfo.swift b/Sources/Foundation/ProcessInfo.swift index e7928d53cd..f023ff6291 100644 --- a/Sources/Foundation/ProcessInfo.swift +++ b/Sources/Foundation/ProcessInfo.swift @@ -7,7 +7,7 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation // SPI for TestFoundation internal extension ProcessInfo { diff --git a/Sources/Foundation/PropertyListSerialization.swift b/Sources/Foundation/PropertyListSerialization.swift index 9cdb861057..a9cb8a46c3 100644 --- a/Sources/Foundation/PropertyListSerialization.swift +++ b/Sources/Foundation/PropertyListSerialization.swift @@ -7,7 +7,7 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation let kCFPropertyListOpenStepFormat = CFPropertyListFormat.openStepFormat let kCFPropertyListXMLFormat_v1_0 = CFPropertyListFormat.xmlFormat_v1_0 diff --git a/Sources/Foundation/RunLoop.swift b/Sources/Foundation/RunLoop.swift index 1289cc19e0..af64bf31ec 100644 --- a/Sources/Foundation/RunLoop.swift +++ b/Sources/Foundation/RunLoop.swift @@ -7,7 +7,7 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation internal let kCFRunLoopEntry = CFRunLoopActivity.entry.rawValue internal let kCFRunLoopBeforeTimers = CFRunLoopActivity.beforeTimers.rawValue diff --git a/Sources/Foundation/Set.swift b/Sources/Foundation/Set.swift index cad8bffff1..2a636eaa91 100644 --- a/Sources/Foundation/Set.swift +++ b/Sources/Foundation/Set.swift @@ -7,7 +7,7 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation extension Set : _ObjectiveCBridgeable { public typealias _ObjectType = NSSet diff --git a/Sources/Foundation/Stream.swift b/Sources/Foundation/Stream.swift index 8ea494df62..3ea8a9d01f 100644 --- a/Sources/Foundation/Stream.swift +++ b/Sources/Foundation/Stream.swift @@ -7,7 +7,7 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation internal extension UInt { init(_ status: CFStreamStatus) { diff --git a/Sources/Foundation/String.swift b/Sources/Foundation/String.swift index 898f24151c..e1f606e4d7 100644 --- a/Sources/Foundation/String.swift +++ b/Sources/Foundation/String.swift @@ -10,7 +10,7 @@ // //===----------------------------------------------------------------------===// -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation extension String: _ObjectiveCBridgeable { diff --git a/Sources/Foundation/Thread.swift b/Sources/Foundation/Thread.swift index a59486ea59..166a5d3fe5 100644 --- a/Sources/Foundation/Thread.swift +++ b/Sources/Foundation/Thread.swift @@ -8,7 +8,7 @@ // #if canImport(Dispatch) -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation #if os(Windows) import WinSDK #endif diff --git a/Sources/Foundation/Timer.swift b/Sources/Foundation/Timer.swift index f938507b43..83a3efa0de 100644 --- a/Sources/Foundation/Timer.swift +++ b/Sources/Foundation/Timer.swift @@ -8,7 +8,7 @@ // -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation internal func __NSFireTimer(_ timer: CFRunLoopTimer?, info: UnsafeMutableRawPointer?) -> Void { let t: Timer = NSObject.unretainedReference(info!) diff --git a/Sources/Foundation/UserDefaults.swift b/Sources/Foundation/UserDefaults.swift index 78760690a8..23f035b6d6 100644 --- a/Sources/Foundation/UserDefaults.swift +++ b/Sources/Foundation/UserDefaults.swift @@ -7,7 +7,7 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation private var registeredDefaults = [String: Any]() private var sharedDefaults = UserDefaults() diff --git a/Sources/FoundationNetworking/CMakeLists.txt b/Sources/FoundationNetworking/CMakeLists.txt new file mode 100644 index 0000000000..5b738175eb --- /dev/null +++ b/Sources/FoundationNetworking/CMakeLists.txt @@ -0,0 +1,63 @@ +##===----------------------------------------------------------------------===## +## +## This source file is part of the Swift open source project +## +## Copyright (c) 2024 Apple Inc. and the Swift project authors +## Licensed under Apache License v2.0 +## +## See LICENSE.txt for license information +## See CONTRIBUTORS.md for the list of Swift project authors +## +## SPDX-License-Identifier: Apache-2.0 +## +##===----------------------------------------------------------------------===## + +add_library(FoundationNetworking + Boxing.swift + DataURLProtocol.swift + HTTPCookie.swift + HTTPCookieStorage.swift + NSURLRequest.swift + URLAuthenticationChallenge.swift + URLCache.swift + URLCredential.swift + URLCredentialStorage.swift + URLProtectionSpace.swift + URLProtocol.swift + URLRequest.swift + URLResponse.swift + URLSession/BodySource.swift + URLSession/Configuration.swift + URLSession/FTP/FTPURLProtocol.swift + URLSession/HTTP/HTTPMessage.swift + URLSession/HTTP/HTTPURLProtocol.swift + URLSession/libcurl/EasyHandle.swift + URLSession/libcurl/libcurlHelpers.swift + URLSession/libcurl/MultiHandle.swift + URLSession/Message.swift + URLSession/NativeProtocol.swift + URLSession/NetworkingSpecific.swift + URLSession/TaskRegistry.swift + URLSession/TransferState.swift + URLSession/URLSession.swift + URLSession/URLSessionConfiguration.swift + URLSession/URLSessionDelegate.swift + URLSession/URLSessionTask.swift + URLSession/URLSessionTaskMetrics.swift + URLSession/WebSocket/WebSocketURLProtocol.swift) + +target_compile_options(FoundationNetworking PRIVATE + "SHELL:$<$:${_Foundation_swift_build_flags}>") + +target_link_libraries(FoundationNetworking + PRIVATE + CoreFoundation + _CFURLSessionInterface + PUBLIC + Foundation) + +set_target_properties(FoundationNetworking PROPERTIES + INSTALL_RPATH "$ORIGIN") + +set_property(GLOBAL APPEND PROPERTY Foundation_EXPORTS FoundationNetworking) +_foundation_install_target(FoundationNetworking) diff --git a/Sources/FoundationNetworking/HTTPCookieStorage.swift b/Sources/FoundationNetworking/HTTPCookieStorage.swift index 3f1fe53a86..3961d44cc3 100644 --- a/Sources/FoundationNetworking/HTTPCookieStorage.swift +++ b/Sources/FoundationNetworking/HTTPCookieStorage.swift @@ -13,7 +13,7 @@ import SwiftFoundation import Foundation #endif -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation /*! @enum HTTPCookie.AcceptPolicy diff --git a/Sources/FoundationNetworking/URLSession/BodySource.swift b/Sources/FoundationNetworking/URLSession/BodySource.swift index 5a20839e24..e6e3f85c86 100644 --- a/Sources/FoundationNetworking/URLSession/BodySource.swift +++ b/Sources/FoundationNetworking/URLSession/BodySource.swift @@ -22,7 +22,7 @@ import SwiftFoundation import Foundation #endif -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation @_implementationOnly import _CFURLSessionInterface import Dispatch diff --git a/Sources/FoundationNetworking/URLSession/FTP/FTPURLProtocol.swift b/Sources/FoundationNetworking/URLSession/FTP/FTPURLProtocol.swift index 95a093ed27..932600cbe2 100644 --- a/Sources/FoundationNetworking/URLSession/FTP/FTPURLProtocol.swift +++ b/Sources/FoundationNetworking/URLSession/FTP/FTPURLProtocol.swift @@ -13,7 +13,7 @@ import SwiftFoundation import Foundation #endif -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation import Dispatch internal class _FTPURLProtocol: _NativeProtocol { diff --git a/Sources/FoundationNetworking/URLSession/HTTP/HTTPMessage.swift b/Sources/FoundationNetworking/URLSession/HTTP/HTTPMessage.swift index 552d866cb5..cc2e7d7f9c 100644 --- a/Sources/FoundationNetworking/URLSession/HTTP/HTTPMessage.swift +++ b/Sources/FoundationNetworking/URLSession/HTTP/HTTPMessage.swift @@ -22,7 +22,7 @@ import SwiftFoundation #else import Foundation #endif -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation internal extension _HTTPURLProtocol._ResponseHeaderLines { /// Create an `NSHTTPRULResponse` from the lines. diff --git a/Sources/FoundationNetworking/URLSession/HTTP/HTTPURLProtocol.swift b/Sources/FoundationNetworking/URLSession/HTTP/HTTPURLProtocol.swift index 098db66dc8..bf7e3f2b79 100644 --- a/Sources/FoundationNetworking/URLSession/HTTP/HTTPURLProtocol.swift +++ b/Sources/FoundationNetworking/URLSession/HTTP/HTTPURLProtocol.swift @@ -13,7 +13,7 @@ import SwiftFoundation import Foundation #endif -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation @_implementationOnly import _CFURLSessionInterface import Dispatch diff --git a/Sources/FoundationNetworking/URLSession/NativeProtocol.swift b/Sources/FoundationNetworking/URLSession/NativeProtocol.swift index aa25807add..95da2e9bdb 100644 --- a/Sources/FoundationNetworking/URLSession/NativeProtocol.swift +++ b/Sources/FoundationNetworking/URLSession/NativeProtocol.swift @@ -23,7 +23,7 @@ import SwiftFoundation import Foundation #endif -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation import Dispatch internal let enableLibcurlDebugOutput: Bool = { diff --git a/Sources/FoundationNetworking/URLSession/TaskRegistry.swift b/Sources/FoundationNetworking/URLSession/TaskRegistry.swift index 57ada5e045..3e958891dd 100644 --- a/Sources/FoundationNetworking/URLSession/TaskRegistry.swift +++ b/Sources/FoundationNetworking/URLSession/TaskRegistry.swift @@ -22,7 +22,7 @@ import SwiftFoundation import Foundation #endif -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation import Dispatch extension URLSession { diff --git a/Sources/FoundationNetworking/URLSession/TransferState.swift b/Sources/FoundationNetworking/URLSession/TransferState.swift index b8fc07f7d8..b4142c24eb 100644 --- a/Sources/FoundationNetworking/URLSession/TransferState.swift +++ b/Sources/FoundationNetworking/URLSession/TransferState.swift @@ -22,7 +22,7 @@ import SwiftFoundation #else import Foundation #endif -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation diff --git a/Sources/FoundationNetworking/URLSession/URLSession.swift b/Sources/FoundationNetworking/URLSession/URLSession.swift index 81d590c4e1..d01fc316c7 100644 --- a/Sources/FoundationNetworking/URLSession/URLSession.swift +++ b/Sources/FoundationNetworking/URLSession/URLSession.swift @@ -167,7 +167,7 @@ import SwiftFoundation #else import Foundation #endif -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation extension URLSession { public enum DelayedRequestDisposition { diff --git a/Sources/FoundationNetworking/URLSession/URLSessionTask.swift b/Sources/FoundationNetworking/URLSession/URLSessionTask.swift index 97054fe1e0..ea19743bd8 100644 --- a/Sources/FoundationNetworking/URLSession/URLSessionTask.swift +++ b/Sources/FoundationNetworking/URLSession/URLSessionTask.swift @@ -20,7 +20,7 @@ import SwiftFoundation #else import Foundation #endif -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation private class Bag { var values: [Element] = [] diff --git a/Sources/FoundationNetworking/URLSession/URLSessionTaskMetrics.swift b/Sources/FoundationNetworking/URLSession/URLSessionTaskMetrics.swift index d13c393799..035a5d802b 100644 --- a/Sources/FoundationNetworking/URLSession/URLSessionTaskMetrics.swift +++ b/Sources/FoundationNetworking/URLSession/URLSessionTaskMetrics.swift @@ -20,7 +20,7 @@ import SwiftFoundation #else import Foundation #endif -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation open class URLSessionTaskMetrics : NSObject { public internal(set) var transactionMetrics: [URLSessionTaskTransactionMetrics] = [] diff --git a/Sources/FoundationNetworking/URLSession/WebSocket/WebSocketURLProtocol.swift b/Sources/FoundationNetworking/URLSession/WebSocket/WebSocketURLProtocol.swift index f18fa71e12..9a7438d69f 100644 --- a/Sources/FoundationNetworking/URLSession/WebSocket/WebSocketURLProtocol.swift +++ b/Sources/FoundationNetworking/URLSession/WebSocket/WebSocketURLProtocol.swift @@ -13,7 +13,7 @@ import SwiftFoundation import Foundation #endif -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation @_implementationOnly import _CFURLSessionInterface import Dispatch diff --git a/Sources/FoundationNetworking/URLSession/libcurl/EasyHandle.swift b/Sources/FoundationNetworking/URLSession/libcurl/EasyHandle.swift index 671b694278..7848196d4f 100644 --- a/Sources/FoundationNetworking/URLSession/libcurl/EasyHandle.swift +++ b/Sources/FoundationNetworking/URLSession/libcurl/EasyHandle.swift @@ -23,7 +23,7 @@ import SwiftFoundation import Foundation #endif -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation @_implementationOnly import _CFURLSessionInterface import Dispatch diff --git a/Sources/FoundationNetworking/URLSession/libcurl/MultiHandle.swift b/Sources/FoundationNetworking/URLSession/libcurl/MultiHandle.swift index 372836107f..248c354cd0 100644 --- a/Sources/FoundationNetworking/URLSession/libcurl/MultiHandle.swift +++ b/Sources/FoundationNetworking/URLSession/libcurl/MultiHandle.swift @@ -22,7 +22,7 @@ import SwiftFoundation import Foundation #endif -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation @_implementationOnly import _CFURLSessionInterface import Dispatch diff --git a/Sources/FoundationNetworking/URLSession/libcurl/libcurlHelpers.swift b/Sources/FoundationNetworking/URLSession/libcurl/libcurlHelpers.swift index 08f7f50596..55460cfc22 100644 --- a/Sources/FoundationNetworking/URLSession/libcurl/libcurlHelpers.swift +++ b/Sources/FoundationNetworking/URLSession/libcurl/libcurlHelpers.swift @@ -17,7 +17,7 @@ // ----------------------------------------------------------------------------- -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation @_implementationOnly import _CFURLSessionInterface //TODO: Move things in this file? diff --git a/Sources/FoundationXML/CMakeLists.txt b/Sources/FoundationXML/CMakeLists.txt new file mode 100644 index 0000000000..f7477e33ce --- /dev/null +++ b/Sources/FoundationXML/CMakeLists.txt @@ -0,0 +1,38 @@ +##===----------------------------------------------------------------------===## +## +## This source file is part of the Swift open source project +## +## Copyright (c) 2024 Apple Inc. and the Swift project authors +## Licensed under Apache License v2.0 +## +## See LICENSE.txt for license information +## See CONTRIBUTORS.md for the list of Swift project authors +## +## SPDX-License-Identifier: Apache-2.0 +## +##===----------------------------------------------------------------------===## + +add_library(FoundationXML + CFAccess.swift + XMLDocument.swift + XMLDTD.swift + XMLDTDNode.swift + XMLElement.swift + XMLNode.swift + XMLParser.swift) + +target_compile_options(FoundationXML PRIVATE + "SHELL:$<$:${_Foundation_swift_build_flags}>") + +target_link_libraries(FoundationXML + PRIVATE + CoreFoundation + _CFXMLInterface + PUBLIC + Foundation) + +set_target_properties(FoundationXML PROPERTIES + INSTALL_RPATH "$ORIGIN") + +set_property(GLOBAL APPEND PROPERTY Foundation_EXPORTS FoundationXML) +_foundation_install_target(FoundationXML) diff --git a/Sources/FoundationXML/XMLDTD.swift b/Sources/FoundationXML/XMLDTD.swift index 52e571c48f..db18d25fb5 100644 --- a/Sources/FoundationXML/XMLDTD.swift +++ b/Sources/FoundationXML/XMLDTD.swift @@ -12,7 +12,7 @@ import SwiftFoundation #else import Foundation #endif -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation @_implementationOnly import _CFXMLInterface /*! diff --git a/Sources/FoundationXML/XMLDTDNode.swift b/Sources/FoundationXML/XMLDTDNode.swift index e6afa6e718..f0d74cb20e 100644 --- a/Sources/FoundationXML/XMLDTDNode.swift +++ b/Sources/FoundationXML/XMLDTDNode.swift @@ -12,7 +12,7 @@ import SwiftFoundation #else import Foundation #endif -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation @_implementationOnly import _CFXMLInterface /*! diff --git a/Sources/FoundationXML/XMLDocument.swift b/Sources/FoundationXML/XMLDocument.swift index 89f80f24dd..41d6ada04d 100644 --- a/Sources/FoundationXML/XMLDocument.swift +++ b/Sources/FoundationXML/XMLDocument.swift @@ -12,7 +12,7 @@ import SwiftFoundation #else import Foundation #endif -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation @_implementationOnly import _CFXMLInterface // Input options diff --git a/Sources/FoundationXML/XMLElement.swift b/Sources/FoundationXML/XMLElement.swift index e9986a8700..448b769108 100644 --- a/Sources/FoundationXML/XMLElement.swift +++ b/Sources/FoundationXML/XMLElement.swift @@ -12,7 +12,7 @@ import SwiftFoundation #else import Foundation #endif -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation @_implementationOnly import _CFXMLInterface /*! diff --git a/Sources/FoundationXML/XMLNode.swift b/Sources/FoundationXML/XMLNode.swift index b233459760..2735b2f3c1 100644 --- a/Sources/FoundationXML/XMLNode.swift +++ b/Sources/FoundationXML/XMLNode.swift @@ -15,7 +15,7 @@ import _CFXMLInterface import Foundation @_implementationOnly import _CFXMLInterface #endif -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation // initWithKind options // NSXMLNodeOptionsNone diff --git a/Sources/FoundationXML/XMLParser.swift b/Sources/FoundationXML/XMLParser.swift index 9ee3827851..f41d56ce8f 100644 --- a/Sources/FoundationXML/XMLParser.swift +++ b/Sources/FoundationXML/XMLParser.swift @@ -14,7 +14,7 @@ import _CFXMLInterface import Foundation @_implementationOnly import _CFXMLInterface #endif -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation extension XMLParser { public enum ExternalEntityResolvingPolicy : UInt { diff --git a/Sources/XCTest/Public/Asynchronous/XCTWaiter.swift b/Sources/XCTest/Public/Asynchronous/XCTWaiter.swift index e6acc4a1c9..e1270394c9 100644 --- a/Sources/XCTest/Public/Asynchronous/XCTWaiter.swift +++ b/Sources/XCTest/Public/Asynchronous/XCTWaiter.swift @@ -11,7 +11,7 @@ // #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) -@_implementationOnly import _CoreFoundation +@_implementationOnly import CoreFoundation #endif /// Events are reported to the waiter's delegate via these methods. XCTestCase conforms to this diff --git a/Sources/_CFURLSessionInterface/CMakeLists.txt b/Sources/_CFURLSessionInterface/CMakeLists.txt new file mode 100644 index 0000000000..09a6275fc1 --- /dev/null +++ b/Sources/_CFURLSessionInterface/CMakeLists.txt @@ -0,0 +1,35 @@ +##===----------------------------------------------------------------------===## +## +## This source file is part of the Swift open source project +## +## Copyright (c) 2024 Apple Inc. and the Swift project authors +## Licensed under Apache License v2.0 +## +## See LICENSE.txt for license information +## See CONTRIBUTORS.md for the list of Swift project authors +## +## SPDX-License-Identifier: Apache-2.0 +## +##===----------------------------------------------------------------------===## + +add_library(_CFURLSessionInterface STATIC CFURLSessionInterface.c) + +target_include_directories(_CFURLSessionInterface + PUBLIC + include + PRIVATE + ../CoreFoundation/internalInclude) + +target_precompile_headers(_CFURLSessionInterface PRIVATE ${CMAKE_SOURCE_DIR}/Sources/CoreFoundation/internalInclude/CoreFoundation_Prefix.h) + +target_compile_options(_CFURLSessionInterface PRIVATE + "SHELL:$<$:${_Foundation_common_build_flags}>") + +target_link_libraries(_CFURLSessionInterface PRIVATE + CoreFoundation + dispatch + CURL::libcurl) + +if(NOT BUILD_SHARED_LIBS) + set_property(GLOBAL APPEND PROPERTY Foundation_EXPORTS _CFURLSessionInterface) +endif() diff --git a/Sources/_CFURLSessionInterface/include/CFURLSessionInterface.h b/Sources/_CFURLSessionInterface/include/CFURLSessionInterface.h index b4bd5e2509..64c3495543 100644 --- a/Sources/_CFURLSessionInterface/include/CFURLSessionInterface.h +++ b/Sources/_CFURLSessionInterface/include/CFURLSessionInterface.h @@ -30,6 +30,7 @@ #include "CFTargetConditionals.h" #include "CFBase.h" #include +#include #if defined(_WIN32) #include #endif diff --git a/Sources/_CFURLSessionInterface/module.modulemap b/Sources/_CFURLSessionInterface/include/module.modulemap similarity index 61% rename from Sources/_CFURLSessionInterface/module.modulemap rename to Sources/_CFURLSessionInterface/include/module.modulemap index a832adcca2..c9be3e1eb7 100644 --- a/Sources/_CFURLSessionInterface/module.modulemap +++ b/Sources/_CFURLSessionInterface/include/module.modulemap @@ -1,4 +1,4 @@ -framework module _CFURLSessionInterface [extern_c] [system] { +module _CFURLSessionInterface { umbrella header "CFURLSessionInterface.h" export * diff --git a/Sources/_CFURLSessionInterface/static-module.map b/Sources/_CFURLSessionInterface/include/static-module.map similarity index 100% rename from Sources/_CFURLSessionInterface/static-module.map rename to Sources/_CFURLSessionInterface/include/static-module.map diff --git a/Sources/_CFURLSessionInterface/module.map b/Sources/_CFURLSessionInterface/module.map deleted file mode 100644 index b6d8887d19..0000000000 --- a/Sources/_CFURLSessionInterface/module.map +++ /dev/null @@ -1,3 +0,0 @@ -module _CFURLSessionInterface [extern_c] [system] { - umbrella header "CFURLSessionInterface.h" -} diff --git a/Sources/_CFXMLInterface/CMakeLists.txt b/Sources/_CFXMLInterface/CMakeLists.txt new file mode 100644 index 0000000000..03bcec15c7 --- /dev/null +++ b/Sources/_CFXMLInterface/CMakeLists.txt @@ -0,0 +1,34 @@ +##===----------------------------------------------------------------------===## +## +## This source file is part of the Swift open source project +## +## Copyright (c) 2024 Apple Inc. and the Swift project authors +## Licensed under Apache License v2.0 +## +## See LICENSE.txt for license information +## See CONTRIBUTORS.md for the list of Swift project authors +## +## SPDX-License-Identifier: Apache-2.0 +## +##===----------------------------------------------------------------------===## + +add_library(_CFXMLInterface STATIC CFXMLInterface.c) + +target_include_directories(_CFXMLInterface + PUBLIC + include + PRIVATE + ../CoreFoundation/internalInclude + /usr/include/libxml2/) + +target_compile_options(_CFXMLInterface PRIVATE + "SHELL:$<$:${_Foundation_common_build_flags}>") + +target_link_libraries(_CFXMLInterface PRIVATE + CoreFoundation + dispatch + LibXml2::LibXml2) + +if(NOT BUILD_SHARED_LIBS) + set_property(GLOBAL APPEND PROPERTY Foundation_EXPORTS _CFXMLInterface) +endif() diff --git a/Sources/_CFXMLInterface/include/CFXMLInterface.h b/Sources/_CFXMLInterface/include/CFXMLInterface.h index 31941e005b..b51004517e 100644 --- a/Sources/_CFXMLInterface/include/CFXMLInterface.h +++ b/Sources/_CFXMLInterface/include/CFXMLInterface.h @@ -16,6 +16,7 @@ #include "CFTargetConditionals.h" #include "CFBase.h" +#include "CFError.h" #include #include #include diff --git a/Sources/_CFXMLInterface/module.modulemap b/Sources/_CFXMLInterface/include/module.modulemap similarity index 62% rename from Sources/_CFXMLInterface/module.modulemap rename to Sources/_CFXMLInterface/include/module.modulemap index 35e9bb7969..983ef3b329 100644 --- a/Sources/_CFXMLInterface/module.modulemap +++ b/Sources/_CFXMLInterface/include/module.modulemap @@ -1,4 +1,4 @@ -framework module _CFXMLInterface [extern_c] [system] { +module _CFXMLInterface { umbrella header "CFXMLInterface.h" export * diff --git a/Sources/_CFXMLInterface/static-module.map b/Sources/_CFXMLInterface/include/static-module.map similarity index 100% rename from Sources/_CFXMLInterface/static-module.map rename to Sources/_CFXMLInterface/include/static-module.map diff --git a/Sources/_CFXMLInterface/module.map b/Sources/_CFXMLInterface/module.map deleted file mode 100644 index c64502b592..0000000000 --- a/Sources/_CFXMLInterface/module.map +++ /dev/null @@ -1,3 +0,0 @@ -module _CFXMLInterface [extern_c] [system] { - umbrella header "CFXMLInterface.h" -} diff --git a/cmake/modules/CMakeLists.txt b/cmake/modules/CMakeLists.txt new file mode 100644 index 0000000000..ff8a0222e5 --- /dev/null +++ b/cmake/modules/CMakeLists.txt @@ -0,0 +1,26 @@ +##===----------------------------------------------------------------------===## +## +## This source file is part of the Swift open source project +## +## Copyright (c) 2024 Apple Inc. and the Swift project authors +## Licensed under Apache License v2.0 +## +## See LICENSE.txt for license information +## See CONTRIBUTORS.md for the list of Swift project authors +## +## SPDX-License-Identifier: Apache-2.0 +## +##===----------------------------------------------------------------------===## + +set(Foundation_EXPORTS_FILE ${CMAKE_CURRENT_BINARY_DIR}/FoundationExports.cmake) +set(SwiftFoundation_EXPORTS_FILE ${SwiftFoundation_BINARY_DIR}/cmake/modules/SwiftFoundationExports.cmake) +set(SwiftFoundationICU_EXPORTS_FILE ${SwiftFoundationICU_BINARY_DIR}/cmake/modules/SwiftFoundationICUExports.cmake) +set(SwiftCollections_EXPORTS_FILE ${SwiftCollections_BINARY_DIR}/cmake/modules/SwiftCollectionsExports.cmake) + +configure_file(FoundationConfig.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/FoundationConfig.cmake) + +get_property(Foundation_EXPORTS GLOBAL PROPERTY Foundation_EXPORTS) +export(TARGETS ${Foundation_EXPORTS} + FILE ${Foundation_EXPORTS_FILE} + EXPORT_LINK_INTERFACE_LIBRARIES) diff --git a/cmake/modules/FoundationConfig.cmake.in b/cmake/modules/FoundationConfig.cmake.in new file mode 100644 index 0000000000..15cc666fdc --- /dev/null +++ b/cmake/modules/FoundationConfig.cmake.in @@ -0,0 +1,20 @@ +##===----------------------------------------------------------------------===## +## +## This source file is part of the Swift open source project +## +## Copyright (c) 2024 Apple Inc. and the Swift project authors +## Licensed under Apache License v2.0 +## +## See LICENSE.txt for license information +## See CONTRIBUTORS.md for the list of Swift project authors +## +## SPDX-License-Identifier: Apache-2.0 +## +##===----------------------------------------------------------------------===## + +if(NOT TARGET Foundation) + include(@SwiftCollections_EXPORTS_FILE@) + include(@SwiftFoundationICU_EXPORTS_FILE@) + include(@SwiftFoundation_EXPORTS_FILE@) + include(@Foundation_EXPORTS_FILE@) +endif() diff --git a/cmake/modules/FoundationSwiftSupport.cmake b/cmake/modules/FoundationSwiftSupport.cmake new file mode 100644 index 0000000000..85868392f0 --- /dev/null +++ b/cmake/modules/FoundationSwiftSupport.cmake @@ -0,0 +1,45 @@ +##===----------------------------------------------------------------------===## +## +## This source file is part of the Swift open source project +## +## Copyright (c) 2024 Apple Inc. and the Swift project authors +## Licensed under Apache License v2.0 +## +## See LICENSE.txt for license information +## See CONTRIBUTORS.md for the list of Swift project authors +## +## SPDX-License-Identifier: Apache-2.0 +## +##===----------------------------------------------------------------------===## + +function(_foundation_install_target module) + set(swift_os ${SWIFT_SYSTEM_NAME}) + get_target_property(type ${module} TYPE) + + if(type STREQUAL STATIC_LIBRARY) + set(swift swift_static) + else() + set(swift swift) + endif() + + install(TARGETS ${module} + ARCHIVE DESTINATION lib/${swift}/${swift_os} + LIBRARY DESTINATION lib/${swift}/${swift_os} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) + if(type STREQUAL EXECUTABLE) + return() + endif() + + get_target_property(module_name ${module} Swift_MODULE_NAME) + if(NOT module_name) + set(module_name ${module}) + endif() + + install(FILES $/${module_name}.swiftdoc + DESTINATION lib/${swift}/${swift_os}/${module_name}.swiftmodule + RENAME ${SwiftFoundation_MODULE_TRIPLE}.swiftdoc) + install(FILES $/${module_name}.swiftmodule + DESTINATION lib/${swift}/${swift_os}/${module_name}.swiftmodule + RENAME ${SwiftFoundation_MODULE_TRIPLE}.swiftmodule) + +endfunction()