diff options
author | Daniel Moody <daniel.moody@mongodb.com> | 2020-07-16 17:37:56 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-07-20 12:05:28 +0000 |
commit | ab1a892520e9a9b84ae90d52f84a0f107efbdecd (patch) | |
tree | 81c65e60bfb3f9adb32c4c1b430d818d988a5292 /SConstruct | |
parent | 87c0656852be4f4ed6a14f08cd75a6000dc4ee74 (diff) | |
download | mongo-ab1a892520e9a9b84ae90d52f84a0f107efbdecd.tar.gz |
SERVER-49395 more portable way for ninja to build unittests.txt
Diffstat (limited to 'SConstruct')
-rw-r--r-- | SConstruct | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/SConstruct b/SConstruct index 0f47acf5684..bc7a6135506 100644 --- a/SConstruct +++ b/SConstruct @@ -3881,13 +3881,13 @@ if get_option('ninja') != 'disabled': else: ninja_builder = Tool("ninja_next") ninja_builder.generate(env) - + ninjaConf = Configure(env, help=False, custom_tests = { 'CheckNinjaCompdbExpand': env.CheckNinjaCompdbExpand, }) env['NINJA_COMPDB_EXPAND'] = ninjaConf.CheckNinjaCompdbExpand() ninjaConf.Finish() - + # idlc.py has the ability to print it's implicit dependencies # while generating, Ninja can consume these prints using the @@ -3931,7 +3931,7 @@ if get_option('ninja') != 'disabled': def ninja_test_list_builder(env, node): test_files = [test_file.path for test_file in env["MONGO_TEST_REGISTRY"][node.path]] - files = "\\n".join(test_files) + files = ' '.join(test_files) return { "outputs": [node.get_path()], "rule": "TEST_LIST", @@ -3941,13 +3941,15 @@ if get_option('ninja') != 'disabled': } } + if env["PLATFORM"] == "win32": + cmd = 'cmd.exe /c del "$out" && for %a in ($files) do (echo %a >> "$out")' + else: + cmd = 'rm -f "$out"; for i in $files; do echo "$$i" >> "$out"; done;' + env.NinjaRule( rule="TEST_LIST", description="Compiling test list: $out", - command="{prefix}echo {flags} '$files' > '$out'".format( - prefix="cmd.exe /c " if env["PLATFORM"] == "win32" else "", - flags="-n" if env["PLATFORM"] != "win32" else "", - ), + command=cmd, ) env.NinjaRegisterFunctionHandler("test_list_builder_action", ninja_test_list_builder) |