@@ -24,41 +24,31 @@ def run(command):
24
24
subprocess .check_call (command , shell = True )
25
25
26
26
def main ():
27
- parser = argparse .ArgumentParser (formatter_class = argparse . RawDescriptionHelpFormatter ,
28
- description = """ Builds XCTest using a swift compiler."" " )
27
+ parser = argparse .ArgumentParser (
28
+ description = "Builds XCTest using a Swift compiler." )
29
29
parser .add_argument ("--swiftc" ,
30
30
help = "path to the swift compiler" ,
31
31
metavar = "PATH" ,
32
- action = "store" ,
33
- dest = "swiftc" ,
34
- required = True ,
35
- default = None )
32
+ required = True )
36
33
parser .add_argument ("--build-dir" ,
37
34
help = "path to the output build directory" ,
38
35
metavar = "PATH" ,
39
- action = "store" ,
40
- dest = "build_dir" ,
41
- required = True ,
42
- default = None )
36
+ required = True )
43
37
parser .add_argument ("--swift-build-dir" ,
44
38
help = "path to the swift build directory" ,
45
39
metavar = "PATH" ,
46
- action = "store" ,
47
- dest = "swift_build_dir " ,
48
- required = True ,
49
- default = None )
40
+ required = True )
41
+ parser . add_argument ( "--arch " ,
42
+ help = "target architecture" ,
43
+ required = True )
50
44
parser .add_argument ("--module-install-path" ,
51
45
help = "location to install module files" ,
52
46
metavar = "PATH" ,
53
- action = "store" ,
54
- dest = "module_path" ,
55
- default = None )
47
+ dest = "module_path" )
56
48
parser .add_argument ("--library-install-path" ,
57
49
help = "location to install shared library files" ,
58
50
metavar = "PATH" ,
59
- action = "store" ,
60
- dest = "lib_path" ,
61
- default = None )
51
+ dest = "lib_path" )
62
52
parser .add_argument ("--release" ,
63
53
help = "builds for release" ,
64
54
action = "store_const" ,
@@ -78,20 +68,12 @@ def main():
78
68
"at {} in order to run this command. " .format (
79
69
os .path .join (
80
70
os .path .dirname (SOURCE_DIR ), 'llvm' )),
81
- action = "store_true" ,
82
- dest = "test" ,
83
- default = False )
84
- parser .add_argument ("--arch" ,
85
- help = "target architecture" ,
86
- action = "store" ,
87
- dest = "arch" ,
88
- default = None )
71
+ action = "store_true" )
89
72
args = parser .parse_args ()
90
73
91
74
swiftc = os .path .abspath (args .swiftc )
92
75
build_dir = os .path .abspath (args .build_dir )
93
76
swift_build_dir = os .path .abspath (args .swift_build_dir )
94
- arch = args .arch
95
77
96
78
if not os .path .exists (build_dir ):
97
79
run ("mkdir -p {}" .format (build_dir ))
@@ -118,7 +100,7 @@ def main():
118
100
run ("{0} -c {1} -emit-object {2} -module-name XCTest -parse-as-library -emit-module "
119
101
"-emit-module-path {3}/XCTest.swiftmodule -o {3}/XCTest.o -force-single-frontend-invocation "
120
102
"-module-link-name XCTest" .format (swiftc , style_options , " " .join (sourcePaths ), build_dir ))
121
- run ("clang {1}/lib/swift/linux/{2}/swift_begin.o {0}/XCTest.o {1}/lib/swift/linux/{2}/swift_end.o -shared -o {0}/libXCTest.so -Wl,--no-undefined -Wl,-soname,libXCTest.so -L{1}/lib/swift/linux/ -lswiftGlibc -lswiftCore -lm" .format (build_dir , swift_build_dir , arch ))
103
+ run ("clang {1}/lib/swift/linux/{2}/swift_begin.o {0}/XCTest.o {1}/lib/swift/linux/{2}/swift_end.o -shared -o {0}/libXCTest.so -Wl,--no-undefined -Wl,-soname,libXCTest.so -L{1}/lib/swift/linux/ -lswiftGlibc -lswiftCore -lm" .format (build_dir , swift_build_dir , args . arch ))
122
104
123
105
# If we were given an install directive, perform installation
124
106
if args .module_path is not None and args .lib_path is not None :
0 commit comments