From d5ffeb3c8ae9acf6f60a752f670dfc22ace35c1e Mon Sep 17 00:00:00 2001 From: Discreater Date: Mon, 24 Jan 2022 00:52:39 +0800 Subject: [PATCH] fix windows build with multiple visual studio installations --- frontend/scripts/makefile/env.toml | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/frontend/scripts/makefile/env.toml b/frontend/scripts/makefile/env.toml index ba2ccd99f0..b905fcfffc 100644 --- a/frontend/scripts/makefile/env.toml +++ b/frontend/scripts/makefile/env.toml @@ -8,11 +8,18 @@ dependencies=["check_duckscript_installation", "check_visual_studio_installation script = """ output = exec powershell -Command "Get-CimInstance MSFT_VSInstance | select -ExpandProperty Version" stdout = set ${output.stdout} -pos = last_indexof ${stdout} . -new_str = substring ${stdout} 0 ${pos} -# TODO: will raise error if there are more than 1 visual studio installation -newer = semver_is_newer ${new_str} 16.11.0 -assert ${newer} "Visual studio 2019 is not installed or version is lower than 16.11.0" +versions = split ${stdout} "\\n" +for version in ${versions} + pos = last_indexof ${version} . + new_str = substring ${version} 0 ${pos} + newer = semver_is_newer ${new_str} 16.11.0 + if newer + goto :ok + end +end +echo "Visual studio 2019 is not installed or version is lower than 16.11.0" +exit -1 +:ok """ script_runner = "@duckscript"