-
-
Notifications
You must be signed in to change notification settings - Fork 509
/
Target.swift
119 lines (101 loc) · 3.57 KB
/
Target.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
import Foundation
// MARK: - Target
public class Target: Codable {
/// Target name.
public let name: String
/// Product platform.
public let platform: Platform
/// Product type.
public let product: Product
/// Bundle identifier.
public let bundleId: String
/// The name of the product output by this target.
/// passing nil in the initialiser will default
/// this value to the name of the target.
public let productName: String
/// Relative path to the Info.plist file.
public let infoPlist: InfoPlist
/// Relative path to the entitlements file.
public let entitlements: String?
/// Target settings.
public let settings: Settings?
/// Target dependencies.
public let dependencies: [TargetDependency]
/// Relative paths to the sources directory.
public let sources: FileList?
/// Relative paths to the resources directory.
public let resources: [FileElement]?
/// Headers.
public let headers: Headers?
/// Target actions.
public let actions: [TargetAction]
/// CoreData models.
public let coreDataModels: [CoreDataModel]
/// Environment variables to be exposed to the target.
public let environment: [String: String]
public enum CodingKeys: String, CodingKey {
case name
case platform
case product
case productName = "product_name"
case bundleId = "bundle_id"
case infoPlist = "info_plist"
case entitlements
case settings
case dependencies
case sources
case resources
case headers
case coreDataModels = "core_data_models"
case actions
case environment
}
/// Initializes the target.
///
/// - Parameters:
/// - name: target name.
/// - platform: product platform.
/// - product: product type.
/// - bundleId: bundle identifier.
/// - infoPlist: relative path to the Info.plist file.
/// - sources: relative paths to the sources directory.
/// - resources: relative paths to the resources directory.
/// - headers: headers.
/// - entitlements: relative path to the entitlements file.
/// - actions: target actions.
/// - dependencies: target dependencies.
/// - settings: target settings.
/// - coreDataModels: CoreData models.
/// - environment: Environment variables to be exposed to the target.
public init(name: String,
platform: Platform,
product: Product,
productName: String? = nil,
bundleId: String,
infoPlist: InfoPlist,
sources: FileList? = nil,
resources: [FileElement]? = nil,
headers: Headers? = nil,
entitlements: String? = nil,
actions: [TargetAction] = [],
dependencies: [TargetDependency] = [],
settings: Settings? = nil,
coreDataModels: [CoreDataModel] = [],
environment: [String: String] = [:]) {
self.name = name
self.platform = platform
self.bundleId = bundleId
self.productName = productName ?? name
self.product = product
self.infoPlist = infoPlist
self.entitlements = entitlements
self.dependencies = dependencies
self.settings = settings
self.sources = sources
self.resources = resources
self.headers = headers
self.actions = actions
self.coreDataModels = coreDataModels
self.environment = environment
}
}