forked from danger/swift
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPackage.swift
88 lines (81 loc) · 3.51 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
// swift-tools-version:5.4
import PackageDescription
// Version number can be found in Source/Danger/Danger.swift
// switch to false when release
let isDevelop = true
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.3"),
.package(url: "https://github.com/nicklockwood/SwiftFormat", from: "0.49.4"),
.package(url: "https://github.com/Realm/SwiftLint", from: "0.46.2"),
.package(name: "SnapshotTesting", url: "https://github.com/pointfreeco/swift-snapshot-testing.git", from: "1.7.1"),
.package(url: "https://github.com/shibapm/Rocket", from: "1.2.1"),
] : []
let devTargets: [Target] = isDevelop
? [
.testTarget(name: "DangerTests", dependencies: ["Danger", "DangerFixtures", "SnapshotTesting"]),
.testTarget(name: "RunnerLibTests", dependencies: ["RunnerLib", "SnapshotTesting"], exclude: ["__Snapshots__"]),
.testTarget(name: "DangerDependenciesResolverTests", dependencies: ["DangerDependenciesResolver", "SnapshotTesting"], 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.0"),
.package(name: "OctoKit", url: "https://github.com/nerdishbynature/octokit.swift", from: "0.11.0"),
] + devDependencies,
targets: [
.target(name: "Danger-Swift", dependencies: ["Danger"]),
.target(name: "DangerShellExecutor"),
.target(name: "DangerDependenciesResolver", dependencies: ["DangerShellExecutor", "Version", "Logger"]),
.target(name: "Danger", dependencies: ["OctoKit", "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