From 16bbfa795eef8c8c0715e49ab3ea75d816907661 Mon Sep 17 00:00:00 2001 From: Daniel Muhra Date: Wed, 18 Nov 2020 10:21:26 +0100 Subject: [PATCH] Added support for Swift PM 5.3 --- .gitignore | 2 + GCDWebUploader/GCDWebUploader.m | 8 +++- Package.swift | 47 +++++++++++++++++++ include/GCDWebServers/GCDWebDAVServer.h | 1 + include/GCDWebServers/GCDWebServer.h | 1 + .../GCDWebServers/GCDWebServerConnection.h | 1 + .../GCDWebServers/GCDWebServerDataRequest.h | 1 + .../GCDWebServers/GCDWebServerDataResponse.h | 1 + .../GCDWebServers/GCDWebServerErrorResponse.h | 1 + .../GCDWebServers/GCDWebServerFileRequest.h | 1 + .../GCDWebServers/GCDWebServerFileResponse.h | 1 + include/GCDWebServers/GCDWebServerFunctions.h | 1 + .../GCDWebServerHTTPStatusCodes.h | 1 + .../GCDWebServerMultiPartFormRequest.h | 1 + include/GCDWebServers/GCDWebServerRequest.h | 1 + include/GCDWebServers/GCDWebServerResponse.h | 1 + .../GCDWebServerStreamedResponse.h | 1 + .../GCDWebServerURLEncodedFormRequest.h | 1 + include/GCDWebServers/GCDWebUploader.h | 1 + 19 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 Package.swift create mode 120000 include/GCDWebServers/GCDWebDAVServer.h create mode 120000 include/GCDWebServers/GCDWebServer.h create mode 120000 include/GCDWebServers/GCDWebServerConnection.h create mode 120000 include/GCDWebServers/GCDWebServerDataRequest.h create mode 120000 include/GCDWebServers/GCDWebServerDataResponse.h create mode 120000 include/GCDWebServers/GCDWebServerErrorResponse.h create mode 120000 include/GCDWebServers/GCDWebServerFileRequest.h create mode 120000 include/GCDWebServers/GCDWebServerFileResponse.h create mode 120000 include/GCDWebServers/GCDWebServerFunctions.h create mode 120000 include/GCDWebServers/GCDWebServerHTTPStatusCodes.h create mode 120000 include/GCDWebServers/GCDWebServerMultiPartFormRequest.h create mode 120000 include/GCDWebServers/GCDWebServerRequest.h create mode 120000 include/GCDWebServers/GCDWebServerResponse.h create mode 120000 include/GCDWebServers/GCDWebServerStreamedResponse.h create mode 120000 include/GCDWebServers/GCDWebServerURLEncodedFormRequest.h create mode 120000 include/GCDWebServers/GCDWebUploader.h diff --git a/.gitignore b/.gitignore index 108a40f7..0818bc92 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ .DS_Store +.build/ +.swiftpm/ xcuserdata project.xcworkspace /build diff --git a/GCDWebUploader/GCDWebUploader.m b/GCDWebUploader/GCDWebUploader.m index 93d0200b..80c9e669 100644 --- a/GCDWebUploader/GCDWebUploader.m +++ b/GCDWebUploader/GCDWebUploader.m @@ -66,7 +66,13 @@ @implementation GCDWebUploader - (instancetype)initWithUploadDirectory:(NSString*)path { if ((self = [super init])) { - NSString* bundlePath = [[NSBundle bundleForClass:[GCDWebUploader class]] pathForResource:@"GCDWebUploader" ofType:@"bundle"]; +#if SWIFT_PACKAGE + NSBundle* bundle = SWIFTPM_MODULE_BUNDLE; +#else + NSBundle* bundle = [NSBundle bundleForClass:[GCDWebUploader class]]; +#endif + + NSString* bundlePath = [bundle pathForResource:@"GCDWebUploader" ofType:@"bundle"]; if (bundlePath == nil) { return nil; } diff --git a/Package.swift b/Package.swift new file mode 100644 index 00000000..9edce406 --- /dev/null +++ b/Package.swift @@ -0,0 +1,47 @@ +// swift-tools-version:5.3 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +import PackageDescription + +let package = Package( + name: "GCDWebServers", + products: [ + // Products define the executables and libraries produced by a package, and make them visible to other packages. + .library( + name: "GCDWebServers", + targets: ["GCDWebServers"]), + ], + dependencies: [ + // Dependencies declare other packages that this package depends on. + // .package(url: /* package url */, from: "1.0.0"), + ], + targets: [ + // Targets are the basic building blocks of a package. A target can define a module or a test suite. + // Targets can depend on other targets in this package, and on products in packages which this package depends on. + .target( + name: "GCDWebServers", + dependencies: [], + path: ".", + exclude: [ + "Frameworks", + "iOS", + "Mac", + "Tests", + "tvOS", + "Package.swift", + "GCDWebServer.podspec", + "Run-Tests.sh", + "format-source.sh", + "README.md", + "LICENSE" + ], + resources: [ + .copy("GCDWebUploader/GCDWebUploader.bundle"), + ], + cSettings:[ + .headerSearchPath("GCDWebServer/Core"), + .headerSearchPath("GCDWebServer/Requests"), + .headerSearchPath("GCDWebServer/Responses"), + ]), + ] +) diff --git a/include/GCDWebServers/GCDWebDAVServer.h b/include/GCDWebServers/GCDWebDAVServer.h new file mode 120000 index 00000000..21f49e16 --- /dev/null +++ b/include/GCDWebServers/GCDWebDAVServer.h @@ -0,0 +1 @@ +../../GCDWebDAVServer/GCDWebDAVServer.h \ No newline at end of file diff --git a/include/GCDWebServers/GCDWebServer.h b/include/GCDWebServers/GCDWebServer.h new file mode 120000 index 00000000..a95568ac --- /dev/null +++ b/include/GCDWebServers/GCDWebServer.h @@ -0,0 +1 @@ +../../GCDWebServer/Core/GCDWebServer.h \ No newline at end of file diff --git a/include/GCDWebServers/GCDWebServerConnection.h b/include/GCDWebServers/GCDWebServerConnection.h new file mode 120000 index 00000000..3634df70 --- /dev/null +++ b/include/GCDWebServers/GCDWebServerConnection.h @@ -0,0 +1 @@ +../../GCDWebServer/Core/GCDWebServerConnection.h \ No newline at end of file diff --git a/include/GCDWebServers/GCDWebServerDataRequest.h b/include/GCDWebServers/GCDWebServerDataRequest.h new file mode 120000 index 00000000..c4118772 --- /dev/null +++ b/include/GCDWebServers/GCDWebServerDataRequest.h @@ -0,0 +1 @@ +../../GCDWebServer/Requests/GCDWebServerDataRequest.h \ No newline at end of file diff --git a/include/GCDWebServers/GCDWebServerDataResponse.h b/include/GCDWebServers/GCDWebServerDataResponse.h new file mode 120000 index 00000000..610cc6a8 --- /dev/null +++ b/include/GCDWebServers/GCDWebServerDataResponse.h @@ -0,0 +1 @@ +../../GCDWebServer/Responses/GCDWebServerDataResponse.h \ No newline at end of file diff --git a/include/GCDWebServers/GCDWebServerErrorResponse.h b/include/GCDWebServers/GCDWebServerErrorResponse.h new file mode 120000 index 00000000..748bf48c --- /dev/null +++ b/include/GCDWebServers/GCDWebServerErrorResponse.h @@ -0,0 +1 @@ +../../GCDWebServer/Responses/GCDWebServerErrorResponse.h \ No newline at end of file diff --git a/include/GCDWebServers/GCDWebServerFileRequest.h b/include/GCDWebServers/GCDWebServerFileRequest.h new file mode 120000 index 00000000..14589ef4 --- /dev/null +++ b/include/GCDWebServers/GCDWebServerFileRequest.h @@ -0,0 +1 @@ +../../GCDWebServer/Requests/GCDWebServerFileRequest.h \ No newline at end of file diff --git a/include/GCDWebServers/GCDWebServerFileResponse.h b/include/GCDWebServers/GCDWebServerFileResponse.h new file mode 120000 index 00000000..0236b56b --- /dev/null +++ b/include/GCDWebServers/GCDWebServerFileResponse.h @@ -0,0 +1 @@ +../../GCDWebServer/Responses/GCDWebServerFileResponse.h \ No newline at end of file diff --git a/include/GCDWebServers/GCDWebServerFunctions.h b/include/GCDWebServers/GCDWebServerFunctions.h new file mode 120000 index 00000000..94850113 --- /dev/null +++ b/include/GCDWebServers/GCDWebServerFunctions.h @@ -0,0 +1 @@ +../../GCDWebServer/Core/GCDWebServerFunctions.h \ No newline at end of file diff --git a/include/GCDWebServers/GCDWebServerHTTPStatusCodes.h b/include/GCDWebServers/GCDWebServerHTTPStatusCodes.h new file mode 120000 index 00000000..3a9660f3 --- /dev/null +++ b/include/GCDWebServers/GCDWebServerHTTPStatusCodes.h @@ -0,0 +1 @@ +../../GCDWebServer/Core/GCDWebServerHTTPStatusCodes.h \ No newline at end of file diff --git a/include/GCDWebServers/GCDWebServerMultiPartFormRequest.h b/include/GCDWebServers/GCDWebServerMultiPartFormRequest.h new file mode 120000 index 00000000..b0cc12e3 --- /dev/null +++ b/include/GCDWebServers/GCDWebServerMultiPartFormRequest.h @@ -0,0 +1 @@ +../../GCDWebServer/Requests/GCDWebServerMultiPartFormRequest.h \ No newline at end of file diff --git a/include/GCDWebServers/GCDWebServerRequest.h b/include/GCDWebServers/GCDWebServerRequest.h new file mode 120000 index 00000000..cdbb6d32 --- /dev/null +++ b/include/GCDWebServers/GCDWebServerRequest.h @@ -0,0 +1 @@ +../../GCDWebServer/Core/GCDWebServerRequest.h \ No newline at end of file diff --git a/include/GCDWebServers/GCDWebServerResponse.h b/include/GCDWebServers/GCDWebServerResponse.h new file mode 120000 index 00000000..03d57247 --- /dev/null +++ b/include/GCDWebServers/GCDWebServerResponse.h @@ -0,0 +1 @@ +../../GCDWebServer/Core/GCDWebServerResponse.h \ No newline at end of file diff --git a/include/GCDWebServers/GCDWebServerStreamedResponse.h b/include/GCDWebServers/GCDWebServerStreamedResponse.h new file mode 120000 index 00000000..98b08b5c --- /dev/null +++ b/include/GCDWebServers/GCDWebServerStreamedResponse.h @@ -0,0 +1 @@ +../../GCDWebServer/Responses/GCDWebServerStreamedResponse.h \ No newline at end of file diff --git a/include/GCDWebServers/GCDWebServerURLEncodedFormRequest.h b/include/GCDWebServers/GCDWebServerURLEncodedFormRequest.h new file mode 120000 index 00000000..f3c8fcd3 --- /dev/null +++ b/include/GCDWebServers/GCDWebServerURLEncodedFormRequest.h @@ -0,0 +1 @@ +../../GCDWebServer/Requests/GCDWebServerURLEncodedFormRequest.h \ No newline at end of file diff --git a/include/GCDWebServers/GCDWebUploader.h b/include/GCDWebServers/GCDWebUploader.h new file mode 120000 index 00000000..552036bc --- /dev/null +++ b/include/GCDWebServers/GCDWebUploader.h @@ -0,0 +1 @@ +../../GCDWebUploader/GCDWebUploader.h \ No newline at end of file