@@ -26,7 +26,8 @@ def get_swiftpm_options(args):
26
26
if platform .system () != 'Darwin' :
27
27
swiftpm_args += [
28
28
# Dispatch headers
29
- '-Xcxx' , '-I' , '-Xcxx' , os .path .join (args .toolchain , 'usr' , 'lib' , 'swift' ),
29
+ '-Xcxx' , '-I' , '-Xcxx' ,
30
+ os .path .join (args .toolchain , 'usr' , 'lib' , 'swift' ),
30
31
]
31
32
32
33
return swiftpm_args
@@ -36,6 +37,7 @@ def main():
36
37
def add_common_args (parser ):
37
38
parser .add_argument ('--package-path' , metavar = 'PATH' , help = 'directory of the package to build' , default = '.' )
38
39
parser .add_argument ('--toolchain' , required = True , metavar = 'PATH' , help = 'build using the toolchain at PATH' )
40
+ parser .add_argument ('--ninja-bin' , metavar = 'PATH' , help = 'ninja binary to use for testing' )
39
41
parser .add_argument ('--build-path' , metavar = 'PATH' , default = '.build' , help = 'build in the given path' )
40
42
parser .add_argument ('--configuration' , '-c' , default = 'debug' , help = 'build using configuration (release|debug)' )
41
43
parser .add_argument ('--verbose' , '-v' , action = 'store_true' , help = 'enable verbose output' )
@@ -61,12 +63,19 @@ def add_common_args(parser):
61
63
62
64
swiftpm_args = get_swiftpm_options (args )
63
65
66
+ env = os .environ
67
+ # Set the toolchain used in tests at runtime
68
+ env ['INDEXSTOREDB_TOOLCHAIN_PATH' ] = args .toolchain
69
+
70
+ if args .ninja_bin :
71
+ env ['NINJA_BIN' ] = args .ninja_bin
72
+
64
73
if args .action == 'build' :
65
- swiftpm ('build' , swift_exec , swiftpm_args )
74
+ swiftpm ('build' , swift_exec , swiftpm_args , env )
66
75
elif args .action == 'test' :
67
- swiftpm ('test' , swift_exec , swiftpm_args )
76
+ swiftpm ('test' , swift_exec , swiftpm_args , env )
68
77
else :
69
78
assert False , 'unknown action \' {}\' ' .format (args .action )
70
79
71
80
if __name__ == '__main__' :
72
- main ()
81
+ main ()
0 commit comments