@@ -27,7 +27,6 @@ from build_swift.build_swift import presets
27
27
import six
28
28
29
29
from swift_build_support .swift_build_support import (
30
- debug ,
31
30
diagnostics ,
32
31
products ,
33
32
shell ,
@@ -71,6 +70,25 @@ class JSONDumper(json.JSONEncoder):
71
70
return six .text_type (o )
72
71
73
72
73
+ def print_xcodebuild_versions (file = sys .stdout ):
74
+ """
75
+ Print the host machine's `xcodebuild` version, as well as version
76
+ information for all available SDKs.
77
+ """
78
+ version = shell .capture (
79
+ ['xcodebuild' , '-version' ], dry_run = False , echo = False ).rstrip ()
80
+ # Allow non-zero exit codes. Under certain obscure circumstances
81
+ # xcodebuild can exit with a non-zero exit code even when the SDK is
82
+ # usable.
83
+ sdks = shell .capture (
84
+ ['xcodebuild' , '-version' , '-sdk' ], dry_run = False , echo = False ,
85
+ allow_non_zero_exit = True ).rstrip ()
86
+ fmt = '{version}\n \n --- SDK versions ---\n {sdks}\n '
87
+
88
+ print (fmt .format (version = version , sdks = sdks ), file = file )
89
+ file .flush ()
90
+
91
+
74
92
class BuildScriptInvocation (object ):
75
93
76
94
"""Represent a single build script invocation."""
@@ -1149,7 +1167,7 @@ def main_normal():
1149
1167
1150
1168
# Show SDKs, if requested.
1151
1169
if args .show_sdks :
1152
- debug . print_xcodebuild_versions ()
1170
+ print_xcodebuild_versions ()
1153
1171
1154
1172
if args .dump_config :
1155
1173
print (JSONDumper ().encode (invocation ))
0 commit comments