-
-
Notifications
You must be signed in to change notification settings - Fork 141
/
Package.swift
117 lines (109 loc) · 4.25 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
// swift-tools-version:5.8
import PackageDescription
// Version number can be found in Source/Danger/Danger.swift
// switch to false when release
let isDevelop = true
let swiftLint: Package.Dependency = {
#if compiler(>=5.9)
return .package(url: "https://github.com/Realm/SwiftLint", from: "0.56.0")
#else
return .package(url: "https://github.com/Realm/SwiftLint", exact: "0.53.0")
#endif
}()
let devProducts: [Product] = isDevelop
? [
.library(name: "DangerDeps", type: .dynamic, targets: ["Danger-Swift"])
] : []
let devDependencies: [Package.Dependency] = isDevelop
? [
.package(url: "https://github.com/shibapm/Komondor", from: "1.1.4"),
.package(url: "https://github.com/nicklockwood/SwiftFormat", from: "0.54.0"),
swiftLint,
.package(url: "https://github.com/pointfreeco/swift-snapshot-testing.git", from: "1.17.0"),
.package(url: "https://github.com/shibapm/Rocket", from: "1.3.0"),
] : []
let devTargets: [Target] = isDevelop
? [
.testTarget(name: "DangerTests",
dependencies: [
"Danger",
"DangerFixtures",
.product(name: "SnapshotTesting", package: "swift-snapshot-testing"),
]),
.testTarget(name: "RunnerLibTests",
dependencies: [
"RunnerLib",
.product(name: "SnapshotTesting", package: "swift-snapshot-testing"),
], exclude: ["__Snapshots__"]),
.testTarget(name: "DangerDependenciesResolverTests",
dependencies: [
"DangerDependenciesResolver",
.product(name: "SnapshotTesting", package: "swift-snapshot-testing"),
],
exclude: ["__Snapshots__"]),
]
: []
let package = Package(
name: "danger-swift",
products: [
.library(name: "Danger", targets: ["Danger"]),
.library(name: "DangerFixtures", targets: ["DangerFixtures"]),
.executable(name: "danger-swift", targets: ["Runner"]),
] + devProducts,
dependencies: [
.package(url: "https://github.com/shibapm/Logger", from: "0.1.0"),
.package(url: "https://github.com/mxcl/Version", from: "2.0.1"),
.package(url: "https://github.com/nerdishbynature/octokit.swift", from: "0.13.0"),
] + devDependencies,
targets: [
.target(name: "Danger-Swift", dependencies: ["Danger"]),
.target(name: "DangerShellExecutor"),
.target(name: "DangerDependenciesResolver", dependencies: ["DangerShellExecutor", "Version", "Logger"]),
.target(
name: "Danger",
dependencies: [
.product(name: "OctoKit", package: "octokit.swift"),
"Logger",
"DangerShellExecutor",
]
),
.target(name: "RunnerLib", dependencies: ["Logger", "DangerShellExecutor", "Version"]),
.executableTarget(name: "Runner", dependencies: ["RunnerLib", "Logger", "DangerDependenciesResolver"]),
.target(name: "DangerFixtures", dependencies: ["Danger"]),
] + devTargets
)
#if canImport(PackageConfig)
import PackageConfig
let config = PackageConfiguration([
"komondor": [
"pre-push": "swift test",
"pre-commit": [
"swift test",
"swift test --generate-linuxmain",
"swift run swiftformat .",
"swift run swiftlint autocorrect --path Sources/",
"git add .",
],
],
"rocket": [
"pre_release_checks": [
"clean_git",
],
"steps": [
"Scripts/update_makefile.sh",
"Scripts/update_danger_version.sh",
"Scripts/update_changelog.sh",
"Scripts/change_is_develop.sh false",
"git_add",
"commit",
"tag",
"push",
"Scripts/change_is_develop.sh true",
"git_add",
["commit": ["message": "Enable dev depdendencies"]],
"push",
"Scripts/create_homebrew_tap.sh",
],
],
]).write()
#endif