From e3fe0270094dd7b3a75d0e54ef4f2eb592bb97cb Mon Sep 17 00:00:00 2001 From: Loic Sharma Date: Thu, 2 Feb 2023 21:55:21 +0000 Subject: [PATCH] [Windows] Ignore extra spaces in ninja args MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 ``` Change-Id: Ib0022bc48151de438ac209fd07e0183872538ac6 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4215121 Reviewed-by: Junji Watanabe Reviewed-by: Gavin Mak Commit-Queue: Loïc Sharma Reviewed-by: Bruce Dawson --- ninja.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ninja.py b/ninja.py index 62b45c9b57..77f9d63dcd 100755 --- a/ninja.py +++ b/ninja.py @@ -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