forked from alemar11/CoreDataPlus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Package.swift
51 lines (46 loc) · 1.56 KB
/
Package.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// swift-tools-version:5.5
import PackageDescription
import Foundation
let isRunningTestsFromCommandLine: Bool = {
return ProcessInfo.processInfo.environment["XPC_SERVICE_NAME"] == "0"
}()
var excluded = [
"TestPlans",
"Resources/SampleModel/Fixtures/README.md"
]
var resources: [Resource] = [
.copy("Resources/SampleModel/Fixtures/SampleModelV1.sqlite"),
.copy("Resources/SampleModel/Fixtures/SampleModelV2.sqlite")
]
if isRunningTestsFromCommandLine {
// When running tests from terminal, these resources needs to be copied in the test bundle,
// viceversa when running tests from Xcode, Xcode will create automatically these binaries automaticcally.
resources.append(contentsOf: [
.copy("Resources/SampleModel/Fixtures/SampleModel.momd"),
.copy("Resources/SampleModel/Fixtures/V2toV3.cdm"),
])
} else {
// When running tests from Xcode, these resources needs to be excluded
// because they are automatically created by Xcode
excluded.append(contentsOf: [
"Resources/SampleModel/Fixtures/SampleModel.momd",
"Resources/SampleModel/Fixtures/V2toV3.cdm"
])
}
let package = Package(
name: "CoreDataPlus",
platforms: [.macOS(.v10_14), .iOS(.v12), .tvOS(.v12), .watchOS(.v5)],
products: [
.library(name: "CoreDataPlus", targets: ["CoreDataPlus"])
],
targets: [
.target(name: "CoreDataPlus", path: "Sources"),
.testTarget(name: "Tests",
dependencies: ["CoreDataPlus"],
path: "Tests",
exclude: excluded,
resources: resources
),
],
swiftLanguageVersions: [.v5]
)