From a448031a3549b0a4fe698b402c3ec13c10805ca7 Mon Sep 17 00:00:00 2001 From: Tobias Ottenweller Date: Wed, 16 Sep 2020 22:06:56 +0200 Subject: [PATCH] Swift Package Manager Support added. --- Package.swift | 86 +++++++++++++++++++ Pod/Core/XCTestCase+Gherkin.swift | 4 + Pod/Native/NativeTestCase.swift | 4 + .../XCTest-Gherkin-ObjC/UnusedStepsTracker.h | 1 + .../XCGNativeInitializer.h | 1 + README.md | 5 ++ 6 files changed, 101 insertions(+) create mode 100644 Package.swift create mode 120000 Pod/include/XCTest-Gherkin-ObjC/UnusedStepsTracker.h create mode 120000 Pod/include/XCTest-Gherkin-ObjC/XCGNativeInitializer.h diff --git a/Package.swift b/Package.swift new file mode 100644 index 0000000..678db28 --- /dev/null +++ b/Package.swift @@ -0,0 +1,86 @@ +// swift-tools-version:5.3 + +import PackageDescription + +let package = Package( + name: "XCTest_Gherkin", + products: [ + .library( + name: "XCTest_Gherkin", + targets: ["XCTest_Gherkin"]), + ], + dependencies: [], + targets: [ + .target( + name: "XCTest_Gherkin_ObjC", + dependencies: [], + path: "Pod", + exclude: [ + "Core/Background.swift", + "Core/ClassHelperMethods.swift", + "Core/Example.swift", + "Core/LevenshteinDistance.swift", + "Core/MatchedStringRepresentable.swift", + "Core/PageObject.swift", + "Core/Step.swift", + "Core/StepDefiner.swift", + "Core/StringGherkinExtension.swift", + "Core/XCTestCase+Gherkin.swift", + "Native/Language.swift", + "Native/NativeExample.swift", + "Native/NativeFeature.swift", + "Native/NativeFeatureParser.swift", + "Native/NativeRunner.swift", + "Native/NativeScenario.swift", + "Native/NativeTestCase.swift", + "Native/ParseState.swift", + "Native/gherkin-languages.json" + ], + sources: [ + "Core/UnusedStepsTracker.h", + "Core/UnusedStepsTracker.m", + "Native/XCGNativeInitializer.h", + "Native/XCGNativeInitializer.m" + ], + cSettings: [ + .headerSearchPath("Core"), + .headerSearchPath("Native"), + ] + ), + .target( + name: "XCTest_Gherkin", + dependencies: [ + "XCTest_Gherkin_ObjC" + ], + path: "Pod", + exclude: [ + "Core/UnusedStepsTracker.h", + "Core/UnusedStepsTracker.m", + "Native/XCGNativeInitializer.h", + "Native/XCGNativeInitializer.m" + ], + sources: [ + "Core/Background.swift", + "Core/ClassHelperMethods.swift", + "Core/Example.swift", + "Core/LevenshteinDistance.swift", + "Core/MatchedStringRepresentable.swift", + "Core/PageObject.swift", + "Core/Step.swift", + "Core/StepDefiner.swift", + "Core/StringGherkinExtension.swift", + "Core/XCTestCase+Gherkin.swift", + "Native/Language.swift", + "Native/NativeExample.swift", + "Native/NativeFeature.swift", + "Native/NativeFeatureParser.swift", + "Native/NativeRunner.swift", + "Native/NativeScenario.swift", + "Native/NativeTestCase.swift", + "Native/ParseState.swift" + ], + resources: [ + .process("Native/gherkin-languages.json") + ]), + ] +) diff --git a/Pod/Core/XCTestCase+Gherkin.swift b/Pod/Core/XCTestCase+Gherkin.swift index 6185af6..971d81f 100644 --- a/Pod/Core/XCTestCase+Gherkin.swift +++ b/Pod/Core/XCTestCase+Gherkin.swift @@ -10,6 +10,10 @@ import Foundation import XCTest import WebKit +#if canImport(XCTest_Gherkin_ObjC) +import XCTest_Gherkin_ObjC +#endif + /** I wanted this to work with both KIFTestCase and UITestCase which meant extending UITestCase - a subclass wouldn't work with both of them. diff --git a/Pod/Native/NativeTestCase.swift b/Pod/Native/NativeTestCase.swift index a608489..2a88d8d 100644 --- a/Pod/Native/NativeTestCase.swift +++ b/Pod/Native/NativeTestCase.swift @@ -11,6 +11,10 @@ import ObjectiveC import XCTest +#if canImport(XCTest_Gherkin_ObjC) +import XCTest_Gherkin_ObjC +#endif + open class NativeTestCase: XCGNativeInitializer { /// Overrides XCGNativeInitializer processFeatures to create the necessary diff --git a/Pod/include/XCTest-Gherkin-ObjC/UnusedStepsTracker.h b/Pod/include/XCTest-Gherkin-ObjC/UnusedStepsTracker.h new file mode 120000 index 0000000..62d4c38 --- /dev/null +++ b/Pod/include/XCTest-Gherkin-ObjC/UnusedStepsTracker.h @@ -0,0 +1 @@ +../../Core/UnusedStepsTracker.h \ No newline at end of file diff --git a/Pod/include/XCTest-Gherkin-ObjC/XCGNativeInitializer.h b/Pod/include/XCTest-Gherkin-ObjC/XCGNativeInitializer.h new file mode 120000 index 0000000..eb7fe2b --- /dev/null +++ b/Pod/include/XCTest-Gherkin-ObjC/XCGNativeInitializer.h @@ -0,0 +1 @@ +../../Native/XCGNativeInitializer.h \ No newline at end of file diff --git a/README.md b/README.md index 8f0b54c..d84d32b 100644 --- a/README.md +++ b/README.md @@ -297,6 +297,11 @@ github "net-a-porter-mobile/XCTest-Gherkin" == 0.13.2 and run `carthage bootstrap --platform iOS`. The generated framework is named `XCTest_Gherkin.framework`. +### Swift Package Manager +In your Xcode project add XCTest-Gherkin via the File -> Swift Packages -> Add package dependency... menu. + +Note that Xcode 12 and Swift 5.3 is a minimum requirement for using XCTest-Gherkin in combination with Swift Package Manager. + ## Configuration No configuration is needed.