Skip to content

Commit

Permalink
Merge pull request swiftlang#23 from nkcsgexi/use-custom-swiftc-build
Browse files Browse the repository at this point in the history
build-script: always use the just-built swift compiler to build SwiftSyntax.
  • Loading branch information
nkcsgexi authored Nov 2, 2018
2 parents 0d07bc7 + a92e9fb commit 95f7448
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions build-script.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ def call(cmd, env=os.environ, stdout=None, stderr=subprocess.STDOUT,
return process.returncode


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


def realpath(path):
Expand Down Expand Up @@ -146,7 +146,7 @@ def get_swiftpm_invocation(spm_exec, build_dir, release):
return swiftpm_call


def build_swiftsyntax(swift_build_exec, build_dir, build_test_util, release,
def build_swiftsyntax(swift_build_exec, swiftc_exec, build_dir, build_test_util, release,
verbose):
print('** Building SwiftSyntax **')

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

if verbose:
swiftpm_call.extend(['--verbose'])

check_call(swiftpm_call, verbose=verbose)
_environ = dict(os.environ)
_environ['SWIFT_EXEC'] = swiftc_exec
check_call(swiftpm_call, env=_environ, verbose=verbose)


## Testing
Expand Down Expand Up @@ -365,6 +366,7 @@ def main():

try:
build_swiftsyntax(swift_build_exec=args.swift_build_exec,
swiftc_exec=args.swiftc_exec,
build_dir=args.build_dir,
build_test_util=args.test,
release=args.release,
Expand Down

0 comments on commit 95f7448

Please sign in to comment.