Skip to content

Commit

Permalink
Update PactSwiftServer dependency to v0.4.7
Browse files Browse the repository at this point in the history
  • Loading branch information
surpher committed Aug 4, 2023
1 parent 94a6b08 commit 92b45ae
Show file tree
Hide file tree
Showing 11 changed files with 45 additions and 31 deletions.
3 changes: 1 addition & 2 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ disabled_rules:
- identifier_name
- large_tuple
- operator_whitespace
- trailing_whitespace
opt_in_rules:
- attributes
- closure_body_length
- closure_end_indentation
- closure_parameter_position
Expand Down Expand Up @@ -46,6 +44,7 @@ opt_in_rules:
- sorted_imports
- static_operator
- toggle_bool
- trailing_whitespace
- unneeded_parentheses_in_closure_argument
- unused_declaration
- unused_import
Expand Down
5 changes: 5 additions & 0 deletions Configurations/Target-iOS-Shared.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,8 @@ CODE_SIGN_STYLE = Automatic
CLANG_ENABLE_MODULES = YES
ENABLE_BITCODE = NO
ENABLE_TESTING_SEARCH_PATHS = YES

CODE_SIGN_IDENTITY =
ENABLE_MODULE_VERIFIER = YES
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = gnu11 gnu++14
MODULE_VERIFIER_SUPPORTED_LANGUAGES = objective-c objective-c++
4 changes: 4 additions & 0 deletions Configurations/Target-macOS-Shared.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,7 @@ SWIFT_OPTIMIZATION_LEVEL = -Onone
ENABLE_TESTING_SEARCH_PATHS = YES

DEAD_CODE_STRIPPING = YES

ENABLE_MODULE_VERIFIER = YES
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = gnu11 gnu++14
MODULE_VERIFIER_SUPPORTED_LANGUAGES = objective-c objective-c++
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ let package = Package(
],

dependencies: [
.package(url: "https://github.com/surpher/PactSwiftMockServer.git", .exact("0.4.3"))
.package(name: "PactSwiftMockServer", url: "https://github.com/surpher/PactSwiftServer.git", .exact("0.4.7"))
],

