forked from tuist/tuist
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Project.swift
131 lines (123 loc) · 5.62 KB
/
Project.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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
import ProjectDescription
let deploymentTarget: DeploymentTarget = .macOS(targetVersion: "10.15")
let baseSettings: SettingsDictionary = ["EXCLUDED_ARCHS": "arm64"]
func debugSettings() -> SettingsDictionary {
var settings = baseSettings
settings["ENABLE_TESTABILITY"] = "YES"
return settings
}
func releaseSettings() -> SettingsDictionary {
var settings = baseSettings
return settings
}
let packages: [Package] = [
.package(url: "https://github.com/tuist/XcodeProj.git", .upToNextMajor(from: "8.0.0")),
.package(url: "https://github.com/CombineCommunity/CombineExt.git", .upToNextMajor(from: "1.3.0")),
.package(url: "https://github.com/apple/swift-tools-support-core.git", .upToNextMinor(from: "0.2.0")),
.package(url: "https://github.com/ReactiveX/RxSwift.git", .upToNextMajor(from: "5.1.1")),
.package(url: "https://github.com/apple/swift-log.git", .upToNextMajor(from: "1.4.0")),
.package(url: "https://github.com/kishikawakatsumi/KeychainAccess.git", .upToNextMajor(from: "4.2.2")),
.package(url: "https://github.com/httpswift/swifter.git", .upToNextMajor(from: "1.5.0")),
.package(url: "https://github.com/tuist/BlueSignals.git", .upToNextMajor(from: "1.0.21")),
.package(url: "https://github.com/marmelroy/Zip.git", .upToNextMinor(from: "2.1.1")),
.package(url: "https://github.com/rnine/Checksum.git", .upToNextMajor(from: "1.0.2")),
]
func projectDescription() -> [Target] {
[
Target(name: "ProjectDescription",
platform: .macOS,
product: .framework,
bundleId: "io.tuist.ProjectDescription",
deploymentTarget: deploymentTarget,
infoPlist: .default,
sources: ["Sources/ProjectDescription/**/*.swift"],
dependencies: [],
settings: Settings(configurations: [
.debug(name: "Debug", settings: [:], xcconfig: nil),
.release(name: "Release", settings: [:], xcconfig: nil),
])),
Target(name: "ProjectDescriptionTests",
platform: .macOS,
product: .unitTests,
bundleId: "io.tuist.ProjectDescriptionTests",
deploymentTarget: deploymentTarget,
infoPlist: .default,
sources: ["Tests/ProjectDescriptionTests/**/*.swift"],
dependencies: [
.target(name: "ProjectDescription"),
.target(name: "TuistSupportTesting")
],
settings: Settings(configurations: [
.debug(name: "Debug", settings: [:], xcconfig: nil),
.release(name: "Release", settings: [:], xcconfig: nil),
]))
]
}
func module(name: String, product: Product = .staticLibrary, dependencies: [TargetDependency]) -> [Target] {
var testDependencies = dependencies + [.target(name: "Tuist\(name)"), .target(name: "Tuist\(name)Testing"), .package(product: "RxBlocking")]
var testingDependencies = dependencies + [.target(name: "Tuist\(name)")]
return [
Target(name: "Tuist\(name)",
platform: .macOS,
product: product,
bundleId: "io.tuist.Tuist\(name)",
deploymentTarget: deploymentTarget,
infoPlist: .default,
sources: ["Sources/Tuist\(name)/**/*.swift"],
dependencies: dependencies,
settings: Settings(configurations: [
.debug(name: "Debug", settings: [:], xcconfig: nil),
.release(name: "Release", settings: [:], xcconfig: nil),
])),
Target(name: "Tuist\(name)Tests",
platform: .macOS,
product: .unitTests,
bundleId: "io.tuist.Tuist\(name)Tests",
deploymentTarget: deploymentTarget,
infoPlist: .default,
sources: ["Tests/Tuist\(name)Tests/**/*.swift"],
dependencies: testDependencies,
settings: Settings(configurations: [
.debug(name: "Debug", settings: [:], xcconfig: nil),
.release(name: "Release", settings: [:], xcconfig: nil),
])),
Target(name: "Tuist\(name)Testing",
platform: .macOS,
product: .staticLibrary,
bundleId: "io.tuist.Tuist\(name)Testing",
deploymentTarget: deploymentTarget,
infoPlist: .default,
sources: ["Sources/Tuist\(name)Testing/**/*.swift"],
dependencies: testingDependencies,
settings: Settings(configurations: [
.debug(name: "Debug", settings: [:], xcconfig: nil),
.release(name: "Release", settings: [:], xcconfig: nil),
]))
]
}
func targets() -> [Target] {
var targets: [Target] = []
targets.append(contentsOf: module(name: "Support", dependencies: [
.package(product: "CombineExt"),
.package(product: "SwiftToolsSupport-auto"),
.package(product: "RxSwift"),
.package(product: "RxRelay"),
.package(product: "Logging"),
.package(product: "KeychainAccess"),
.package(product: "Swifter"),
.package(product: "Signals"),
.package(product: "Zip"),
.package(product: "Checksum"),
]))
targets.append(contentsOf: projectDescription())
return targets
}
let project = Project(
name: "Tuist",
packages: packages,
settings: Settings(configurations: [
.debug(name: "Debug", settings: debugSettings(), xcconfig: nil),
.release(name: "Release", settings: releaseSettings(), xcconfig: nil),
]),
targets: targets()
)