-
-
Notifications
You must be signed in to change notification settings - Fork 506
/
GeneratorModelLoader.swift
661 lines (580 loc) · 27.2 KB
/
GeneratorModelLoader.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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
import Basic
import Foundation
import ProjectDescription
import TuistCore
import TuistGenerator
enum GeneratorModelLoaderError: Error, Equatable, FatalError {
case featureNotYetSupported(String)
case missingFile(AbsolutePath)
var type: ErrorType {
switch self {
case .featureNotYetSupported:
return .abort
case .missingFile:
return .abort
}
}
var description: String {
switch self {
case let .featureNotYetSupported(details):
return "\(details) is not yet supported"
case let .missingFile(path):
return "Couldn't find file at path '\(path.pathString)'"
}
}
}
class GeneratorModelLoader: GeneratorModelLoading {
private let fileHandler: FileHandling
private let manifestLoader: GraphManifestLoading
private let manifestTargetGenerator: ManifestTargetGenerating?
private let printer: Printing
private let manifestLinter: ManifestLinting
init(fileHandler: FileHandling,
manifestLoader: GraphManifestLoading,
manifestLinter: ManifestLinting,
manifestTargetGenerator: ManifestTargetGenerating? = nil,
printer: Printing = Printer()) {
self.fileHandler = fileHandler
self.manifestLoader = manifestLoader
self.manifestLinter = manifestLinter
self.manifestTargetGenerator = manifestTargetGenerator
self.printer = printer
}
/// Load a Project model at the specified path
///
/// - Parameters:
/// - path: The absolute path for the project model to load.
/// - Returns: The Project loaded from the specified path
/// - Throws: Error encountered during the loading process (e.g. Missing project)
func loadProject(at path: AbsolutePath) throws -> TuistGenerator.Project {
let manifest = try manifestLoader.loadProject(at: path)
let tuistConfig = try loadTuistConfig(at: path)
try manifestLinter.lint(project: manifest)
.printAndThrowIfNeeded(printer: printer)
let project = try TuistGenerator.Project.from(manifest: manifest,
path: path,
fileHandler: fileHandler,
printer: printer,
tuistConfig: tuistConfig)
return try enriched(model: project, with: tuistConfig)
}
func loadWorkspace(at path: AbsolutePath) throws -> TuistGenerator.Workspace {
let manifest = try manifestLoader.loadWorkspace(at: path)
let workspace = try TuistGenerator.Workspace.from(manifest: manifest,
path: path,
fileHandler: fileHandler,
manifestLoader: manifestLoader,
printer: printer)
return workspace
}
/// Load a TusitConfig model at the specified path
///
/// - Parameter path: The absolute path for the tuistconfig model to load
/// - Returns: The tuistconfig loaded from the specified path
/// - Throws: Error encountered during the loading process (e.g. Missing tuistconfig)
func loadTuistConfig(at path: AbsolutePath) throws -> TuistGenerator.TuistConfig {
guard let tuistConfigPath = locateDirectoryTraversingParents(from: path, path: "TuistConfig.swift", fileHandler: fileHandler) else {
return TuistGenerator.TuistConfig.default
}
let manifest = try manifestLoader.loadTuistConfig(at: tuistConfigPath.parentDirectory)
return try TuistGenerator.TuistConfig.from(manifest: manifest, path: path)
}
/// Traverses the parent directories until the given path is found.
///
/// - Parameters:
/// - from: A path to a directory from which search the TuistConfig.swift.
/// - fileHandler: An instance to interact with the file system.
/// - Returns: The found path.
fileprivate func locateDirectoryTraversingParents(from: AbsolutePath, path: String, fileHandler: FileHandling) -> AbsolutePath? {
let tuistConfigPath = from.appending(component: path)
if fileHandler.exists(tuistConfigPath) {
return tuistConfigPath
} else if from == AbsolutePath("/") {
return nil
} else {
return locateDirectoryTraversingParents(from: from.parentDirectory, path: path, fileHandler: fileHandler)
}
}
private func enriched(model: TuistGenerator.Project,
with config: TuistGenerator.TuistConfig) throws -> TuistGenerator.Project {
var enrichedModel = model
// Manifest target
if let manifestTargetGenerator = manifestTargetGenerator, config.generationOptions.contains(.generateManifest) {
let manifestTarget = try manifestTargetGenerator.generateManifestTarget(for: enrichedModel.name,
at: enrichedModel.path)
enrichedModel = enrichedModel.adding(target: manifestTarget)
}
// Xcode project file name
let xcodeFileName = xcodeFileNameOverride(from: config, for: model)
enrichedModel = enrichedModel.replacing(fileName: xcodeFileName)
return enrichedModel
}
private func xcodeFileNameOverride(from config: TuistGenerator.TuistConfig,
for model: TuistGenerator.Project) -> String? {
var xcodeFileName = config.generationOptions.compactMap { item -> String? in
switch item {
case let .xcodeProjectName(projectName):
return projectName.description
default:
return nil
}
}.first
let projectNameTemplate = TemplateString.Token.projectName.rawValue
xcodeFileName = xcodeFileName?.replacingOccurrences(of: projectNameTemplate,
with: model.name)
return xcodeFileName
}
}
extension TuistGenerator.TuistConfig {
static func from(manifest: ProjectDescription.TuistConfig,
path: AbsolutePath) throws -> TuistGenerator.TuistConfig {
let generationOptions = try manifest.generationOptions.map { try TuistGenerator.TuistConfig.GenerationOption.from(manifest: $0, path: path) }
return TuistGenerator.TuistConfig(generationOptions: generationOptions)
}
}
extension TuistGenerator.TuistConfig.GenerationOption {
static func from(manifest: ProjectDescription.TuistConfig.GenerationOptions,
path _: AbsolutePath) throws -> TuistGenerator.TuistConfig.GenerationOption {
switch manifest {
case .generateManifest:
return .generateManifest
case let .xcodeProjectName(templateString):
return .xcodeProjectName(templateString.description)
}
}
}
extension TuistGenerator.Workspace {
static func from(manifest: ProjectDescription.Workspace,
path: AbsolutePath,
fileHandler: FileHandling,
manifestLoader: GraphManifestLoading,
printer: Printing) throws -> TuistGenerator.Workspace {
func globProjects(_ string: String) -> [AbsolutePath] {
let projects = fileHandler.glob(path, glob: string)
.lazy
.filter(fileHandler.isFolder)
.filter {
manifestLoader.manifests(at: $0).contains(.project)
}
if projects.isEmpty {
printer.print(warning: "No projects found at: \(string)")
}
return Array(projects)
}
let additionalFiles = manifest.additionalFiles.flatMap {
TuistGenerator.FileElement.from(manifest: $0,
path: path,
fileHandler: fileHandler,
printer: printer)
}
return TuistGenerator.Workspace(name: manifest.name,
projects: manifest.projects.flatMap(globProjects),
additionalFiles: additionalFiles)
}
}
extension TuistGenerator.FileElement {
static func from(manifest: ProjectDescription.FileElement,
path: AbsolutePath,
fileHandler: FileHandling,
printer: Printing,
includeFiles: @escaping (AbsolutePath) -> Bool = { _ in true }) -> [TuistGenerator.FileElement] {
func globFiles(_ string: String) -> [AbsolutePath] {
let files = fileHandler.glob(path, glob: string)
.filter(includeFiles)
if files.isEmpty {
if fileHandler.isFolder(path.appending(RelativePath(string))) {
printer.print(warning: "'\(string)' is a directory, try using: '\(string)/**' to list its files")
} else {
printer.print(warning: "No files found at: \(string)")
}
}
return files
}
func folderReferences(_ relativePath: String) -> [AbsolutePath] {
let folderReferencePath = path.appending(RelativePath(relativePath))
guard fileHandler.exists(folderReferencePath) else {
printer.print(warning: "\(relativePath) does not exist")
return []
}
guard fileHandler.isFolder(folderReferencePath) else {
printer.print(warning: "\(relativePath) is not a directory - folder reference paths need to point to directories")
return []
}
return [folderReferencePath]
}
switch manifest {
case let .glob(pattern: pattern):
return globFiles(pattern).map(FileElement.file)
case let .folderReference(path: folderReferencePath):
return folderReferences(folderReferencePath).map(FileElement.folderReference)
}
}
}
extension TuistGenerator.Project {
static func from(manifest: ProjectDescription.Project,
path: AbsolutePath,
fileHandler: FileHandling,
printer: Printing,
tuistConfig _: TuistGenerator.TuistConfig) throws -> TuistGenerator.Project {
let name = manifest.name
let settings = manifest.settings.map { TuistGenerator.Settings.from(manifest: $0, path: path) }
let targets = try manifest.targets.map {
try TuistGenerator.Target.from(manifest: $0,
path: path,
fileHandler: fileHandler,
printer: printer)
}
let schemes = manifest.schemes.map { TuistGenerator.Scheme.from(manifest: $0) }
let additionalFiles = manifest.additionalFiles.flatMap {
TuistGenerator.FileElement.from(manifest: $0,
path: path,
fileHandler: fileHandler,
printer: printer)
}
return Project(path: path,
name: name,
settings: settings ?? .default,
filesGroup: .group(name: "Project"),
targets: targets,
schemes: schemes,
additionalFiles: additionalFiles)
}
func adding(target: TuistGenerator.Target) -> TuistGenerator.Project {
return Project(path: path,
name: name,
fileName: fileName,
settings: settings,
filesGroup: filesGroup,
targets: targets + [target],
schemes: schemes,
additionalFiles: additionalFiles)
}
func replacing(fileName: String?) -> TuistGenerator.Project {
return Project(path: path,
name: name,
fileName: fileName,
settings: settings,
filesGroup: filesGroup,
targets: targets,
schemes: schemes,
additionalFiles: additionalFiles)
}
}
extension TuistGenerator.Target {
static func from(manifest: ProjectDescription.Target,
path: AbsolutePath,
fileHandler: FileHandling,
printer: Printing) throws -> TuistGenerator.Target {
let name = manifest.name
let platform = try TuistGenerator.Platform.from(manifest: manifest.platform)
let product = TuistGenerator.Product.from(manifest: manifest.product)
let bundleId = manifest.bundleId
let productName = manifest.productName
let dependencies = manifest.dependencies.map { TuistGenerator.Dependency.from(manifest: $0) }
let infoPlist = TuistGenerator.InfoPlist.from(manifest: manifest.infoPlist, path: path)
let entitlements = manifest.entitlements.map { path.appending(RelativePath($0)) }
let settings = manifest.settings.map { TuistGenerator.Settings.from(manifest: $0, path: path) }
let sources = try TuistGenerator.Target.sources(projectPath: path, sources: manifest.sources?.globs.map {
(glob: $0.glob, compilerFlags: $0.compilerFlags)
} ?? [])
let resourceFilter = { (path: AbsolutePath) -> Bool in
TuistGenerator.Target.isResource(path: path, fileHandler: fileHandler)
}
let resources = (manifest.resources ?? []).flatMap {
TuistGenerator.FileElement.from(manifest: $0,
path: path,
fileHandler: fileHandler,
printer: printer,
includeFiles: resourceFilter)
}
let headers = manifest.headers.map { TuistGenerator.Headers.from(manifest: $0, path: path, fileHandler: fileHandler) }
let coreDataModels = try manifest.coreDataModels.map {
try TuistGenerator.CoreDataModel.from(manifest: $0, path: path, fileHandler: fileHandler)
}
let actions = manifest.actions.map { TuistGenerator.TargetAction.from(manifest: $0, path: path) }
let environment = manifest.environment
return TuistGenerator.Target(name: name,
platform: platform,
product: product,
productName: productName,
bundleId: bundleId,
infoPlist: infoPlist,
entitlements: entitlements,
settings: settings,
sources: sources,
resources: resources,
headers: headers,
coreDataModels: coreDataModels,
actions: actions,
environment: environment,
filesGroup: .group(name: "Project"),
dependencies: dependencies)
}
}
extension TuistGenerator.InfoPlist {
static func from(manifest: ProjectDescription.InfoPlist, path: AbsolutePath) -> TuistGenerator.InfoPlist {
switch manifest {
case let .file(infoplistPath):
return .file(path: path.appending(RelativePath(infoplistPath)))
case let .dictionary(dictionary):
return .dictionary(
dictionary.mapValues { TuistGenerator.InfoPlist.Value.from(manifest: $0) }
)
}
}
}
extension TuistGenerator.InfoPlist.Value {
static func from(manifest: ProjectDescription.InfoPlist.Value) -> TuistGenerator.InfoPlist.Value {
switch manifest {
case let .string(value):
return .string(value)
case let .boolean(value):
return .boolean(value)
case let .integer(value):
return .integer(value)
case let .array(value):
return .array(value.map { TuistGenerator.InfoPlist.Value.from(manifest: $0) })
case let .dictionary(value):
return .dictionary(value.mapValues { TuistGenerator.InfoPlist.Value.from(manifest: $0) })
}
}
}
extension TuistGenerator.Settings {
typealias BuildConfigurationTuple = (TuistGenerator.BuildConfiguration, TuistGenerator.Configuration?)
static func from(manifest: ProjectDescription.Settings, path: AbsolutePath) -> TuistGenerator.Settings {
let base = manifest.base
let configurationTuples = manifest.configurations.map { buildConfigurationTuple(from: $0, path: path) }
let configurations = Dictionary(configurationTuples, uniquingKeysWith: { $1 })
let defaultSettings = TuistGenerator.DefaultSettings.from(manifest: manifest.defaultSettings)
return TuistGenerator.Settings(base: base,
configurations: configurations,
defaultSettings: defaultSettings)
}
private static func buildConfigurationTuple(from customConfiguration: CustomConfiguration,
path: AbsolutePath) -> BuildConfigurationTuple {
let buildConfiguration = TuistGenerator.BuildConfiguration.from(manifest: customConfiguration)
let configuration = customConfiguration.configuration.map { TuistGenerator.Configuration.from(manifest: $0, path: path) }
return (buildConfiguration, configuration)
}
}
extension TuistGenerator.DefaultSettings {
static func from(manifest: ProjectDescription.DefaultSettings) -> TuistGenerator.DefaultSettings {
switch manifest {
case .recommended:
return .recommended
case .essential:
return .essential
}
}
}
extension TuistGenerator.Configuration {
static func from(manifest: ProjectDescription.Configuration, path: AbsolutePath) -> TuistGenerator.Configuration {
let settings = manifest.settings
let xcconfig = manifest.xcconfig.flatMap { path.appending(RelativePath($0)) }
return Configuration(settings: settings, xcconfig: xcconfig)
}
}
extension TuistGenerator.TargetAction {
static func from(manifest: ProjectDescription.TargetAction, path: AbsolutePath) -> TuistGenerator.TargetAction {
let name = manifest.name
let tool = manifest.tool
let order = TuistGenerator.TargetAction.Order.from(manifest: manifest.order)
let path = manifest.path.map { AbsolutePath($0, relativeTo: path) }
let arguments = manifest.arguments
let inputPaths = manifest.inputPaths
let inputFileListPaths = manifest.inputFileListPaths
let outputPaths = manifest.outputPaths
let outputFileListPaths = manifest.outputFileListPaths
return TargetAction(name: name,
order: order,
tool: tool,
path: path,
arguments: arguments,
inputPaths: inputPaths,
inputFileListPaths: inputFileListPaths,
outputPaths: outputPaths,
outputFileListPaths: outputFileListPaths)
}
}
extension TuistGenerator.TargetAction.Order {
static func from(manifest: ProjectDescription.TargetAction.Order) -> TuistGenerator.TargetAction.Order {
switch manifest {
case .pre:
return .pre
case .post:
return .post
}
}
}
extension TuistGenerator.CoreDataModel {
static func from(manifest: ProjectDescription.CoreDataModel,
path: AbsolutePath,
fileHandler: FileHandling) throws -> TuistGenerator.CoreDataModel {
let modelPath = path.appending(RelativePath(manifest.path))
if !fileHandler.exists(modelPath) {
throw GeneratorModelLoaderError.missingFile(modelPath)
}
let versions = fileHandler.glob(modelPath, glob: "*.xcdatamodel")
let currentVersion = manifest.currentVersion
return CoreDataModel(path: modelPath, versions: versions, currentVersion: currentVersion)
}
}
extension TuistGenerator.Headers {
static func from(manifest: ProjectDescription.Headers, path: AbsolutePath, fileHandler: FileHandling) -> TuistGenerator.Headers {
let `public` = manifest.public?.globs.flatMap {
headerFiles(path: path, glob: $0, fileHandler: fileHandler)
} ?? []
let `private` = manifest.private?.globs.flatMap {
headerFiles(path: path, glob: $0, fileHandler: fileHandler)
} ?? []
let project = manifest.project?.globs.flatMap {
headerFiles(path: path, glob: $0, fileHandler: fileHandler)
} ?? []
return Headers(public: `public`, private: `private`, project: project)
}
private static func headerFiles(path: AbsolutePath,
glob: String,
fileHandler: FileHandling) -> [AbsolutePath] {
return fileHandler.glob(path, glob: glob).filter {
if let `extension` = $0.extension, Headers.extensions.contains(".\(`extension`)") {
return true
}
return false
}
}
}
extension TuistGenerator.Dependency {
static func from(manifest: ProjectDescription.TargetDependency) -> TuistGenerator.Dependency {
switch manifest {
case let .target(name):
return .target(name: name)
case let .project(target, projectPath):
return .project(target: target, path: RelativePath(projectPath))
case let .framework(frameworkPath):
return .framework(path: RelativePath(frameworkPath))
case let .library(libraryPath, publicHeaders, swiftModuleMap):
return .library(path: RelativePath(libraryPath),
publicHeaders: RelativePath(publicHeaders),
swiftModuleMap: swiftModuleMap.map { RelativePath($0) })
case let .sdk(name, status):
return .sdk(name: name,
status: .from(manifest: status))
case let .cocoapods(path):
return .cocoapods(path: RelativePath(path))
}
}
}
extension TuistGenerator.Scheme {
static func from(manifest: ProjectDescription.Scheme) -> TuistGenerator.Scheme {
let name = manifest.name
let shared = manifest.shared
let buildAction = manifest.buildAction.map { TuistGenerator.BuildAction.from(manifest: $0) }
let testAction = manifest.testAction.map { TuistGenerator.TestAction.from(manifest: $0) }
let runAction = manifest.runAction.map { TuistGenerator.RunAction.from(manifest: $0) }
return Scheme(name: name,
shared: shared,
buildAction: buildAction,
testAction: testAction,
runAction: runAction)
}
}
extension TuistGenerator.BuildAction {
static func from(manifest: ProjectDescription.BuildAction) -> TuistGenerator.BuildAction {
let preActions = manifest.preActions.map { TuistGenerator.ExecutionAction.from(manifest: $0) }
let postActions = manifest.postActions.map { TuistGenerator.ExecutionAction.from(manifest: $0) }
return BuildAction(targets: manifest.targets, preActions: preActions, postActions: postActions)
}
}
extension TuistGenerator.TestAction {
static func from(manifest: ProjectDescription.TestAction) -> TuistGenerator.TestAction {
let targets = manifest.targets
let arguments = manifest.arguments.map { TuistGenerator.Arguments.from(manifest: $0) }
let configurationName = manifest.configurationName
let coverage = manifest.coverage
let preActions = manifest.preActions.map { TuistGenerator.ExecutionAction.from(manifest: $0) }
let postActions = manifest.postActions.map { TuistGenerator.ExecutionAction.from(manifest: $0) }
return TestAction(targets: targets,
arguments: arguments,
configurationName: configurationName,
coverage: coverage,
preActions: preActions,
postActions: postActions)
}
}
extension TuistGenerator.RunAction {
static func from(manifest: ProjectDescription.RunAction) -> TuistGenerator.RunAction {
let configurationName = manifest.configurationName
let executable = manifest.executable
let arguments = manifest.arguments.map { TuistGenerator.Arguments.from(manifest: $0) }
return RunAction(configurationName: configurationName,
executable: executable,
arguments: arguments)
}
}
extension TuistGenerator.ExecutionAction {
static func from(manifest: ProjectDescription.ExecutionAction) -> TuistGenerator.ExecutionAction {
return ExecutionAction(title: manifest.title, scriptText: manifest.scriptText, target: manifest.target)
}
}
extension TuistGenerator.Arguments {
static func from(manifest: ProjectDescription.Arguments) -> TuistGenerator.Arguments {
return Arguments(environment: manifest.environment,
launch: manifest.launch)
}
}
extension TuistGenerator.BuildConfiguration {
static func from(manifest: ProjectDescription.CustomConfiguration) -> TuistGenerator.BuildConfiguration {
let variant: TuistGenerator.BuildConfiguration.Variant
switch manifest.variant {
case .debug:
variant = .debug
case .release:
variant = .release
}
return TuistGenerator.BuildConfiguration(name: manifest.name, variant: variant)
}
}
extension TuistGenerator.Product {
static func from(manifest: ProjectDescription.Product) -> TuistGenerator.Product {
switch manifest {
case .app:
return .app
case .staticLibrary:
return .staticLibrary
case .dynamicLibrary:
return .dynamicLibrary
case .framework:
return .framework
case .staticFramework:
return .staticFramework
case .unitTests:
return .unitTests
case .uiTests:
return .uiTests
}
}
}
extension TuistGenerator.Platform {
static func from(manifest: ProjectDescription.Platform) throws -> TuistGenerator.Platform {
switch manifest {
case .macOS:
return .macOS
case .iOS:
return .iOS
case .tvOS:
return .tvOS
case .watchOS:
throw GeneratorModelLoaderError.featureNotYetSupported("watchOS platform")
}
}
}
extension TuistGenerator.SDKStatus {
static func from(manifest: ProjectDescription.SDKStatus) -> TuistGenerator.SDKStatus {
switch manifest {
case .required:
return .required
case .optional:
return .optional
}
}
}