@@ -87,7 +87,7 @@ def check_gyb_exec():
87
87
88
88
89
89
def check_rsync ():
90
- with open (os .devnull , 'w' ) as DEVNULL :
90
+ with open (os .devnull , 'w' ) as DEVNULL :
91
91
if call (['rsync' , '--version' ], stdout = DEVNULL ) != 0 :
92
92
fatal_error ('Error: Could not find rsync.' )
93
93
@@ -155,11 +155,8 @@ def generate_gyb_files(verbose, add_source_locations, destination=None):
155
155
156
156
## Building swiftSyntax
157
157
158
- def get_installed_name ():
159
- return 'SwiftSyntax'
160
-
161
158
def get_installed_dylib_name ():
162
- return 'lib' + get_installed_name () + ' .dylib'
159
+ return 'libSwiftSyntax .dylib'
163
160
164
161
def get_swiftpm_invocation (toolchain , action , build_dir , release ):
165
162
swift_exec = os .path .join (toolchain , 'usr' , 'bin' , 'swift' )
@@ -171,11 +168,6 @@ def get_swiftpm_invocation(toolchain, action, build_dir, release):
171
168
if build_dir :
172
169
swiftpm_call .extend (['--build-path' , build_dir ])
173
170
174
- # Swift compiler needs to know the module link name.
175
- swiftpm_call .extend (['-Xswiftc' , '-module-link-name' , '-Xswiftc' , get_installed_name ()])
176
-
177
- # To speed up compilation.
178
- swiftpm_call .extend (['-Xswiftc' , '-enforce-exclusivity=unchecked' ])
179
171
return swiftpm_call
180
172
181
173
class Builder (object ):
@@ -190,20 +182,15 @@ def __init__(self, toolchain, build_dir, release, verbose,
190
182
if verbose :
191
183
self .swiftpm_call .extend (['--verbose' ])
192
184
self .verbose = verbose
193
- self ._environ = dict (os .environ )
194
- self ._environ ['SWIFT_SYNTAX_BUILD_SCRIPT' ] = ''
195
185
196
186
def build (self , product_name , module_group_path = '' ):
197
187
print ('** Building ' + product_name + ' **' )
198
188
command = list (self .swiftpm_call )
199
189
command .extend (['--product' , product_name ])
200
190
201
- # To build the group information into the module documentation file
202
- if module_group_path :
203
- command .extend (['-Xswiftc' , '-Xfrontend' , '-Xswiftc' , '-group-info-path' ])
204
- command .extend (['-Xswiftc' , '-Xfrontend' , '-Xswiftc' , module_group_path ])
205
-
206
- check_call (command , env = self ._environ , verbose = self .verbose )
191
+ env = dict (os .environ )
192
+ env ['SWIFT_SYNTAX_BUILD_DYLIB' ] = '1'
193
+ check_call (command , env = env , verbose = self .verbose )
207
194
208
195
209
196
## Testing
@@ -313,9 +300,15 @@ def run_lit_tests(toolchain, build_dir, release, filecheck_exec, verbose):
313
300
314
301
def run_xctests (toolchain , build_dir , release , verbose ):
315
302
print ('** Running XCTests **' )
303
+
304
+ # Testing builds with testability enabled. Don't overwrite the
305
+ # build that we have just created and which shall be reused by
306
+ # dependent projects. Instead, build in a new directory.
307
+ test_build_dir = os .path .join (realpath (build_dir ), 'test-build' )
308
+
316
309
swiftpm_call = get_swiftpm_invocation (toolchain = toolchain ,
317
310
action = 'test' ,
318
- build_dir = build_dir ,
311
+ build_dir = test_build_dir ,
319
312
release = release )
320
313
321
314
if verbose :
@@ -390,7 +383,7 @@ def main():
390
383
391
384
basic_group = parser .add_argument_group ('Basic' )
392
385
393
- basic_group .add_argument ('--build-dir' , default = None , help = '''
386
+ basic_group .add_argument ('--build-dir' , default = '.build' , help = '''
394
387
The directory in which build products shall be put. If omitted a
395
388
directory named '.build' will be put in the swift-syntax directory.
396
389
''' )
@@ -508,8 +501,6 @@ def main():
508
501
release = args .release ,
509
502
verbose = args .verbose ,
510
503
disable_sandbox = args .disable_sandbox )
511
- # TODO: Building with group info does not allow us to reuse the build
512
- # for running the tests.
513
504
builder .build ('SwiftSyntax' , module_group_path = GROUP_INFO_PATH )
514
505
515
506
# Only build lit-test-helper if we are planning to run tests
@@ -524,7 +515,7 @@ def main():
524
515
if args .test :
525
516
try :
526
517
success = run_tests (toolchain = args .toolchain ,
527
- build_dir = realpath ( args .build_dir ) ,
518
+ build_dir = args .build_dir ,
528
519
release = args .release ,
529
520
filecheck_exec = realpath (args .filecheck_exec ),
530
521
verbose = args .verbose )
0 commit comments