Add Swift Package Manager support
Add Package.swift with three products: GCDWebServer (core), GCDWebUploader, and GCDWebDAVServer. Public headers live across Core/Requests/Responses subdirectories, which SPM cannot expose directly. To support SPM without moving any files (keeping the Xcode project and CocoaPods builds intact), public headers are surfaced through symlinks in include/ directories with a hand-written umbrella-directory module map; the private GCDWebServerPrivate.h is left unlinked so it stays out of the public module. GCDWebUploader.bundle is shipped as a .copy resource and located at runtime via SWIFTPM_MODULE_BUNDLE under a #if SWIFT_PACKAGE branch. Verified: swift build (all targets), Swift module imports, Xcode framework build, and the XCTest suite all pass. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@ -66,7 +66,12 @@ NS_ASSUME_NONNULL_END
|
||||
|
||||
- (instancetype)initWithUploadDirectory:(NSString*)path {
|
||||
if ((self = [super init])) {
|
||||
#if SWIFT_PACKAGE
|
||||
// When built with Swift Package Manager, resources live inside the auto-generated module bundle
|
||||
NSString* bundlePath = [SWIFTPM_MODULE_BUNDLE pathForResource:@"GCDWebUploader" ofType:@"bundle"];
|
||||
#else
|
||||
NSString* bundlePath = [[NSBundle bundleForClass:[GCDWebUploader class]] pathForResource:@"GCDWebUploader" ofType:@"bundle"];
|
||||
#endif
|
||||
if (bundlePath == nil) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user