targets: [
Expand Down
2 changes: 2 additions & 0 deletions PactSwift.xcfilelist
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
$(SRCROOT)/Sources/Extensions/Bundle+PactSwift.swift
$(SRCROOT)/Sources/Extensions/Task+Timeout.swift
$(SRCROOT)/Sources/Extensions/Date+PactSwift.swift
$(SRCROOT)/Sources/Extensions/UUID+PactSwift.swift
$(SRCROOT)/Sources/Extensions/MockServer+Async.swift
$(SRCROOT)/Sources/Extensions/String+PactSwift.swift
$(SRCROOT)/Sources/Extensions/Dictionary+PactSwift.swift
$(SRCROOT)/Sources/Extensions/Sequence+PactSwift.swift
Expand Down
35 changes: 20 additions & 15 deletions PactSwift.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
AD0AF27C272644E800848FB7 /* ExampleGeneratorTestHelpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD0AF27A272644E800848FB7 /* ExampleGeneratorTestHelpers.swift */; };
AD10361424468AB3002C97CA /* MockService.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD10361324468AB3002C97CA /* MockService.swift */; };
AD103618244693A6002C97CA /* MockServiceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD103617244693A6002C97CA /* MockServiceTests.swift */; };
AD23310826E9EEA900D984A5 /* PactSwiftMockServer in Frameworks */ = {isa = PBXBuildFile; productRef = AD23310726E9EEA900D984A5 /* PactSwiftMockServer */; };
AD23310A26E9EEB100D984A5 /* PactSwiftMockServer in Frameworks */ = {isa = PBXBuildFile; productRef = AD23310926E9EEB100D984A5 /* PactSwiftMockServer */; };
AD23310C26E9F08000D984A5 /* MockServiceWithDirectoryPathTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD23310B26E9F08000D984A5 /* MockServiceWithDirectoryPathTests.swift */; };
AD23310D26E9F08000D984A5 /* MockServiceWithDirectoryPathTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD23310B26E9F08000D984A5 /* MockServiceWithDirectoryPathTests.swift */; };
AD48EC5826CF90B40017E071 /* ProviderVerifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD48EC5726CF90B40017E071 /* ProviderVerifier.swift */; };
Expand Down Expand Up @@ -187,6 +185,8 @@
ADC3AA38247C8C4B0034446E /* InteractionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = ADC3AA36247C8C4B0034446E /* InteractionTests.swift */; };
ADC3AA3D247CBB550034446E /* IncludesLikeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = ADC3AA3C247CBB550034446E /* IncludesLikeTests.swift */; };
ADC3AA3E247CBB550034446E /* IncludesLikeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = ADC3AA3C247CBB550034446E /* IncludesLikeTests.swift */; };
ADC50E272A7D2A7B004E1E03 /* PactSwiftMockServer in Frameworks */ = {isa = PBXBuildFile; productRef = ADC50E262A7D2A7B004E1E03 /* PactSwiftMockServer */; };
ADC50E2B2A7D2D7E004E1E03 /* PactSwiftMockServer in Frameworks */ = {isa = PBXBuildFile; productRef = ADC50E2A2A7D2D7E004E1E03 /* PactSwiftMockServer */; };
ADD0315F2512193500C6099B /* ExampleGeneratorExpressible.swift in Sources */ = {isa = PBXBuildFile; fileRef = ADD0315E2512193500C6099B /* ExampleGeneratorExpressible.swift */; };
ADD031602512193500C6099B /* ExampleGeneratorExpressible.swift in Sources */ = {isa = PBXBuildFile; fileRef = ADD0315E2512193500C6099B /* ExampleGeneratorExpressible.swift */; };
ADD03164251219B700C6099B /* ExampleGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = ADD03163251219B700C6099B /* ExampleGenerator.swift */; };
Expand Down Expand Up @@ -410,7 +410,6 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
AD23310826E9EEA900D984A5 /* PactSwiftMockServer in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -419,14 +418,14 @@
buildActionMask = 2147483647;
files = (
AD881808242C715B00BF510D /* PactSwift.framework in Frameworks */,
ADC50E272A7D2A7B004E1E03 /* PactSwiftMockServer in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
AD8FC7B42463A06F00361854 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
AD23310A26E9EEB100D984A5 /* PactSwiftMockServer in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -435,6 +434,7 @@
buildActionMask = 2147483647;
files = (
AD8FC7C02463A06F00361854 /* PactSwift.framework in Frameworks */,
ADC50E2B2A7D2D7E004E1E03 /* PactSwiftMockServer in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -791,7 +791,6 @@
);
name = PactSwift_iOS;
packageProductDependencies = (
AD23310726E9EEA900D984A5 /* PactSwiftMockServer */,
);
productName = PACTSwift;
productReference = AD8817FE242C715A00BF510D /* PactSwift.framework */;
Expand All @@ -812,6 +811,9 @@
AD88180A242C715B00BF510D /* PBXTargetDependency */,
);
name = PactSwiftTests_iOS;
packageProductDependencies = (
ADC50E262A7D2A7B004E1E03 /* PactSwiftMockServer */,
);
productName = PACTSwiftTests;
productReference = AD881807242C715B00BF510D /* PactSwiftTests_iOS.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
Expand All @@ -834,7 +836,6 @@
);
name = PactSwift_macOS;
packageProductDependencies = (
AD23310926E9EEB100D984A5 /* PactSwiftMockServer */,
);
productName = PactSwift_macOS;
productReference = AD8FC7B72463A06F00361854 /* PactSwift.framework */;
Expand All @@ -854,6 +855,9 @@
AD8FC7C22463A06F00361854 /* PBXTargetDependency */,
);
name = PactSwiftTests_macOS;
packageProductDependencies = (
ADC50E2A2A7D2D7E004E1E03 /* PactSwiftMockServer */,
);
productName = PactSwift_macOSTests;
productReference = AD8FC7BF2463A06F00361854 /* PactSwiftTests_macOS.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
Expand All @@ -864,8 +868,9 @@
AD8817F5242C715A00BF510D /* Project object */ = {
isa = PBXProject;
attributes = {
BuildIndependentTargetsInParallel = YES;
LastSwiftUpdateCheck = 1240;
LastUpgradeCheck = 1400;
LastUpgradeCheck = 1430;
ORGANIZATIONNAME = "PACT Foundation";
TargetAttributes = {
AD8817FD242C715A00BF510D = {
Expand Down Expand Up @@ -893,7 +898,7 @@
);
mainGroup = AD8817F4242C715A00BF510D;
packageReferences = (
AD23310626E9EEA900D984A5 /* XCRemoteSwiftPackageReference "PactSwiftMockServer" */,
ADC50E252A7D2A7B004E1E03 /* XCRemoteSwiftPackageReference "PactSwiftServer" */,
);
productRefGroup = AD8817FF242C715A00BF510D /* Products */;
projectDirPath = "";
Expand Down Expand Up @@ -1470,25 +1475,25 @@
/* End XCConfigurationList section */

/* Begin XCRemoteSwiftPackageReference section */
AD23310626E9EEA900D984A5 /* XCRemoteSwiftPackageReference "PactSwiftMockServer" */ = {
ADC50E252A7D2A7B004E1E03 /* XCRemoteSwiftPackageReference "PactSwiftServer" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/surpher/PactSwiftMockServer";
repositoryURL = "https://github.com/surpher/PactSwiftServer.git";
requirement = {
kind = exactVersion;
version = 0.4.2;
version = 0.4.7;
};
};
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
AD23310726E9EEA900D984A5 /* PactSwiftMockServer */ = {
ADC50E262A7D2A7B004E1E03 /* PactSwiftMockServer */ = {
isa = XCSwiftPackageProductDependency;
package = AD23310626E9EEA900D984A5 /* XCRemoteSwiftPackageReference "PactSwiftMockServer" */;
package = ADC50E252A7D2A7B004E1E03 /* XCRemoteSwiftPackageReference "PactSwiftServer" */;
productName = PactSwiftMockServer;
};
AD23310926E9EEB100D984A5 /* PactSwiftMockServer */ = {
ADC50E2A2A7D2D7E004E1E03 /* PactSwiftMockServer */ = {
isa = XCSwiftPackageProductDependency;
package = AD23310626E9EEA900D984A5 /* XCRemoteSwiftPackageReference "PactSwiftMockServer" */;
package = ADC50E252A7D2A7B004E1E03 /* XCRemoteSwiftPackageReference "PactSwiftServer" */;
productName = PactSwiftMockServer;
};
/* End XCSwiftPackageProductDependency section */
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1400"
LastUpgradeVersion = "1430"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1400"
LastUpgradeVersion = "1430"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
6 changes: 3 additions & 3 deletions Sources/Extensions/MockServer+Async.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import Foundation
@_implementationOnly import PactSwiftMockServer

extension MockServer {

/// Spins up a mock server with expected interactions defined in the provided Pact
///
/// - Parameters:
Expand All @@ -37,7 +37,7 @@ extension MockServer {
}
}
}

/// Verifies all interactions passed to mock server
///
/// By default pact files are written to `/tmp/pacts`.
Expand All @@ -51,7 +51,7 @@ extension MockServer {
}
}
}

/// Finalises Pact tests by writing the pact contract file to disk
///
/// - Parameters:
Expand Down
2 changes: 1 addition & 1 deletion Sources/Extensions/Task+Timeout.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import Foundation

@available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *)
extension Task where Failure == Error {

// Start a new Task with a timeout. If the timeout expires before the operation is
// completed then the task is cancelled and an error is thrown.
@available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *)
Expand Down
13 changes: 6 additions & 7 deletions Sources/MockService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -198,14 +198,13 @@ open class MockService {
}
}
#endif

/// Check there are no invalid interactions
private func checkForInvalidInteractions(_ interactions: [Interaction], file: FileString? = nil, line: UInt? = nil) -> Bool {
let errors = interactions.flatMap(\.encodingErrors)
for error in errors {
failWith(error.localizedDescription, file: file, line: line)
}

return errors.isEmpty == false
}
}
Expand Down Expand Up @@ -245,7 +244,7 @@ extension MockService {
}
}
}

