Skip to content

Commit 95f7448

Browse files
authored
Merge pull request swiftlang#23 from nkcsgexi/use-custom-swiftc-build
build-script: always use the just-built swift compiler to build SwiftSyntax.
2 parents 0d07bc7 + a92e9fb commit 95f7448

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

build-script.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ def call(cmd, env=os.environ, stdout=None, stderr=subprocess.STDOUT,
4444
return process.returncode
4545

4646

47-
def check_call(cmd, verbose=False):
47+
def check_call(cmd, env=os.environ, verbose=False):
4848
if verbose:
4949
print(' '.join([escapeCmdArg(arg) for arg in cmd]))
50-
return subprocess.check_call(cmd, stderr=subprocess.STDOUT)
50+
return subprocess.check_call(cmd, env=env, stderr=subprocess.STDOUT)
5151

5252

5353
def realpath(path):
@@ -146,7 +146,7 @@ def get_swiftpm_invocation(spm_exec, build_dir, release):
146146
return swiftpm_call
147147

148148

149-
def build_swiftsyntax(swift_build_exec, build_dir, build_test_util, release,
149+
def build_swiftsyntax(swift_build_exec, swiftc_exec, build_dir, build_test_util, release,
150150
verbose):
151151
print('** Building SwiftSyntax **')
152152

@@ -161,8 +161,9 @@ def build_swiftsyntax(swift_build_exec, build_dir, build_test_util, release,
161161

162162
if verbose:
163163
swiftpm_call.extend(['--verbose'])
164-
165-
check_call(swiftpm_call, verbose=verbose)
164+
_environ = dict(os.environ)
165+
_environ['SWIFT_EXEC'] = swiftc_exec
166+
check_call(swiftpm_call, env=_environ, verbose=verbose)
166167

167168

168169
## Testing
@@ -365,6 +366,7 @@ def main():
365366

366367
try:
367368
build_swiftsyntax(swift_build_exec=args.swift_build_exec,
369+
swiftc_exec=args.swiftc_exec,
368370
build_dir=args.build_dir,
369371
build_test_util=args.test,
370372
release=args.release,

0 commit comments

Comments
 (0)