-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Project.swift
137 lines (131 loc) · 4.92 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
132
133
134
135
136
137
import ProjectDescription
import ProjectDescriptionHelpers
import Foundation
import Env
// MARK: - Project
let bundleId = "com.zenangst.MouseDef"
func xcconfig(_ targetName: String) -> String { "Configurations/\(targetName).xcconfig" }
func sources(_ folder: String) -> SourceFilesList { "\(folder)/Sources/**" }
func resources(_ folder: String) -> ResourceFileElements { "\(folder)/Resources/**" }
let envPath = URL(fileURLWithPath: String(#filePath))
.deletingLastPathComponent()
.absoluteString
.replacingOccurrences(of: "file://", with: "")
.appending(".env")
let env = EnvHelper(envPath)
let project = Project(
name: "MouseDef",
options: Project.Options.options(
textSettings: .textSettings(indentWidth: 2,
tabWidth: 2)),
packages: PackageResolver.packages(env),
settings: Settings.settings(configurations: [
.debug(name: "Debug", xcconfig: "\(xcconfig("Debug"))"),
.release(name: "Release", xcconfig: "\(xcconfig("Release"))")
], defaultSettings: .recommended),
targets: [
Target(
name: "MouseDef",
platform: .macOS,
product: .app,
bundleId: bundleId,
deploymentTarget: DeploymentTarget.macOS(targetVersion: "13.0"),
infoPlist: .file(path: .relativeToRoot("App/Info.plist")),
sources: sources("App"),
resources: resources("App"),
entitlements: "App/Entitlements/com.zenangst.MouseDef.entitlements",
dependencies: [
.package(product: "AXEssibility"),
.package(product: "Bonzai"),
.package(product: "MachPort"),
.package(product: "Intercom"),
.package(product: "Sparkle"),
.package(product: "Windows"),
],
settings:
Settings.settings(
base: [
"ASSETCATALOG_COMPILER_APPICON_NAME": "AppIcon",
"CODE_SIGN_IDENTITY": "Apple Development",
"CODE_SIGN_STYLE": "Automatic",
"CURRENT_PROJECT_VERSION": "265",
"DEVELOPMENT_TEAM": env["TEAM_ID"],
"ENABLE_HARDENED_RUNTIME": true,
"MARKETING_VERSION": "1.0.0rc15",
"PRODUCT_NAME": "MouseDef"
],
configurations: [
.debug(name: "Debug", xcconfig: "\(xcconfig("Debug"))"),
.release(name: "Release", xcconfig: "\(xcconfig("Release"))")
],
defaultSettings: .recommended)
)
],
schemes: [
Scheme(
name: "MouseDef",
shared: true,
hidden: false,
buildAction: .buildAction(targets: ["MouseDef"]),
testAction: .targets(
["UnitTests"],
arguments: .init(environmentVariables: [
"SOURCE_ROOT": .init(value: "$(SRCROOT)", isEnabled: true),
], launchArguments: [
LaunchArgument(name: "-running-unit-tests", isEnabled: true)
]),
options: TestActionOptions.options(
coverage: true,
codeCoverageTargets: [
TargetReference(stringLiteral: "MouseDef")
]
)
),
runAction: .runAction(
executable: "MouseDef",
arguments:
.init(environmentVariables: [
"SOURCE_ROOT": .init(value: "$(SRCROOT)", isEnabled: true),
"APP_ENVIRONMENT_OVERRIDE": .init(value: "development", isEnabled: true),
], launchArguments: [
LaunchArgument(name: "-benchmark", isEnabled: false),
LaunchArgument(name: "-debugEditing", isEnabled: false),
LaunchArgument(name: "-injection", isEnabled: false),
LaunchArgument(name: "-disableMachPorts", isEnabled: false),
])
)
)
],
additionalFiles: [
FileElement(stringLiteral: ".env"),
FileElement(stringLiteral: ".gitignore"),
FileElement(stringLiteral: "Project.swift"),
FileElement(stringLiteral: "README.md"),
FileElement(stringLiteral: "Tuist/Dependencies.swift"),
]
)
public enum PackageResolver {
public static func packages(_ env: EnvHelper) -> [Package] {
let packages: [Package]
if env["PACKAGE_DEVELOPMENT"] == "true" {
packages = [
.package(path: "../AXEssibility"),
.package(path: "../Bonzai"),
.package(path: "../Intercom"),
.package(path: "../MachPort"),
.package(path: "../Windows"),
.package(url: "https://github.com/sparkle-project/Sparkle.git", from: "2.4.1"),
]
} else {
packages = [
.package(url: "https://github.com/zenangst/AXEssibility.git", from: "0.0.16"),
.package(url: "https://github.com/zenangst/Bonzai.git", .revision("d88f535240a1d3730c112fb52f6753226bd5b4a3")),
.package(url: "https://github.com/zenangst/MachPort.git", from: "3.1.1"),
.package(url: "https://github.com/zenangst/Intercom.git", .revision("7770b453f171c68961b0d4e5dc8ed1ddf0377762")),
.package(url: "https://github.com/zenangst/Windows.git", from: "1.1.0"),
.package(url: "https://github.com/sparkle-project/Sparkle.git", from: "2.4.1"),
]
}
return packages
}
}