@@ -33,6 +33,9 @@ def parse_args():
33
33
- swift-refactor
34
34
- temp-dir
35
35
- enable-experimental-concurrency (sent to both)
36
+ - I (sent to both)
37
+ - sdk (sent to both)
38
+ - target (sent to both)
36
39
""" )
37
40
38
41
parser .add_argument (
@@ -71,6 +74,19 @@ def parse_args():
71
74
swift-frontend
72
75
'''
73
76
)
77
+ parser .add_argument (
78
+ '-I' ,
79
+ action = 'append' ,
80
+ help = 'Add a directory to the import search path'
81
+ )
82
+ parser .add_argument (
83
+ '-sdk' ,
84
+ help = 'Path to the SDK to build against'
85
+ )
86
+ parser .add_argument (
87
+ '-target' ,
88
+ help = 'The target triple to build for'
89
+ )
74
90
75
91
return parser .parse_known_args ()
76
92
@@ -81,18 +97,24 @@ def main():
81
97
args .pos .replace (':' , '.' )
82
98
temp_file_path = os .path .join (args .temp_dir , temp_file_name )
83
99
84
- extra_frontend_args = []
100
+ extra_both_args = []
85
101
if args .enable_experimental_concurrency :
86
- extra_refactor_args .append ('-enable-experimental-concurrency' )
87
- extra_frontend_args .append ('-enable-experimental-concurrency' )
102
+ extra_both_args .append ('-enable-experimental-concurrency' )
103
+ if args .I :
104
+ for path in args .I :
105
+ extra_both_args += ['-I' , path ]
106
+ if args .sdk :
107
+ extra_both_args += ['-sdk' , args .sdk ]
108
+ if args .target :
109
+ extra_both_args += ['-target' , args .target ]
88
110
89
111
dump_text_output = run_cmd ([
90
112
args .swift_refactor ,
91
113
'-dump-text' ,
92
114
'-source-filename' , args .source_filename ,
93
115
'-rewritten-output-file' , temp_file_path ,
94
116
'-pos' , args .pos
95
- ] + extra_refactor_args , desc = 'producing edit' ).decode ("utf-8" )
117
+ ] + extra_refactor_args + extra_both_args , desc = 'producing edit' ).decode ("utf-8" )
96
118
sys .stdout .write (dump_text_output )
97
119
98
120
run_cmd ([
@@ -101,7 +123,7 @@ def main():
101
123
temp_file_path ,
102
124
'-disable-availability-checking' ,
103
125
'-warn-on-editor-placeholder'
104
- ] + extra_frontend_args , desc = 'checking that rewritten file compiles' )
126
+ ] + extra_both_args , desc = 'checking that rewritten file compiles' )
105
127
106
128
107
129
if __name__ == '__main__' :
0 commit comments