@@ -15,7 +15,7 @@ import PackageModel
15
15
import SPMBuildCore
16
16
import Build
17
17
18
- public struct BuildFlagsGroup : ParsableArguments {
18
+ struct BuildFlagsGroup : ParsableArguments {
19
19
@Option ( name: . customLong( " Xcc " , withSingleDash: true ) ,
20
20
help: " Pass flag through to all C compiler invocations " )
21
21
var cCompilerFlags : [ String ]
@@ -44,7 +44,7 @@ public struct BuildFlagsGroup: ParsableArguments {
44
44
xlinker: linkerFlags)
45
45
}
46
46
47
- public init ( ) { }
47
+ init ( ) { }
48
48
}
49
49
50
50
extension BuildConfiguration : ExpressibleByArgument {
@@ -53,154 +53,158 @@ extension BuildConfiguration: ExpressibleByArgument {
53
53
}
54
54
}
55
55
56
- public enum BuildSystemKind : String , ExpressibleByArgument {
56
+ enum BuildSystemKind : String , ExpressibleByArgument {
57
57
case native
58
58
case xcode
59
59
}
60
60
61
61
public struct SwiftToolOptions : ParsableArguments {
62
62
@OptionGroup ( )
63
- public var buildFlagsGroup : BuildFlagsGroup
63
+ var buildFlagsGroup : BuildFlagsGroup
64
64
65
65
/// Custom arguments to pass to C compiler, swift compiler and the linker.
66
- public var buildFlags : BuildFlags {
66
+ var buildFlags : BuildFlags {
67
67
buildFlagsGroup. buildFlags
68
68
}
69
69
70
+ var xcbuildFlags : [ String ] {
71
+ buildFlagsGroup. xcbuildFlags
72
+ }
73
+
70
74
/// Build configuration.
71
75
@Option ( name: . shortAndLong, default: . debug, help: " Build with configuration " )
72
- public var configuration : BuildConfiguration
76
+ var configuration : BuildConfiguration
73
77
74
78
/// The custom build directory, if provided.
75
79
@Option ( help: " Specify build/cache directory " ,
76
80
transform: { try PathArgument ( argument: $0) . path } )
77
- public var buildPath : AbsolutePath ?
81
+ var buildPath : AbsolutePath ?
78
82
79
83
/// The custom working directory that the tool should operate in (deprecated).
80
84
@Option ( name: [ . long, . customShort( " C " ) ] ,
81
85
transform: { try PathArgument ( argument: $0) . path } )
82
- public var chdir : AbsolutePath ?
86
+ var chdir : AbsolutePath ?
83
87
84
88
/// The custom working directory that the tool should operate in.
85
89
@Option ( help: " Change working directory before any other operation " ,
86
90
transform: { try PathArgument ( argument: $0) . path } )
87
- public var packagePath : AbsolutePath ?
91
+ var packagePath : AbsolutePath ?
88
92
89
93
/// The path to the file containing multiroot package data. This is currently Xcode's workspace file.
90
94
@Option ( name: . customLong( " multiroot-data-file " ) ,
91
95
transform: { try PathArgument ( argument: $0) . path } )
92
- public var multirootPackageDataFile : AbsolutePath ?
96
+ var multirootPackageDataFile : AbsolutePath ?
93
97
94
98
/// Enable prefetching in resolver which will kick off parallel git cloning.
95
99
@Flag ( name: . customLong( " prefetching " ) , default: true , inversion: . prefixedEnableDisable)
96
- public var shouldEnableResolverPrefetching : Bool
100
+ var shouldEnableResolverPrefetching : Bool
97
101
98
102
/// If print version option was passed.
99
103
@Flag ( name: . customLong( " version " ) )
100
- public var shouldPrintVersion : Bool
104
+ var shouldPrintVersion : Bool
101
105
102
106
// FIXME: We need to allow -vv type options for this.
103
107
/// The verbosity of informational output.
104
108
@Flag ( name: . shortAndLong, help: " Increase verbosity of informational output " )
105
- public var verbose : Bool
109
+ var verbose : Bool
106
110
107
- public var verbosity : Int { verbose ? 1 : 0 }
111
+ var verbosity : Int { verbose ? 1 : 0 }
108
112
109
113
/// Disables sandboxing when executing subprocesses.
110
114
@Flag ( name: . customLong( " disable-sandbox " ) , help: " Disable using the sandbox when executing subprocesses " )
111
- public var shouldDisableSandbox : Bool
115
+ var shouldDisableSandbox : Bool
112
116
113
117
/// Disables manifest caching.
114
118
@Flag ( name: . customLong( " disable-package-manifest-caching " ) , help: " Disable caching Package.swift manifests " )
115
- public var shouldDisableManifestCaching : Bool
119
+ var shouldDisableManifestCaching : Bool
116
120
117
121
/// Path to the compilation destination describing JSON file.
118
122
@Option ( name: . customLong( " destination " ) , transform: { try PathArgument ( argument: $0) . path } )
119
- public var customCompileDestination : AbsolutePath ?
123
+ var customCompileDestination : AbsolutePath ?
120
124
121
125
/// The compilation destination’s target triple.
122
126
@Option ( name: . customLong( " triple " ) , transform: Triple . init)
123
- public var customCompileTriple : Triple ?
127
+ var customCompileTriple : Triple ?
124
128
125
129
/// Path to the compilation destination’s SDK.
126
130
@Option ( name: . customLong( " sdk " ) , transform: { try PathArgument ( argument: $0) . path } )
127
- public var customCompileSDK : AbsolutePath ?
131
+ var customCompileSDK : AbsolutePath ?
128
132
129
133
/// Path to the compilation destination’s toolchain.
130
134
@Option ( name: . customLong( " toolchain " ) , transform: { try PathArgument ( argument: $0) . path } )
131
- public var customCompileToolchain : AbsolutePath ?
135
+ var customCompileToolchain : AbsolutePath ?
132
136
133
137
/// If should link the Swift stdlib statically.
134
138
@Flag ( name: . customLong( " static-swift-stdlib " ) , default: false , inversion: . prefixedNo, help: " Link Swift stdlib statically " )
135
- public var shouldLinkStaticSwiftStdlib : Bool
139
+ var shouldLinkStaticSwiftStdlib : Bool
136
140
137
141
/// Skip updating dependencies from their remote during a resolution.
138
142
@Flag ( name: . customLong( " skip-update " ) , help: " Skip updating dependencies from their remote during a resolution " )
139
- public var skipDependencyUpdate : Bool
143
+ var skipDependencyUpdate : Bool
140
144
141
145
/// Which compile-time sanitizers should be enabled.
142
146
@Option ( name: . customLong( " sanitize " ) ,
143
147
help: " Turn on runtime checks for erroneous behavior " ,
144
148
transform: { try Sanitizer ( argument: $0) } )
145
- public var sanitizers : [ Sanitizer ]
149
+ var sanitizers : [ Sanitizer ]
146
150
147
- public var enabledSanitizers : EnabledSanitizers {
151
+ var enabledSanitizers : EnabledSanitizers {
148
152
EnabledSanitizers ( Set ( sanitizers) )
149
153
}
150
154
151
155
/// Whether to enable code coverage.
152
156
@Flag ( name: . customLong( " enable-code-coverage " ) , help: " Test with code coverage enabled " )
153
- public var shouldEnableCodeCoverage : Bool
157
+ var shouldEnableCodeCoverage : Bool
154
158
155
159
// TODO: Does disable-automatic-resolution alias force-resolved-versions?
156
160
157
161
/// Use Package.resolved file for resolving dependencies.
158
162
@Flag ( name: [ . long, . customLong( " disable-automatic-resolution " ) ] , help: " Disable automatic resolution if Package.resolved file is out-of-date " )
159
- public var forceResolvedVersions : Bool
163
+ var forceResolvedVersions : Bool
160
164
161
165
@Flag ( name: . customLong( " index-store " ) , inversion: . prefixedEnableDisable, help: " Enable or disable indexing-while-building feature " )
162
- public var indexStoreEnable : Bool ?
166
+ var indexStoreEnable : Bool ?
163
167
164
168
/// The mode to use for indexing-while-building feature.
165
- public var indexStore : BuildParameters . IndexStoreMode {
169
+ var indexStore : BuildParameters . IndexStoreMode {
166
170
guard let enable = indexStoreEnable else { return . auto }
167
171
return enable ? . on : . off
168
172
}
169
173
170
174
/// Whether to enable generation of `.swiftinterface`s alongside `.swiftmodule`s.
171
175
@Flag ( name: . customLong( " enable-parseable-module-interfaces " ) )
172
- public var shouldEnableParseableModuleInterfaces : Bool
176
+ var shouldEnableParseableModuleInterfaces : Bool
173
177
174
178
/// Write dependency resolver trace to a file.
175
179
@Flag ( name: . customLong( " trace-resolver " ) )
176
- public var enableResolverTrace : Bool
180
+ var enableResolverTrace : Bool
177
181
178
182
/// The number of jobs for llbuild to start (aka the number of schedulerLanes)
179
183
@Option ( name: . shortAndLong, help: " The number of jobs to spawn in parallel during the build process " )
180
- public var jobs : UInt32 ?
184
+ var jobs : UInt32 ?
181
185
182
186
/// Whether to enable test discovery on platforms without Objective-C runtime.
183
187
@Flag ( help: " Enable test discovery on platforms without Objective-C runtime " )
184
- public var enableTestDiscovery : Bool
188
+ var enableTestDiscovery : Bool
185
189
186
190
/// Whether to enable llbuild manifest caching.
187
191
@Flag ( )
188
- public var enableBuildManifestCaching : Bool
192
+ var enableBuildManifestCaching : Bool
189
193
190
194
/// Emit the Swift module separately from the object files.
191
195
@Flag ( )
192
- public var emitSwiftModuleSeparately : Bool
196
+ var emitSwiftModuleSeparately : Bool
193
197
194
198
/// The build system to use.
195
- @Option ( )
196
- public var buildSystem : BuildSystemKind = . native
199
+ @Option ( default : . native )
200
+ var buildSystem : BuildSystemKind
197
201
198
202
public mutating func validate( ) throws {
199
203
if shouldPrintVersion {
200
204
print ( Versioning . currentVersion. completeDisplayString)
201
205
throw ExitCode . success
202
206
}
203
207
}
204
-
208
+
205
209
public init ( ) { }
206
210
}
0 commit comments