OLD | NEW |
1 # Copyright (c) 2012 Google Inc. All rights reserved. | 1 # Copyright (c) 2012 Google Inc. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import copy | 5 import copy |
6 import ntpath | 6 import ntpath |
7 import os | 7 import os |
8 import posixpath | 8 import posixpath |
9 import re | 9 import re |
10 import subprocess | 10 import subprocess |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 cmd += 'bash -c "%(cmd)s"' | 287 cmd += 'bash -c "%(cmd)s"' |
288 cmd = cmd % {'cygwin_dir': cygwin_dir, | 288 cmd = cmd % {'cygwin_dir': cygwin_dir, |
289 'cmd': direct_cmd} | 289 'cmd': direct_cmd} |
290 return input_dir_preamble + cmd | 290 return input_dir_preamble + cmd |
291 else: | 291 else: |
292 # Convert cat --> type to mimic unix. | 292 # Convert cat --> type to mimic unix. |
293 if cmd[0] == 'cat': | 293 if cmd[0] == 'cat': |
294 command = ['type'] | 294 command = ['type'] |
295 else: | 295 else: |
296 command = [cmd[0].replace('/', '\\')] | 296 command = [cmd[0].replace('/', '\\')] |
| 297 # Add call before command to ensure that commands can be tied together one |
| 298 # after the other without aborting in Incredibuild, since IB makes a bat |
| 299 # file out of the raw command string, and some commands (like python) are |
| 300 # actually batch files themselves. |
| 301 command.insert(0, 'call') |
297 # Fix the paths | 302 # Fix the paths |
298 # TODO(quote): This is a really ugly heuristic, and will miss path fixing | 303 # TODO(quote): This is a really ugly heuristic, and will miss path fixing |
299 # for arguments like "--arg=path" or "/opt:path". | 304 # for arguments like "--arg=path" or "/opt:path". |
300 # If the argument starts with a slash or dash, it's probably a command line | 305 # If the argument starts with a slash or dash, it's probably a command line |
301 # switch | 306 # switch |
302 arguments = [i if (i[:1] in "/-") else _FixPath(i) for i in cmd[1:]] | 307 arguments = [i if (i[:1] in "/-") else _FixPath(i) for i in cmd[1:]] |
303 arguments = [i.replace('$(InputDir)','%INPUTDIR%') for i in arguments] | 308 arguments = [i.replace('$(InputDir)','%INPUTDIR%') for i in arguments] |
304 arguments = [MSVSSettings.FixVCMacroSlashes(i) for i in arguments] | 309 arguments = [MSVSSettings.FixVCMacroSlashes(i) for i in arguments] |
305 if quote_cmd: | 310 if quote_cmd: |
306 # Support a mode for using cmd directly. | 311 # Support a mode for using cmd directly. |
(...skipping 2810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3117 action_spec.extend( | 3122 action_spec.extend( |
3118 # TODO(jeanluc) 'Document' for all or just if as_sources? | 3123 # TODO(jeanluc) 'Document' for all or just if as_sources? |
3119 [['FileType', 'Document'], | 3124 [['FileType', 'Document'], |
3120 ['Command', command], | 3125 ['Command', command], |
3121 ['Message', description], | 3126 ['Message', description], |
3122 ['Outputs', outputs] | 3127 ['Outputs', outputs] |
3123 ]) | 3128 ]) |
3124 if additional_inputs: | 3129 if additional_inputs: |
3125 action_spec.append(['AdditionalInputs', additional_inputs]) | 3130 action_spec.append(['AdditionalInputs', additional_inputs]) |
3126 actions_spec.append(action_spec) | 3131 actions_spec.append(action_spec) |
OLD | NEW |