@@ -73,6 +73,9 @@ def get_swiftpm_options(swift_exec: str, args: argparse.Namespace) -> List[str]:
73
73
'--configuration' , args .configuration ,
74
74
]
75
75
76
+ if args .multiroot_data_file :
77
+ swiftpm_args += ['--multiroot-data-file' , args .multiroot_data_file ]
78
+
76
79
if args .verbose :
77
80
swiftpm_args += ['--verbose' ]
78
81
@@ -157,13 +160,13 @@ def get_swiftpm_environment_variables(swift_exec: str, args: argparse.Namespace)
157
160
return env
158
161
159
162
160
- def build ( swift_exec : str , args : argparse .Namespace ) -> None :
163
+ def build_single_product ( product : str , swift_exec : str , args : argparse .Namespace ) -> None :
161
164
"""
162
165
Build one product in the package
163
166
"""
164
167
swiftpm_args = get_swiftpm_options (swift_exec , args )
165
168
env = get_swiftpm_environment_variables (swift_exec , args )
166
- cmd = [swift_exec , 'build' ] + swiftpm_args
169
+ cmd = [swift_exec , 'build' , '--product' , product ] + swiftpm_args
167
170
check_call (cmd , env = env , verbose = args .verbose )
168
171
169
172
@@ -215,7 +218,11 @@ def handle_invocation(swift_exec: str, args: argparse.Namespace) -> None:
215
218
Depending on the action in 'args', build the package, installs the package or run tests.
216
219
"""
217
220
if args .action == 'build' :
218
- build (swift_exec , args )
221
+ # These products are listed in dependency order. Lower-level targets are listed first.
222
+ products = ["LSPBindings" , "_SourceKitLSP" , "sourcekit-lsp" ]
223
+ # Build in reverse dependency order so we can build lower-level targets in parallel.
224
+ for product in reversed (products ):
225
+ build_single_product (product , swift_exec , args )
219
226
elif args .action == 'test' :
220
227
run_tests (swift_exec , args )
221
228
elif args .action == 'install' :
@@ -243,6 +250,7 @@ def add_common_args(parser: argparse.ArgumentParser) -> None:
243
250
parser .add_argument ('--verbose' , '-v' , action = 'store_true' , help = 'enable verbose output' )
244
251
parser .add_argument ('--cross-compile-host' , help = 'cross-compile for another host instead' )
245
252
parser .add_argument ('--cross-compile-config' , help = 'an SPM JSON destination file containing Swift cross-compilation flags' )
253
+ parser .add_argument ('--multiroot-data-file' , help = 'path to an Xcode workspace to create a unified build of all of Swift\' s SwiftPM projects' )
246
254
247
255
if sys .version_info >= (3 , 7 , 0 ):
248
256
subparsers = parser .add_subparsers (title = 'subcommands' , dest = 'action' , required = True , metavar = 'action' )
0 commit comments