File tree Expand file tree Collapse file tree 2 files changed +29
-11
lines changed Expand file tree Collapse file tree 2 files changed +29
-11
lines changed Original file line number Diff line number Diff line change @@ -225,17 +225,22 @@ _C_CPP_KV_STYLE_NEW=${hide;kv:_C_CPP_KV_STYLE_P} ${hide;kv:_C_CPP_KV_STYLE_PC}
225
225
_C_CPP_KV_STYLE_P=p CC
226
226
_C_CPP_KV_STYLE_PC=pc green
227
227
228
- _C_CPP_WRAPPER=$YMAKE_PYTHON3 ${input:"build/scripts/wrapcc.py"} ${input:SRC}
229
- when ($CLANG_TIDY_ARGS || $RETRY_ARGS || $YNDEXER_ARGS || $OPENSOURCE == "yes" || $RAW_COMPILE_CPP_CMD == "yes" ) {
228
+ # --wrapcc-end argument must be the last one
229
+ _C_CPP_WRAPPER=$YMAKE_PYTHON3 ${input:"build/scripts/wrapcc.py"} \
230
+ --source-file ${input:SRC} \
231
+ --source-root ${ARCADIA_ROOT} \
232
+ --wrapcc-end
233
+
234
+ when ($CLANG_TIDY_ARGS || $OPENSOURCE == "yes" || $RAW_COMPILE_CPP_CMD == "yes" ) {
230
235
_C_CPP_WRAPPER=
231
236
}
232
237
233
238
_CPP_ARGS_NEW=\
234
239
$CLANG_STATIC_ANALYZER_OPTIONS_NEW && \
235
240
$CLANG_TIDY_ARGS \
241
+ $_C_CPP_WRAPPER \
236
242
$YNDEXER_ARGS \
237
243
$RETRY_ARGS \
238
- $_C_CPP_WRAPPER \
239
244
$CXX_COMPILER \
240
245
$C_FLAGS_PLATFORM \
241
246
$GCC_COMPILE_FLAGS \
@@ -254,9 +259,9 @@ _CPP_ARGS_NEW=\
254
259
255
260
_C_ARGS_NEW=\
256
261
$CLANG_TIDY_ARGS \
262
+ $_C_CPP_WRAPPER \
257
263
$YNDEXER_ARGS \
258
264
$RETRY_ARGS \
259
- $_C_CPP_WRAPPER \
260
265
$C_COMPILER \
261
266
$C_FLAGS_PLATFORM \
262
267
$GCC_COMPILE_FLAGS \
Original file line number Diff line number Diff line change
1
+ import argparse
1
2
import subprocess
2
- import sys
3
+ import sys , os
3
4
4
5
5
- def fix (path : str ):
6
+ WRAPCC_ARGS_END = '--wrapcc-end'
7
+
8
+ def fix (source_file : str , source_root : str ):
6
9
flags = []
7
10
return flags
8
11
12
+ def parse_args ():
13
+ delimer = - 1
14
+ if WRAPCC_ARGS_END in sys .argv :
15
+ delimer = sys .argv .index (WRAPCC_ARGS_END )
16
+ assert delimer != - 1 , f"This wrapper should be called with { WRAPCC_ARGS_END } argument."
17
+
18
+ parser = argparse .ArgumentParser ()
19
+ parser .add_argument ('--source-file' , required = True )
20
+ parser .add_argument ('--source-root' , required = True )
21
+ cc_cmd = sys .argv [delimer + 1 :]
22
+ return parser .parse_args (sys .argv [1 :delimer ]), cc_cmd
23
+
9
24
if __name__ == '__main__' :
10
- path = sys .argv [1 ]
11
- args = sys .argv [2 :]
12
- cmd = args + fix (path )
13
- rc = subprocess .call (cmd , shell = False , stderr = sys .stderr , stdout = sys .stdout )
14
- sys .exit (rc )
25
+ args , cc_cmd = parse_args ()
26
+ cmd = cc_cmd + fix (args .source_file , args .source_root )
27
+ os .execv (cmd [0 ], cmd )
You can’t perform that action at this time.
0 commit comments