#if canImport(_Concurrency) && compiler(>=5.7) && !os(Linux)
/// Writes a Pact contract file in JSON format
///
Expand Down Expand Up @@ -333,7 +332,7 @@ private extension MockService {
}
}
}

#if canImport(_Concurrency) && compiler(>=5.7) && !os(Linux)
@available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *)
func setupPactInteraction(timeout: TimeInterval, file: FileString?, line: UInt?, mockServer: MockServer, testFunction: @escaping @Sendable (String) async throws -> Void) async throws {
Expand All @@ -354,7 +353,7 @@ private extension MockService {
throw error
}
}

@available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *)
func verifyPactInteraction(timeout: TimeInterval, file: FileString?, line: UInt?, mockServer: MockServer) async throws {
do {
Expand All @@ -363,7 +362,7 @@ private extension MockService {
}
// await task completion (value is discarded)
_ = try await task.value

// If the comsumer (in testFunction:) made the promised request to Mock Server, go and finalize the test.
// Only finalize when running in simulator, maOS or Linux. Running on a physical iOS device makes little sense due to
// writing a pact file to device's disk. `libpact_ffi` does the actual file writing it writes it onto the
Expand All @@ -380,7 +379,7 @@ private extension MockService {
}
}
#endif

func verifyPactInteraction(timeout: TimeInterval, file: FileString?, line: UInt?, mockServer: MockServer) {
waitForPactTestWith(timeout: timeout, file: file, line: line) { [unowned self] completion in
// Ask Mock Server to verify the promised request (testFunction:) has been made
Expand Down

0 comments on commit 92b45ae

Please sign in to comment.