Skip to content
This repository was archived by the owner on Jan 11, 2023. It is now read-only.

Commit 14f9eed

Browse files
Added support for Swift PM 5.3
1 parent c6d118f commit 14f9eed

21 files changed

+119
-3
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
.DS_Store
2+
.build/
3+
.swiftpm/
24
xcuserdata
35
project.xcworkspace
46
/build

Frameworks/Tests.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
#import <GCDWebServers/GCDWebServers.h>
21
#import <XCTest/XCTest.h>
32

3+
@import GCDWebServers;
4+
45
#pragma clang diagnostic ignored "-Weverything" // Prevent "messaging to unqualified id" warnings
56

67
@interface Tests : XCTestCase

GCDWebUploader/GCDWebUploader.m

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,13 @@ @implementation GCDWebUploader
6666

6767
- (instancetype)initWithUploadDirectory:(NSString*)path {
6868
if ((self = [super init])) {
69-
NSString* bundlePath = [[NSBundle bundleForClass:[GCDWebUploader class]] pathForResource:@"GCDWebUploader" ofType:@"bundle"];
69+
#if SWIFT_PACKAGE
70+
NSBundle* bundle = SWIFTPM_MODULE_BUNDLE;
71+
#else
72+
NSBundle* bundle = [NSBundle bundleForClass:[GCDWebUploader class]];
73+
#endif
74+
75+
NSString* bundlePath = [bundle pathForResource:@"GCDWebUploader" ofType:@"bundle"];
7076
if (bundlePath == nil) {
7177
return nil;
7278
}

Package.swift

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
// swift-tools-version:5.3
2+
// The swift-tools-version declares the minimum version of Swift required to build this package.
3+
4+
import PackageDescription
5+
6+
let package = Package(
7+
name: "GCDWebServer",
8+
products: [
9+
// Products define the executables and libraries produced by a package, and make them visible to other packages.
10+
.library(
11+
name: "GCDWebServers",
12+
targets: ["GCDWebServers"]),
13+
],
14+
dependencies: [
15+
// Dependencies declare other packages that this package depends on.
16+
// .package(url: /* package url */, from: "1.0.0"),
17+
],
18+
targets: [
19+
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
20+
// Targets can depend on other targets in this package, and on products in packages which this package depends on.
21+
.target(
22+
name: "GCDWebServers",
23+
dependencies: [],
24+
path: ".",
25+
exclude: [
26+
"Frameworks",
27+
"iOS",
28+
"Mac",
29+
"Tests",
30+
"tvOS",
31+
"Package.swift",
32+
"GCDWebServer.podspec",
33+
"Run-Tests.sh",
34+
"format-source.sh",
35+
"README.md",
36+
"LICENSE"
37+
],
38+
resources: [
39+
.copy("GCDWebUploader/GCDWebUploader.bundle"),
40+
],
41+
cSettings:[
42+
.headerSearchPath("GCDWebServer/Core"),
43+
.headerSearchPath("GCDWebServer/Requests"),
44+
.headerSearchPath("GCDWebServer/Responses"),
45+
]
46+
),
47+
.testTarget(
48+
name: "GCDWebServersTests",
49+
dependencies: ["GCDWebServers"],
50+
path: "Frameworks",
51+
exclude: [
52+
"GCDWebServers.h",
53+
"Info.plist",
54+
"module.modulemap"
55+
]
56+
),
57+
]
58+
)

README.md

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,39 @@ Requirements:
4343
Getting Started
4444
===============
4545

46+
Swift Package Manager
47+
---------------------
48+
49+
1. From the Xcode menu click File > Swift Packages > Add Package Dependency.
50+
2. In the dialog that appears, enter the repository URL: https://github.com/swisspol/GCDWebServer.
51+
3. In Version, select Up to Next Major and take the default option.
52+
4. Choose 'GCDWebServers' in the Package Product column.
53+
54+
If you are developing a SPM package, you must add the following dependency to your Package.swift:
55+
```swift
56+
dependencies: [
57+
.package(url: "https://github.com/swisspol/GCDWebServer", from: "3.5.5"),
58+
]
59+
```
60+
61+
Finally you declare GCDWebServer as a dependency on your target:
62+
```swift
63+
.target(
64+
name: "YOUR_TARGET_NAME",
65+
dependencies: [
66+
.product(name: "GCDWebServers", package: "GCDWebServer"),
67+
]),
68+
```
69+
70+
Manually
71+
---------
72+
4673
Download or check out the [latest release](https://github.com/swisspol/GCDWebServer/releases) of GCDWebServer then add the entire "GCDWebServer" subfolder to your Xcode project. If you intend to use one of the extensions like GCDWebDAVServer or GCDWebUploader, add these subfolders as well. Finally link to `libz` (via Target > Build Phases > Link Binary With Libraries) and add `$(SDKROOT)/usr/include/libxml2` to your header search paths (via Target > Build Settings > HEADER_SEARCH_PATHS).
4774

48-
Alternatively, you can install GCDWebServer using [CocoaPods](http://cocoapods.org/) by simply adding this line to your Podfile:
75+
CocoaPods
76+
---------
77+
78+
You can install GCDWebServer using [CocoaPods](http://cocoapods.org/). Simply add this line to your Podfile:
4979
```
5080
pod "GCDWebServer", "~> 3.0"
5181
```
@@ -60,6 +90,9 @@ pod "GCDWebServer/WebDAV", "~> 3.0"
6090

6191
And finally run `$ pod install`.
6292

93+
Carthage
94+
---------
95+
6396
You can also use [Carthage](https://github.com/Carthage/Carthage) by adding this line to your Cartfile (3.2.5 is the first release with Carthage support):
6497
```
6598
github "swisspol/GCDWebServer" ~> 3.2.5
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../GCDWebDAVServer/GCDWebDAVServer.h
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../GCDWebServer/Core/GCDWebServer.h
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../GCDWebServer/Core/GCDWebServerConnection.h
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../GCDWebServer/Requests/GCDWebServerDataRequest.h
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../GCDWebServer/Responses/GCDWebServerDataResponse.h

0 commit comments

Comments
 (0)