File tree Expand file tree Collapse file tree 3 files changed +8
-76
lines changed Expand file tree Collapse file tree 3 files changed +8
-76
lines changed Original file line number Diff line number Diff line change 55 FILTERARG =
66endif
77
8- ifdef DOCSVERSION
9- DOCSARG = --module-version $(DOCSVERSION)
10- else
11- DOCSARG =
12- endif
13-
148# if no value provided assume sourcery is in the user's PATH
159SOURCERY ?= sourcery
1610
2115all :
2216 swift build -v
2317
24- # project generates the .xcodeproj, and then modifies it to add
25- # spec .JSON files to the project
26- project :
27- swift package generate-xcodeproj
28- @$(call check_for_gem,xcodeproj)
29- ruby etc/add_json_files.rb
30-
3118exports :
3219 $(SOURCERY ) --sources Sources/MongoSwift/ --templates Sources/MongoSwiftSync/Exports.stencil --output Sources/MongoSwiftSync/Exports.swift
3320
@@ -48,8 +35,6 @@ coverage:
4835 xcrun llvm-cov export -format=" lcov" .build/debug/mongo-swift-driverPackageTests.xctest/Contents/MacOS/mongo-swift-driverPackageTests -instr-profile .build/debug/codecov/default.profdata > info.lcov
4936
5037clean :
51- rm -rf Packages
5238 rm -rf .build
53- rm -rf MongoSwift.xcodeproj
5439 rm Package.resolved
5540
Original file line number Diff line number Diff line change @@ -4,19 +4,15 @@ import NIO
44import XCTest
55
66extension MongoSwiftTestCase {
7- /// Gets the path of the directory containing spec files, depending on whether
8- /// we're running from XCode or the command line
7+ /// Gets the path of the directory containing spec files.
98 static var specsPath : String {
10- // if we can access the "/Tests" directory, assume we're running from command line
11- if FileManager . default. fileExists ( atPath: " ./Tests " ) {
12- return " ./Tests/Specs "
13- }
14- // otherwise we're in Xcode, get the bundle's resource path
15- guard let path = Bundle ( for: self ) . resourcePath else {
16- XCTFail ( " Missing resource path " )
17- return " "
18- }
19- return path
9+ // Approach taken from https://stackoverflow.com/a/58034307
10+ // TODO: SWIFT-1442 Once we drop Swift < 5.3 we can switch to including the JSON files as Resources via our
11+ // package manifest instead.
12+ let thisFile = URL ( fileURLWithPath: #file)
13+ // We are in Sources/TestsCommon/SpecTestUtils.swift; drop 3 components to get up to the root directory.
14+ let baseDirectory = thisFile. deletingLastPathComponent ( ) . deletingLastPathComponent ( ) . deletingLastPathComponent ( )
15+ return baseDirectory. appendingPathComponent ( " Tests " ) . appendingPathComponent ( " Specs " ) . path
2016 }
2117}
2218
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments