@@ -200,21 +200,14 @@ def _normalized_linux_cpu(cpu):
200
200
return "x86_64"
201
201
return cpu
202
202
203
- def _create_linux_toolchain (* , repository_ctx , warn_on_no_swiftc ):
203
+ def _create_linux_toolchain (* , repository_ctx ):
204
204
"""Creates BUILD targets for the Swift toolchain on Linux.
205
205
206
206
Args:
207
207
repository_ctx: The repository rule context.
208
- warn_on_no_swiftc: If True, print a warning if 'swiftc' is not found in
209
- $PATH.
210
208
"""
211
209
path_to_swiftc = repository_ctx .which ("swiftc" )
212
210
if not path_to_swiftc :
213
- if warn_on_no_swiftc :
214
- print ("""\
215
- No 'swiftc' executable found in $PATH. Not auto-generating a Linux Swift \
216
- toolchain.
217
- """ ) # buildifier: disable=print
218
211
return """\
219
212
# No 'swiftc' executable found in $PATH. Not auto-generating a Linux Swift \
220
213
toolchain.
@@ -314,21 +307,14 @@ def _get_python_bin(repository_ctx):
314
307
return out
315
308
return None
316
309
317
- def _create_windows_toolchain (* , repository_ctx , warn_on_no_swiftc ):
310
+ def _create_windows_toolchain (* , repository_ctx ):
318
311
"""Creates BUILD targets for the Swift toolchain on Linux.
319
312
320
313
Args:
321
314
repository_ctx: The repository rule context.
322
- warn_on_no_swiftc: If True, print a warning if 'swiftc.exe' is not found
323
- in $PATH.
324
315
"""
325
316
path_to_swiftc = repository_ctx .which ("swiftc.exe" )
326
317
if not path_to_swiftc :
327
- if warn_on_no_swiftc :
328
- print ("""\
329
- No 'swiftc.exe' executable found in $PATH. Not auto-generating a Windows Swift \
330
- toolchain.
331
- """ ) # buildifier: disable=print
332
318
return """\
333
319
# No 'swiftc.exe' executable found in $PATH. Not auto-generating a Windows \
334
320
Swift toolchain.
@@ -394,16 +380,6 @@ toolchain(
394
380
)
395
381
396
382
def _swift_autoconfiguration_impl (repository_ctx ):
397
- os_name = repository_ctx .os .name .lower ()
398
- is_linux = False
399
- is_windows = False
400
- if os_name .startswith ("mac os" ):
401
- pass
402
- elif os_name .startswith ("windows" ):
403
- is_windows = True
404
- else :
405
- is_linux = True
406
-
407
383
repository_ctx .file (
408
384
"BUILD" ,
409
385
"\n " .join ([
@@ -424,14 +400,8 @@ load(
424
400
package(default_visibility = ["//visibility:public"])
425
401
""" ,
426
402
_create_xcode_toolchain (),
427
- _create_windows_toolchain (
428
- repository_ctx = repository_ctx ,
429
- warn_on_no_swiftc = is_windows ,
430
- ),
431
- _create_linux_toolchain (
432
- repository_ctx = repository_ctx ,
433
- warn_on_no_swiftc = is_linux ,
434
- ),
403
+ _create_windows_toolchain (repository_ctx = repository_ctx ),
404
+ _create_linux_toolchain (repository_ctx = repository_ctx ),
435
405
]),
436
406
)
437
407
0 commit comments