[Windows] Ignore extra spaces in ninja args

The `ninja.py` script fails for this invocation:

```
ninja -C C:\Code\f\engine\src\out\host_debug_unopt\
 flutter_windows_unittests.exe
```

However, this works as expected:

```
ninja.exe -C C:\Code\f\engine\src\out\host_debug_unopt\
 flutter_windows_unittests.exe
```

Notice how there are extra spaces between the DIR and target. This bug breaks the Flutter engine's build integration with Visual Studio after `ninja.exe` was removed from depot_tools.

Here is an example MSBuild target that runs into this issue:

```xml
  <Target Name="Build">
    <Exec Command="call ninja -C $(OutDir)  flutter_windows_unittests.exe" />
  </Target>
```

Change-Id: Ib0022bc48151de438ac209fd07e0183872538ac6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4215121
Reviewed-by: Junji Watanabe <jwata@google.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Loïc Sharma <loicsharma@google.com>
Reviewed-by: Bruce Dawson <brucedawson@chromium.org>
changes/21/4215121/7
Loic Sharma 3 years ago committed by LUCI CQ
parent 5ed21de943
commit e3fe027009

@ -53,7 +53,7 @@ def main(args):
# we need to split the argument. This means that arguments containing actual
# spaces are not supported by ninja.bat, but that is not a real limitation.
if (sys.platform.startswith('win') and len(args) == 2):
args = args[:1] + args[1].split(' ')
args = args[:1] + args[1].split()
# macOS's python sets CPATH, LIBRARY_PATH, SDKROOT implicitly.
# https://openradar.appspot.com/radar?id=5608755232243712

Loading…
Cancel
Save