From b532807e961fa264a5500b0014df19896bbef8c4 Mon Sep 17 00:00:00 2001 From: Jeremy Schonfeld Date: Thu, 11 Jul 2024 15:42:50 -0700 Subject: [PATCH] Avoiding linking CF from outside of Foundation --- Sources/Foundation/CMakeLists.txt | 3 ++- Sources/FoundationNetworking/CMakeLists.txt | 3 --- Sources/FoundationNetworking/HTTPCookieStorage.swift | 1 - Sources/FoundationNetworking/URLSession/BodySource.swift | 1 - .../FoundationNetworking/URLSession/FTP/FTPURLProtocol.swift | 1 - Sources/FoundationNetworking/URLSession/HTTP/HTTPMessage.swift | 1 - .../FoundationNetworking/URLSession/HTTP/HTTPURLProtocol.swift | 1 - Sources/FoundationNetworking/URLSession/NativeProtocol.swift | 1 - Sources/FoundationNetworking/URLSession/TaskRegistry.swift | 1 - Sources/FoundationNetworking/URLSession/TransferState.swift | 1 - Sources/FoundationNetworking/URLSession/URLSession.swift | 1 - Sources/FoundationNetworking/URLSession/URLSessionTask.swift | 1 - .../URLSession/URLSessionTaskMetrics.swift | 1 - .../URLSession/WebSocket/WebSocketURLProtocol.swift | 1 - .../FoundationNetworking/URLSession/libcurl/EasyHandle.swift | 1 - .../FoundationNetworking/URLSession/libcurl/MultiHandle.swift | 1 - .../URLSession/libcurl/libcurlHelpers.swift | 1 - Sources/FoundationXML/CMakeLists.txt | 3 --- Sources/FoundationXML/XMLDTD.swift | 1 - Sources/FoundationXML/XMLDTDNode.swift | 1 - Sources/FoundationXML/XMLDocument.swift | 1 - Sources/FoundationXML/XMLElement.swift | 1 - Sources/FoundationXML/XMLNode.swift | 1 - Sources/FoundationXML/XMLParser.swift | 1 - Sources/_CFURLSessionInterface/CMakeLists.txt | 2 +- Sources/_CFXMLInterface/CMakeLists.txt | 2 +- 26 files changed, 4 insertions(+), 30 deletions(-) diff --git a/Sources/Foundation/CMakeLists.txt b/Sources/Foundation/CMakeLists.txt index d382f15c94..9904982181 100644 --- a/Sources/Foundation/CMakeLists.txt +++ b/Sources/Foundation/CMakeLists.txt @@ -149,8 +149,9 @@ target_compile_options(Foundation PRIVATE "SHELL:$<$:${_Foundation_swift_build_flags}>") target_link_libraries(Foundation - PUBLIC + PRIVATE CoreFoundation + PUBLIC FoundationEssentials FoundationInternationalization) diff --git a/Sources/FoundationNetworking/CMakeLists.txt b/Sources/FoundationNetworking/CMakeLists.txt index 75c8505060..106add318c 100644 --- a/Sources/FoundationNetworking/CMakeLists.txt +++ b/Sources/FoundationNetworking/CMakeLists.txt @@ -51,7 +51,6 @@ target_compile_options(FoundationNetworking PRIVATE target_link_libraries(FoundationNetworking PRIVATE - CoreFoundation _CFURLSessionInterface PUBLIC Foundation) @@ -59,8 +58,6 @@ target_link_libraries(FoundationNetworking if(NOT BUILD_SHARED_LIBS) target_compile_options(FoundationNetworking PRIVATE "SHELL:$<$:-Xfrontend -public-autolink-library -Xfrontend _CFURLSessionInterface>") - target_compile_options(FoundationNetworking PRIVATE - "SHELL:$<$:-Xfrontend -public-autolink-library -Xfrontend CoreFoundation>") target_compile_options(FoundationNetworking PRIVATE "SHELL:$<$:-Xfrontend -public-autolink-library -Xfrontend curl>") endif() diff --git a/Sources/FoundationNetworking/HTTPCookieStorage.swift b/Sources/FoundationNetworking/HTTPCookieStorage.swift index 3961d44cc3..22a1aff000 100644 --- a/Sources/FoundationNetworking/HTTPCookieStorage.swift +++ b/Sources/FoundationNetworking/HTTPCookieStorage.swift @@ -13,7 +13,6 @@ import SwiftFoundation import Foundation #endif -@_implementationOnly import CoreFoundation /*! @enum HTTPCookie.AcceptPolicy diff --git a/Sources/FoundationNetworking/URLSession/BodySource.swift b/Sources/FoundationNetworking/URLSession/BodySource.swift index e6e3f85c86..df2862b2f7 100644 --- a/Sources/FoundationNetworking/URLSession/BodySource.swift +++ b/Sources/FoundationNetworking/URLSession/BodySource.swift @@ -22,7 +22,6 @@ import SwiftFoundation import Foundation #endif -@_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 932600cbe2..142a2c84f0 100644 --- a/Sources/FoundationNetworking/URLSession/FTP/FTPURLProtocol.swift +++ b/Sources/FoundationNetworking/URLSession/FTP/FTPURLProtocol.swift @@ -13,7 +13,6 @@ import SwiftFoundation import Foundation #endif -@_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 cc2e7d7f9c..fae1e612d4 100644 --- a/Sources/FoundationNetworking/URLSession/HTTP/HTTPMessage.swift +++ b/Sources/FoundationNetworking/URLSession/HTTP/HTTPMessage.swift @@ -22,7 +22,6 @@ import SwiftFoundation #else import Foundation #endif -@_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 bf7e3f2b79..ed7070c700 100644 --- a/Sources/FoundationNetworking/URLSession/HTTP/HTTPURLProtocol.swift +++ b/Sources/FoundationNetworking/URLSession/HTTP/HTTPURLProtocol.swift @@ -13,7 +13,6 @@ import SwiftFoundation import Foundation #endif -@_implementationOnly import CoreFoundation @_implementationOnly import _CFURLSessionInterface import Dispatch diff --git a/Sources/FoundationNetworking/URLSession/NativeProtocol.swift b/Sources/FoundationNetworking/URLSession/NativeProtocol.swift index 95da2e9bdb..941b9cd3b1 100644 --- a/Sources/FoundationNetworking/URLSession/NativeProtocol.swift +++ b/Sources/FoundationNetworking/URLSession/NativeProtocol.swift @@ -23,7 +23,6 @@ import SwiftFoundation import Foundation #endif -@_implementationOnly import CoreFoundation import Dispatch internal let enableLibcurlDebugOutput: Bool = { diff --git a/Sources/FoundationNetworking/URLSession/TaskRegistry.swift b/Sources/FoundationNetworking/URLSession/TaskRegistry.swift index 3e958891dd..059010a07b 100644 --- a/Sources/FoundationNetworking/URLSession/TaskRegistry.swift +++ b/Sources/FoundationNetworking/URLSession/TaskRegistry.swift @@ -22,7 +22,6 @@ import SwiftFoundation import Foundation #endif -@_implementationOnly import CoreFoundation import Dispatch extension URLSession { diff --git a/Sources/FoundationNetworking/URLSession/TransferState.swift b/Sources/FoundationNetworking/URLSession/TransferState.swift index b4142c24eb..232776a3ef 100644 --- a/Sources/FoundationNetworking/URLSession/TransferState.swift +++ b/Sources/FoundationNetworking/URLSession/TransferState.swift @@ -22,7 +22,6 @@ import SwiftFoundation #else import Foundation #endif -@_implementationOnly import CoreFoundation diff --git a/Sources/FoundationNetworking/URLSession/URLSession.swift b/Sources/FoundationNetworking/URLSession/URLSession.swift index d01fc316c7..3fe5b9bd77 100644 --- a/Sources/FoundationNetworking/URLSession/URLSession.swift +++ b/Sources/FoundationNetworking/URLSession/URLSession.swift @@ -167,7 +167,6 @@ import SwiftFoundation #else import Foundation #endif -@_implementationOnly import CoreFoundation extension URLSession { public enum DelayedRequestDisposition { diff --git a/Sources/FoundationNetworking/URLSession/URLSessionTask.swift b/Sources/FoundationNetworking/URLSession/URLSessionTask.swift index ea19743bd8..d1aa041333 100644 --- a/Sources/FoundationNetworking/URLSession/URLSessionTask.swift +++ b/Sources/FoundationNetworking/URLSession/URLSessionTask.swift @@ -20,7 +20,6 @@ import SwiftFoundation #else import Foundation #endif -@_implementationOnly import CoreFoundation private class Bag { var values: [Element] = [] diff --git a/Sources/FoundationNetworking/URLSession/URLSessionTaskMetrics.swift b/Sources/FoundationNetworking/URLSession/URLSessionTaskMetrics.swift index 035a5d802b..d745c9e0f8 100644 --- a/Sources/FoundationNetworking/URLSession/URLSessionTaskMetrics.swift +++ b/Sources/FoundationNetworking/URLSession/URLSessionTaskMetrics.swift @@ -20,7 +20,6 @@ import SwiftFoundation #else import Foundation #endif -@_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 9a7438d69f..40a012905d 100644 --- a/Sources/FoundationNetworking/URLSession/WebSocket/WebSocketURLProtocol.swift +++ b/Sources/FoundationNetworking/URLSession/WebSocket/WebSocketURLProtocol.swift @@ -13,7 +13,6 @@ import SwiftFoundation import Foundation #endif -@_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 7848196d4f..1d9e3c7f54 100644 --- a/Sources/FoundationNetworking/URLSession/libcurl/EasyHandle.swift +++ b/Sources/FoundationNetworking/URLSession/libcurl/EasyHandle.swift @@ -23,7 +23,6 @@ import SwiftFoundation import Foundation #endif -@_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 248c354cd0..ade21f458a 100644 --- a/Sources/FoundationNetworking/URLSession/libcurl/MultiHandle.swift +++ b/Sources/FoundationNetworking/URLSession/libcurl/MultiHandle.swift @@ -22,7 +22,6 @@ import SwiftFoundation import Foundation #endif -@_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 55460cfc22..291c897052 100644 --- a/Sources/FoundationNetworking/URLSession/libcurl/libcurlHelpers.swift +++ b/Sources/FoundationNetworking/URLSession/libcurl/libcurlHelpers.swift @@ -17,7 +17,6 @@ // ----------------------------------------------------------------------------- -@_implementationOnly import CoreFoundation @_implementationOnly import _CFURLSessionInterface //TODO: Move things in this file? diff --git a/Sources/FoundationXML/CMakeLists.txt b/Sources/FoundationXML/CMakeLists.txt index 9640298a71..0ac926fa34 100644 --- a/Sources/FoundationXML/CMakeLists.txt +++ b/Sources/FoundationXML/CMakeLists.txt @@ -26,7 +26,6 @@ target_compile_options(FoundationXML PRIVATE target_link_libraries(FoundationXML PRIVATE - CoreFoundation _CFXMLInterface PUBLIC Foundation) @@ -34,8 +33,6 @@ target_link_libraries(FoundationXML if(NOT BUILD_SHARED_LIBS) target_compile_options(FoundationXML PRIVATE "SHELL:$<$:-Xfrontend -public-autolink-library -Xfrontend _CFXMLInterface>") - target_compile_options(FoundationXML PRIVATE - "SHELL:$<$:-Xfrontend -public-autolink-library -Xfrontend CoreFoundation>") target_compile_options(FoundationXML PRIVATE "SHELL:$<$:-Xfrontend -public-autolink-library -Xfrontend xml2>") endif() diff --git a/Sources/FoundationXML/XMLDTD.swift b/Sources/FoundationXML/XMLDTD.swift index db18d25fb5..089c1a088b 100644 --- a/Sources/FoundationXML/XMLDTD.swift +++ b/Sources/FoundationXML/XMLDTD.swift @@ -12,7 +12,6 @@ import SwiftFoundation #else import Foundation #endif -@_implementationOnly import CoreFoundation @_implementationOnly import _CFXMLInterface /*! diff --git a/Sources/FoundationXML/XMLDTDNode.swift b/Sources/FoundationXML/XMLDTDNode.swift index f0d74cb20e..c3859ec0b0 100644 --- a/Sources/FoundationXML/XMLDTDNode.swift +++ b/Sources/FoundationXML/XMLDTDNode.swift @@ -12,7 +12,6 @@ import SwiftFoundation #else import Foundation #endif -@_implementationOnly import CoreFoundation @_implementationOnly import _CFXMLInterface /*! diff --git a/Sources/FoundationXML/XMLDocument.swift b/Sources/FoundationXML/XMLDocument.swift index 41d6ada04d..b4fb5fdafa 100644 --- a/Sources/FoundationXML/XMLDocument.swift +++ b/Sources/FoundationXML/XMLDocument.swift @@ -12,7 +12,6 @@ import SwiftFoundation #else import Foundation #endif -@_implementationOnly import CoreFoundation @_implementationOnly import _CFXMLInterface // Input options diff --git a/Sources/FoundationXML/XMLElement.swift b/Sources/FoundationXML/XMLElement.swift index 448b769108..9355e8a704 100644 --- a/Sources/FoundationXML/XMLElement.swift +++ b/Sources/FoundationXML/XMLElement.swift @@ -12,7 +12,6 @@ import SwiftFoundation #else import Foundation #endif -@_implementationOnly import CoreFoundation @_implementationOnly import _CFXMLInterface /*! diff --git a/Sources/FoundationXML/XMLNode.swift b/Sources/FoundationXML/XMLNode.swift index 2735b2f3c1..035408bbd3 100644 --- a/Sources/FoundationXML/XMLNode.swift +++ b/Sources/FoundationXML/XMLNode.swift @@ -15,7 +15,6 @@ import _CFXMLInterface import Foundation @_implementationOnly import _CFXMLInterface #endif -@_implementationOnly import CoreFoundation // initWithKind options // NSXMLNodeOptionsNone diff --git a/Sources/FoundationXML/XMLParser.swift b/Sources/FoundationXML/XMLParser.swift index f41d56ce8f..228f588e88 100644 --- a/Sources/FoundationXML/XMLParser.swift +++ b/Sources/FoundationXML/XMLParser.swift @@ -14,7 +14,6 @@ import _CFXMLInterface import Foundation @_implementationOnly import _CFXMLInterface #endif -@_implementationOnly import CoreFoundation extension XMLParser { public enum ExternalEntityResolvingPolicy : UInt { diff --git a/Sources/_CFURLSessionInterface/CMakeLists.txt b/Sources/_CFURLSessionInterface/CMakeLists.txt index d3a1b1b67f..47fe6a39a4 100644 --- a/Sources/_CFURLSessionInterface/CMakeLists.txt +++ b/Sources/_CFURLSessionInterface/CMakeLists.txt @@ -17,6 +17,7 @@ add_library(_CFURLSessionInterface STATIC CFURLSessionInterface.c) target_include_directories(_CFURLSessionInterface PUBLIC include + ../CoreFoundation/include PRIVATE ../CoreFoundation/internalInclude) @@ -26,7 +27,6 @@ target_compile_options(_CFURLSessionInterface PRIVATE "SHELL:$<$:${_Foundation_common_build_flags}>") target_link_libraries(_CFURLSessionInterface PRIVATE - CoreFoundation dispatch CURL::libcurl) diff --git a/Sources/_CFXMLInterface/CMakeLists.txt b/Sources/_CFXMLInterface/CMakeLists.txt index 45085aadd5..41b1f08364 100644 --- a/Sources/_CFXMLInterface/CMakeLists.txt +++ b/Sources/_CFXMLInterface/CMakeLists.txt @@ -17,6 +17,7 @@ add_library(_CFXMLInterface STATIC CFXMLInterface.c) target_include_directories(_CFXMLInterface PUBLIC include + ../CoreFoundation/include PRIVATE ../CoreFoundation/internalInclude /usr/include/libxml2/) @@ -25,7 +26,6 @@ target_compile_options(_CFXMLInterface PRIVATE "SHELL:$<$:${_Foundation_common_build_flags}>") target_link_libraries(_CFXMLInterface PRIVATE - CoreFoundation dispatch LibXml2::LibXml2)