|
10 | 10 | #
|
11 | 11 | # ----------------------------------------------------------------------------
|
12 | 12 |
|
| 13 | +import os |
| 14 | + |
13 | 15 | from . import cmark
|
14 | 16 | from . import foundation
|
15 |
| -from . import indexstoredb |
16 | 17 | from . import libcxx
|
17 | 18 | from . import libdispatch
|
18 | 19 | from . import libicu
|
19 | 20 | from . import llbuild
|
20 | 21 | from . import llvm
|
21 | 22 | from . import product
|
22 | 23 | from . import swift
|
| 24 | +from . import swiftpm |
23 | 25 | from . import xctest
|
| 26 | +from .. import shell |
| 27 | +from .. import targets |
24 | 28 |
|
25 | 29 |
|
26 | 30 | class SwiftDriver(product.Product):
|
@@ -51,24 +55,48 @@ def should_clean(self, host_target):
|
51 | 55 | return self.args.clean_swift_driver
|
52 | 56 |
|
53 | 57 | def clean(self, host_target):
|
54 |
| - indexstoredb.run_build_script_helper( |
55 |
| - 'clean', host_target, self, self.args) |
| 58 | + run_build_script_helper('clean', host_target, self, self.args) |
56 | 59 |
|
57 | 60 | def build(self, host_target):
|
58 |
| - indexstoredb.run_build_script_helper( |
59 |
| - 'build', host_target, self, self.args) |
| 61 | + run_build_script_helper('build', host_target, self, self.args) |
60 | 62 |
|
61 | 63 | def should_test(self, host_target):
|
62 | 64 | return self.args.test_swift_driver
|
63 | 65 |
|
64 | 66 | def test(self, host_target):
|
65 |
| - indexstoredb.run_build_script_helper( |
66 |
| - 'test', host_target, self, self.args, |
67 |
| - self.args.test_sourcekitlsp_sanitize_all) |
| 67 | + run_build_script_helper('test', host_target, self, self.args) |
68 | 68 |
|
69 | 69 | def should_install(self, host_target):
|
70 | 70 | return self.args.install_swift_driver
|
71 | 71 |
|
72 | 72 | def install(self, host_target):
|
73 |
| - indexstoredb.run_build_script_helper( |
74 |
| - 'install', host_target, self, self.args) |
| 73 | + run_build_script_helper('install', host_target, self, self.args) |
| 74 | + |
| 75 | + |
| 76 | +def run_build_script_helper(action, host_target, product, args): |
| 77 | + script_path = os.path.join( |
| 78 | + product.source_dir, 'Utilities', 'build-script-helper.py') |
| 79 | + |
| 80 | + install_destdir = args.install_destdir |
| 81 | + if swiftpm.SwiftPM.has_cross_compile_hosts(args): |
| 82 | + install_destdir = swiftpm.SwiftPM.get_install_destdir(args, |
| 83 | + host_target, |
| 84 | + product.build_dir) |
| 85 | + toolchain_path = targets.toolchain_path(install_destdir, |
| 86 | + args.install_prefix) |
| 87 | + is_release = product.is_release() |
| 88 | + configuration = 'release' if is_release else 'debug' |
| 89 | + helper_cmd = [ |
| 90 | + script_path, |
| 91 | + action, |
| 92 | + '--package-path', product.source_dir, |
| 93 | + '--build-path', product.build_dir, |
| 94 | + '--configuration', configuration, |
| 95 | + '--toolchain', toolchain_path, |
| 96 | + '--ninja-bin', product.toolchain.ninja, |
| 97 | + '--cmake-bin', product.toolchain.cmake, |
| 98 | + ] |
| 99 | + if args.verbose_build: |
| 100 | + helper_cmd.append('--verbose') |
| 101 | + |
| 102 | + shell.call(helper_cmd) |
0 commit comments