Skip to content

FoundationNetworking: Split networking into its own module #2289

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 24, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 76 additions & 28 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,12 @@ endif()
# be able to remove this and just use
# `target_link_libraries(Foundation PRIVATE CoreFoundation)`.
set(CoreFoundation_LIBRARIES $<TARGET_FILE:CoreFoundation>)
set(CFURLSessionInterface_LIBRARIES $<TARGET_FILE:CFURLSessionInterface>)
get_target_property(CoreFoundation_LINK_LIBRARIES CoreFoundation LINK_LIBRARIES)
foreach(library ${CoreFoundation_LINK_LIBRARIES})
if(NOT library STREQUAL Threads::Threads)
list(APPEND CoreFoundation_LIBRARIES -l${library})
list(APPEND CFURLSessionInterface_LIBRARIES -l${library})
endif()
endforeach()

Expand Down Expand Up @@ -165,8 +167,6 @@ add_swift_library(Foundation
Foundation/Formatter.swift
Foundation/FoundationErrors.swift
Foundation/Host.swift
Foundation/HTTPCookie.swift
Foundation/HTTPCookieStorage.swift
Foundation/IndexPath.swift
Foundation/IndexSet.swift
Foundation/ISO8601DateFormatter.swift
Expand Down Expand Up @@ -235,7 +235,6 @@ add_swift_library(Foundation
Foundation/NSTimeZone.swift
Foundation/NSURL.swift
Foundation/NSURLError.swift
Foundation/NSURLRequest.swift
Foundation/NSUUID.swift
Foundation/NSValue.swift
Foundation/NumberFormatter.swift
Expand Down Expand Up @@ -264,31 +263,7 @@ add_swift_library(Foundation
Foundation/TimeZone.swift
Foundation/Unit.swift
Foundation/URL.swift
Foundation/URLAuthenticationChallenge.swift
Foundation/URLCache.swift
Foundation/URLComponents.swift
Foundation/URLCredential.swift
Foundation/URLCredentialStorage.swift
Foundation/URLProtectionSpace.swift
Foundation/URLProtocol.swift
Foundation/URLRequest.swift
Foundation/URLResponse.swift
Foundation/URLSession/BodySource.swift
Foundation/URLSession/Configuration.swift
Foundation/URLSession/http/HTTPMessage.swift
Foundation/URLSession/http/HTTPURLProtocol.swift
Foundation/URLSession/libcurl/EasyHandle.swift
Foundation/URLSession/libcurl/libcurlHelpers.swift
Foundation/URLSession/libcurl/MultiHandle.swift
Foundation/URLSession/Message.swift
Foundation/URLSession/NativeProtocol.swift
Foundation/URLSession/ftp/FTPURLProtocol.swift
Foundation/URLSession/TaskRegistry.swift
Foundation/URLSession/TransferState.swift
Foundation/URLSession/URLSession.swift
Foundation/URLSession/URLSessionConfiguration.swift
Foundation/URLSession/URLSessionDelegate.swift
Foundation/URLSession/URLSessionTask.swift
Foundation/UserDefaults.swift
Foundation/UUID.swift
Foundation/XMLDocument.swift
Expand All @@ -303,7 +278,6 @@ add_swift_library(Foundation
-F${CMAKE_CURRENT_BINARY_DIR}
LINK_FLAGS
${CoreFoundation_LIBRARIES}
${CURL_LIBRARIES}
${ICU_UC_LIBRARY} ${ICU_I18N_LIBRARY}
${LIBXML2_LIBRARIES}
${libdispatch_ldflags}
Expand Down Expand Up @@ -331,6 +305,80 @@ add_swift_library(Foundation
CoreFoundation
$<$<PLATFORM_ID:Windows>:CoreFoundationResources>)

add_swift_library(FoundationNetworking
MODULE_NAME
FoundationNetworking
MODULE_LINK_NAME
FoundationNetworking
MODULE_PATH
${CMAKE_CURRENT_BINARY_DIR}/swift/FoundationNetworking.swiftmodule
SOURCES
Foundation/Boxing.swift
Foundation/NSURLRequest.swift
Foundation/HTTPCookie.swift
Foundation/HTTPCookieStorage.swift
Foundation/URLAuthenticationChallenge.swift
Foundation/URLCache.swift
Foundation/URLCredential.swift
Foundation/URLCredentialStorage.swift
Foundation/URLProtectionSpace.swift
Foundation/URLProtocol.swift
Foundation/URLRequest.swift
Foundation/URLResponse.swift
Foundation/URLSession/BodySource.swift
Foundation/URLSession/Configuration.swift
Foundation/URLSession/http/HTTPMessage.swift
Foundation/URLSession/http/HTTPURLProtocol.swift
Foundation/URLSession/libcurl/EasyHandle.swift
Foundation/URLSession/libcurl/libcurlHelpers.swift
Foundation/URLSession/libcurl/MultiHandle.swift
Foundation/URLSession/Message.swift
Foundation/URLSession/NativeProtocol.swift
Foundation/URLSession/NetworkingSpecific.swift
Foundation/URLSession/ftp/FTPURLProtocol.swift
Foundation/URLSession/TaskRegistry.swift
Foundation/URLSession/TransferState.swift
Foundation/URLSession/URLSession.swift
Foundation/URLSession/URLSessionConfiguration.swift
Foundation/URLSession/URLSessionDelegate.swift
Foundation/URLSession/URLSessionTask.swift
TARGET
${CMAKE_C_COMPILER_TARGET}
CFLAGS
${MSVCRT_C_FLAGS}
${deployment_target}
Copy link
Member

Choose a reason for hiding this comment

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

This should no longer be needed, deployment_target has been removed in favour of TARGET_OS_* from TargetConditionals.h

${deployment_enable_libdispatch}
Copy link
Member

Choose a reason for hiding this comment

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

I believe that I have cleaned this up as well. This was previously needed as there was a mode for CoreFoundation to be built without libdispatch which is no longer supported.

-F${CMAKE_CURRENT_BINARY_DIR}
LINK_FLAGS
${MSVCRT_LINK_FLAGS}
-L${CMAKE_CURRENT_BINARY_DIR}
${ICU_UC_LIBRARY} ${ICU_I18N_LIBRARY}
Copy link
Member

Choose a reason for hiding this comment

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

Does this part actually use ICU?

${libdispatch_ldflags}
-lFoundation
${Foundation_INTERFACE_LIBRARIES}
${CFURLSessionInterface_LIBRARIES}
Copy link
Member

Choose a reason for hiding this comment

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

Indentation seems odd

${CURL_LIBRARIES}
${Foundation_RPATH}
${WORKAROUND_SR9138}
${WORKAROUND_SR9995}
$<$<PLATFORM_ID:Windows>:$<TARGET_OBJECTS:CoreFoundationResources>>
Copy link
Member

Choose a reason for hiding this comment

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

Why do you need the CoreFoundationResources? That is for the TimeZone information

SWIFT_FLAGS
-DDEPLOYMENT_RUNTIME_SWIFT
-DNS_BUILDING_FOUNDATION_NETWORKING
Copy link
Member

Choose a reason for hiding this comment

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

Indentation seems odd

${deployment_enable_libdispatch}
-I;${ICU_INCLUDE_DIR}
Copy link
Member

Choose a reason for hiding this comment

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

Do we really need ICU here?

-I;${CMAKE_CURRENT_BINARY_DIR}/swift
${libdispatch_cflags}
${swift_enable_testing}
${swift_optimization_flags}
DEPENDS
uuid
CoreFoundation
$<$<PLATFORM_ID:Windows>:CoreFoundationResources>
Foundation)
Copy link
Member

Choose a reason for hiding this comment

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

Indentation is off

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Missed it; I'll fix it before merge.




if(NOT BUILD_SHARED_LIBS)
set(Foundation_INTERFACE_LIBRARIES
-L${install_dir}/usr/lib
Expand Down
1 change: 0 additions & 1 deletion CoreFoundation/Base.subproj/ForSwiftFoundationOnly.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include <CoreFoundation/CFXMLInterface.h>
#include <CoreFoundation/CFRegularExpression.h>
#include <CoreFoundation/CFLogUtilities.h>
#include <CoreFoundation/CFURLSessionInterface.h>
#include <CoreFoundation/CFDateIntervalFormatter.h>
#include <CoreFoundation/ForFoundationOnly.h>
#include <CoreFoundation/CFCharacterSetPriv.h>
Expand Down
Loading