-
Notifications
You must be signed in to change notification settings - Fork 1
/
Project.swift
204 lines (189 loc) · 8.41 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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
import Foundation
import ProjectDescription
let name = "FulliOS"
let versionNumber = "1.0.0"
let setupGitHooks = TargetScript.pre(
script: readFromFile(.relativeToRoot("Scripts/BuildPhases/setup-git-hooks.sh")),
name: "Setup Git Hooks",
basedOnDependencyAnalysis: false)
let runSwiftGen = TargetScript.pre(
script: readFromFile(.relativeToRoot("Scripts/BuildPhases/run-swiftgen.sh")),
name: "Run SwiftGen",
basedOnDependencyAnalysis: false)
let runRswift = TargetScript.pre(
script: readFromFile(.relativeToRoot("Scripts/BuildPhases/run-rswift.sh")),
name: "Run R.swift",
basedOnDependencyAnalysis: false)
let buildUnityFramework = TargetScript.pre(
script: readFromFile(.relativeToRoot("Scripts/BuildPhases/build-unity-framework.sh")),
name: "Build Unity Framework",
basedOnDependencyAnalysis: false)
let buildKMPFramework = TargetScript.pre(
script: readFromFile(.relativeToRoot("Scripts/BuildPhases/build-kmp-framework.sh")),
name: "Build KMP Framework",
basedOnDependencyAnalysis: false)
let buildFlutterFrameworks = TargetScript.pre(
script: readFromFile(.relativeToRoot("Scripts/BuildPhases/build-flutter-frameworks.sh")),
name: "Build Flutter Frameworks",
basedOnDependencyAnalysis: false)
let runSwiftFormat = TargetScript.pre(
script: readFromFile(.relativeToRoot("Scripts/BuildPhases/run-swiftformat.sh")),
name: "Format Code With SwiftFormat",
basedOnDependencyAnalysis: false)
let runSwiftLint = TargetScript.pre(
script: readFromFile(.relativeToRoot("Scripts/BuildPhases/run-swiftlint.sh")),
name: "Lint Code With SwiftLint",
basedOnDependencyAnalysis: false)
let runSwiftySpell = TargetScript.pre(
script: readFromFile(.relativeToRoot("Scripts/BuildPhases/run-swiftyspell.sh")),
name: "Check Spelling With SwiftySpell",
basedOnDependencyAnalysis: false)
let runPeriphery = TargetScript.pre(
script: readFromFile(.relativeToRoot("Scripts/BuildPhases/run-periphery.sh")),
name: "Identify Unused Code With Periphery",
basedOnDependencyAnalysis: false)
let infoPlist: [String: Plist.Value] = [
"CFBundleShortVersionString": Plist.Value(stringLiteral: versionNumber),
"CFBundleVersion": "1",
"UIMainStoryboardFile": "",
"UILaunchStoryboardName": "LaunchScreen",
"NSAppleMusicUsageDescription": "Please allow access to media.",
"NSPhotoLibraryUsageDescription": "Please allow access to the Photo library to add photo's to posts.",
"NSLocalNetworkUsageDescription": "Please allow access to local network to enable audio calling",
"UIApplicationSceneManifest": ["UISceneConfigurations": [:]],
"UIFileSharingEnabled": .boolean(true),
"LSSupportsOpeningDocumentsInPlace": .boolean(true),
"NSPhotoLibraryAddUsageDescription": "We need access to save photos to your library",
"NSCameraUsageDescription": "We need access to the camera to take photos",
"UIAppFonts": .array([
.string("charlatan.otf"),
.string("balsamiq.ttf"),
.string("din.ttf")
]),
"NSBonjourServices": .array([
.string("_dartobservatory._tcp")
]),
"NSFaceIDUsageDescription": "We use Face ID to enhance security",
"NSLocationWhenInUseUsageDescription": "We need your location to show it on the map",
"NSLocationAlwaysUsageDescription": "We need your location to show it on the map",
"NSMicrophoneUsageDescription": "We need access to your microphone to record audio",
"NSSpeechRecognitionUsageDescription": "This app uses speech recognition to convert your speech to text.",
"NSBluetoothAlwaysUsageDescription": "This app uses Bluetooth to connect to nearby devices for enhanced functionality.",
"NSHealthUpdateUsageDescription": "We need to update your health data.",
"NSHealthShareUsageDescription": "We need to access your health data to provide personalized insights."
]
let project = Project(
name: name,
settings: .settings(
base: [
"DEVELOPMENT_TEAM": "55DHYS5FJZ",
"EXCLUDED_ARCHS[sdk=iphonesimulator*]": "arm64",
"SWIFT_OBJC_BRIDGING_HEADER": "\(name)/Sources/Common/BridgingHeader/FulliOS-Bridging-Header.h",
"GCC_PREFIX_HEADER": "\(name)/Sources/Common/PrefixHeader/FulliOS-Prefix-Header.pch",
"GCC_PRECOMPILE_PREFIX_HEADER": "YES",
"HEADER_SEARCH_PATHS": "$(SRCROOT)/\(name)/Sources/Common/Wrappers/OpenCVWrapper",
"LOCALIZED_STRING_SWIFTUI_SUPPORT": "NO",
"SWIFT_EMIT_LOC_STRINGS": "NO"
],
configurations: [
.debug(
name: "Debug",
xcconfig: .relativeToRoot("Configurations/Debug.xcconfig")),
.release(
name: "Release",
xcconfig: .relativeToRoot("Configurations/Release.xcconfig"))
]),
targets: [
.target(
name: name,
destinations: .iOS,
product: .app,
bundleId: "io.github.yassinelafryhi.\(name)",
infoPlist: .extendingDefault(with: infoPlist),
sources: ["\(name)/Sources/**"],
resources: ["\(name)/Resources/**"],
entitlements: .file(path: .relativeToRoot("\(name)/\(name).entitlements")),
scripts: [
setupGitHooks,
runSwiftGen,
runRswift,
buildUnityFramework,
buildKMPFramework,
buildFlutterFrameworks,
runSwiftFormat,
runSwiftLint,
runSwiftySpell,
runPeriphery
],
dependencies: [
.xcframework(path: .relativeToRoot("Frameworks/App.xcframework")),
.xcframework(path: .relativeToRoot("Frameworks/Flutter.xcframework")),
.framework(path: .relativeToRoot("Frameworks/shared.framework")),
.framework(path: .relativeToRoot("Frameworks/UnityFramework.framework")),
.library(
path: .relativeToRoot("StaticLibs/librust.a"),
publicHeaders: .relativeToRoot("RustLibrary"),
swiftModuleMap: nil),
.library(
path: .relativeToRoot("StaticLibs/libc.a"),
publicHeaders: .relativeToRoot("CLibrary"),
swiftModuleMap: nil)
]),
.target(
name: "\(name)Tests",
destinations: .iOS,
product: .unitTests,
bundleId: "io.github.yassinelafryhi.\(name)Tests",
infoPlist: .default,
sources: ["\(name)/Tests/**"],
resources: [],
dependencies: [
.target(name: name),
.library(
path: .relativeToRoot("StaticLibs/librust.a"),
publicHeaders: .relativeToRoot("RustLibrary"),
swiftModuleMap: nil),
.library(
path: .relativeToRoot("StaticLibs/libc.a"),
publicHeaders: .relativeToRoot("CLibrary"),
swiftModuleMap: nil)
]),
.target(
name: "\(name)UITests",
destinations: .iOS,
product: .uiTests,
bundleId: "io.github.yassinelafryhi.\(name)UITests",
infoPlist: .default,
sources: ["\(name)/UITests/**"],
resources: [],
dependencies: [
.target(name: name),
.library(
path: .relativeToRoot("StaticLibs/librust.a"),
publicHeaders: .relativeToRoot("RustLibrary"),
swiftModuleMap: nil),
.library(
path: .relativeToRoot("StaticLibs/libc.a"),
publicHeaders: .relativeToRoot("CLibrary"),
swiftModuleMap: nil)
])
],
schemes: [
.scheme(
name: name,
shared: true,
buildAction: .buildAction(targets: [.target(name)])),
.scheme(
name: "\(name)Tests",
shared: true,
buildAction: .buildAction(targets: [.target("\(name)Tests")])),
.scheme(
name: "\(name)UITests",
shared: true,
buildAction: .buildAction(targets: [.target("\(name)UITests")]))
])
func readFromFile(_ path: ProjectDescription.Path) -> String {
let fileURL = URL(fileURLWithPath: path.pathString)
let content = try! String(contentsOf: fileURL, encoding: .utf8)
return content
}