Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Swift Package Manager support #50

Merged
merged 5 commits into from
Jan 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,6 @@ docs/undocumented.json
## Gems
.bundle
vendor/bundle

## Swift Package build
.build
8 changes: 8 additions & 0 deletions LinuxMain.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import XCTest

import DifferenceKitTests

var tests = [XCTestCaseEntry]()
tests += DifferenceKitTests.__allTests()

XCTMain(tests)
22 changes: 22 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// swift-tools-version:4.2

import PackageDescription

let package = Package(
name: "DifferenceKit",
products: [
.library(name: "DifferenceKit", targets: ["DifferenceKit"])
],
targets: [
.target(
name: "DifferenceKit",
path: "Sources",
exclude: ["Extensions"]
),
.testTarget(
name: "DifferenceKitTests",
dependencies: ["DifferenceKit"],
path: "Tests"
)
]
)
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,26 @@ And run
carthage update
```

### [Swift Package Manager](https://swift.org/package-manager/)
To use DifferenceKit in a project with SPM, add the following to your `Package.swift`:
```swift
import PackageDescription

let package = Package(
name: "YourProjectName",
products: [
.executable(name: "yourexecutable", targets: ["yourexecutable"]),
],
dependencies: [
.package(url: "https://github.com/ra1028/DifferenceKit.git", from: "0.8.0")
],
targets: [
.target(name: "yourexecutable", dependencies: ["DifferenceKit"])
]
)
```
The SPM version does not include the UIKit and AppKit extensions.

---

## Contribution
Expand Down
95 changes: 95 additions & 0 deletions Tests/XCTestManifests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
import XCTest

extension AlgorithmTestCase {
static let __allTests = [
("testComplicated1", testComplicated1),
("testComplicated10", testComplicated10),
("testComplicated11", testComplicated11),
("testComplicated2", testComplicated2),
("testComplicated3", testComplicated3),
("testComplicated4", testComplicated4),
("testComplicated5", testComplicated5),
("testComplicated6", testComplicated6),
("testComplicated7", testComplicated7),
("testComplicated8", testComplicated8),
("testComplicated9", testComplicated9),
("testDeleted", testDeleted),
("testDuplicated", testDuplicated),
("testDuplicatedElement", testDuplicatedElement),
("testDuplicatedSection", testDuplicatedSection),
("testDuplicatedSectionAndElement", testDuplicatedSectionAndElement),
("testEmptyChangesets", testEmptyChangesets),
("testInserted", testInserted),
("testMixedChanges", testMixedChanges),
("testMixedSectionChanges", testMixedSectionChanges),
("testMoved", testMoved),
("testSameHashValue", testSameHashValue),
("testSectionDeleted", testSectionDeleted),
("testSectionedEmptyChangesets", testSectionedEmptyChangesets),
("testSectionInserted", testSectionInserted),
("testSectionMoved", testSectionMoved),
("testSectionUpdated", testSectionUpdated),
("testUpdated", testUpdated),
]
}

extension AnyDifferentiableTestCase {
static let __allTests = [
("testHashable", testHashable),
]
}

extension ArraySectionTestCase {
static let __allTests = [
("testReinitialize", testReinitialize),
]
}

extension ChangesetTestCase {
static let __allTests = [
("testchangeCount", testchangeCount),
("testEquatable", testEquatable),
("testHasChanges", testHasChanges),
]
}

extension ContentEquatableTestCase {
static let __allTests = [
("testEquatableValue", testEquatableValue),
("testOptionalValue", testOptionalValue),
]
}

extension ElementPathTestCase {
static let __allTests = [
("testHashable", testHashable),
]
}

extension MeasurementTestCase {
static let __allTests = [
("testMeasureAlgorithmForLinearCollection", testMeasureAlgorithmForLinearCollection),
("testMeasureAlgorithmForSectionedCollection", testMeasureAlgorithmForSectionedCollection),
]
}

extension StagedChangesetTestCase {
static let __allTests = [
("testEquatable", testEquatable),
]
}

#if !os(macOS)
public func __allTests() -> [XCTestCaseEntry] {
return [
testCase(AlgorithmTestCase.__allTests),
testCase(AnyDifferentiableTestCase.__allTests),
testCase(ArraySectionTestCase.__allTests),
testCase(ChangesetTestCase.__allTests),
testCase(ContentEquatableTestCase.__allTests),
testCase(ElementPathTestCase.__allTests),
testCase(MeasurementTestCase.__allTests),
testCase(StagedChangesetTestCase.__allTests),
]
}
#endif