From 263c8c081e9741fed3ab456db906397325695590 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krys=CC=8Ctof=20Mate=CC=8Cj?= Date: Fri, 26 Jul 2019 12:16:10 +0200 Subject: [PATCH] Fix SPM --- .Package.test.swift | 29 +++++++++++++++++-- .gitignore | 2 ++ .../contents.xcworkspacedata | 7 +++++ .../xcshareddata/IDEWorkspaceChecks.plist | 8 +++++ Cartfile.resolved | 6 ++-- Package.swift | 19 ++++++++++-- .../AutoregistrationSpec.swift | 9 +++--- .../OperatorsSpec.swift | 4 +-- .../ResolutionErrorSpec.swift | 2 +- 9 files changed, 71 insertions(+), 15 deletions(-) create mode 100644 .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata create mode 100644 .swiftpm/xcode/package.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/.Package.test.swift b/.Package.test.swift index 5cbe9b3..8c9e061 100644 --- a/.Package.test.swift +++ b/.Package.test.swift @@ -1,10 +1,33 @@ +// swift-tools-version:4.2 + import PackageDescription let package = Package( name: "SwinjectAutoregistration", + products: [ + .library( + name: "SwinjectAutoregistration", + targets: ["SwinjectAutoregistration"]) + ], dependencies: [ - .Package(url: "https://github.com/Swinject/Swinject.git", majorVersion: 2, minor: 5), - .Package(url: "https://github.com/Quick/Quick", majorVersion: 1), - .Package(url: "https://github.com/Quick/Nimble", majorVersion: 7), + .package(url: "https://github.com/Swinject/Swinject.git", from: "2.6.0"), + .package(url: "https://github.com/Quick/Quick", from: "2.1.0"), + .package(url: "https://github.com/Quick/Nimble", from: "8.0.1") + ], + targets: [ + .target( + name: "SwinjectAutoregistration", + dependencies: [ + "Swinject", + ], + path: "Sources"), + .testTarget( + name: "SwinjectAutoregistrationTests", + dependencies: [ + "Quick", + "Nimble", + "Swinject", + "SwinjectAutoregistration", + ]) ] ) diff --git a/.gitignore b/.gitignore index 09d94a9..365016a 100644 --- a/.gitignore +++ b/.gitignore @@ -67,3 +67,5 @@ fastlane/screenshots ## SwinjectStoryboard SwinjectStoryboard.framework.zip + +Package.resolved diff --git a/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata b/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/.swiftpm/xcode/package.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/.swiftpm/xcode/package.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/.swiftpm/xcode/package.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/Cartfile.resolved b/Cartfile.resolved index a12b38b..5125e7e 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,3 +1,3 @@ -github "Quick/Nimble" "v8.0.1" -github "Quick/Quick" "v2.0.0" -github "Swinject/Swinject" "2.6.0" +github "Quick/Nimble" "v8.0.2" +github "Quick/Quick" "v2.1.0" +github "Swinject/Swinject" "2.6.2" diff --git a/Package.swift b/Package.swift index 6aebe29..ab3cfc0 100644 --- a/Package.swift +++ b/Package.swift @@ -1,8 +1,23 @@ +// swift-tools-version:4.2 + import PackageDescription let package = Package( name: "SwinjectAutoregistration", + products: [ + .library( + name: "SwinjectAutoregistration", + targets: ["SwinjectAutoregistration"]) + ], dependencies: [ - .Package(url: "https://github.com/Swinject/Swinject.git", majorVersion: 2) + .package(url: "https://github.com/Swinject/Swinject.git", from: "2.6.0"), + ], + targets: [ + .target( + name: "SwinjectAutoregistration", + dependencies: [ + "Swinject", + ], + path: "Sources"), ] -) \ No newline at end of file +) diff --git a/Tests/SwinjectAutoregistrationTests/AutoregistrationSpec.swift b/Tests/SwinjectAutoregistrationTests/AutoregistrationSpec.swift index 475698f..45c3200 100644 --- a/Tests/SwinjectAutoregistrationTests/AutoregistrationSpec.swift +++ b/Tests/SwinjectAutoregistrationTests/AutoregistrationSpec.swift @@ -207,8 +207,8 @@ class AutoregistrationSpec: QuickSpec { let service = container.resolve(UnwrappedService.self) expect(service).notTo(beNil()) } - - #if !os(Linux) + + #if !SWIFT_PACKAGE it("throws assertion when same type arguments are passed") { expect { () -> Void in container.autoregister(SameArgumentsService.self, arguments: String.self, Int.self, String.self, initializer: SameArgumentsService.init) @@ -237,8 +237,8 @@ class AutoregistrationSpec: QuickSpec { expect(unresolvableService).to(beNil()) expect(logs.count) == 1 } - - #if !os(Linux) + + #if !SWIFT_PACKAGE it("does not loose any logs while multithreading"){ var logs: [String] = [] Container.loggingFunction = { logs.append($0) } @@ -266,6 +266,7 @@ class AutoregistrationSpec: QuickSpec { } #endif + } } } diff --git a/Tests/SwinjectAutoregistrationTests/OperatorsSpec.swift b/Tests/SwinjectAutoregistrationTests/OperatorsSpec.swift index 05f9819..92a0067 100644 --- a/Tests/SwinjectAutoregistrationTests/OperatorsSpec.swift +++ b/Tests/SwinjectAutoregistrationTests/OperatorsSpec.swift @@ -56,8 +56,8 @@ class OperatorsSpec: QuickSpec { let service = container ~> (Service0.self, name: "MyService") expect(service).toNot(beNil()) } - - #if !os(Linux) + + #if !SWIFT_PACKAGE it("fails with message on unresolvable service") { var logs = [String]() Container.loggingFunction = { logs.append($0) } diff --git a/Tests/SwinjectAutoregistrationTests/ResolutionErrorSpec.swift b/Tests/SwinjectAutoregistrationTests/ResolutionErrorSpec.swift index 9ea95de..d10204d 100644 --- a/Tests/SwinjectAutoregistrationTests/ResolutionErrorSpec.swift +++ b/Tests/SwinjectAutoregistrationTests/ResolutionErrorSpec.swift @@ -1,4 +1,4 @@ -#if !os(Linux) +#if !SWIFT_PACKAGE import Quick import Nimble