From c8b3a2ec036c524dfec06f5e7416a3fd27c6f8a1 Mon Sep 17 00:00:00 2001 From: OpportunityLiu Date: Tue, 16 Jul 2019 13:52:19 +0800 Subject: only 2010~ --- tests/plugins/project/test.lua | 74 ++++++++++++++++++++++-------------------- 1 file changed, 38 insertions(+), 36 deletions(-) diff --git a/tests/plugins/project/test.lua b/tests/plugins/project/test.lua index 1df87394e..9ee9866c8 100644 --- a/tests/plugins/project/test.lua +++ b/tests/plugins/project/test.lua @@ -16,46 +16,48 @@ function test_vsxmake(t) os.cd("c") for name, _ in pairs(vs) do - -- set config - config.set("arch", arch) - config.set("vs", name) - config.check() - platform.load(config.plat()) - environment.enter("toolchains") + if tonumber(vs) >= 2010 then + -- set config + config.set("arch", arch) + config.set("vs", name) + config.check() + platform.load(config.plat()) + environment.enter("toolchains") - local vstype = "vsxmake" .. name - -- create sln & vcxproj - os.execv("xmake", {"project", "-k", vstype, "-a", arch}) - os.cd(vstype) - -- run msbuild - try - { - function () - return os.iorun("msbuild /P:XmakeDiagnosis=true /P:XmakeVerbose=true") - end, - finally + local vstype = "vsxmake" .. name + -- create sln & vcxproj + os.execv("xmake", {"project", "-k", vstype, "-a", arch}) + os.cd(vstype) + -- run msbuild + try { - function (ok, stdout, stderr) - if ok then - return + function () + return os.iorun("msbuild /P:XmakeDiagnosis=true /P:XmakeVerbose=true") + end, + finally + { + function (ok, stdout, stderr) + if ok then + return + end + print("run msbuild for %s", vstype) + io.write("--- msbuild output ---") + io.write(stdout, "\n", stderr) + io.write("--- sln file ---") + io.write(io.readfile("c_" .. vstype .. ".sln"), "\n") + io.write("--- vcx file ---") + io.write(io.readfile("project/project.vcxproj"), "\n") + io.write("--- filter file ---") + io.write(io.readfile("project/project.vcxprok.filters"), "\n") + raise("msbuild failed") end - print("run msbuild for %s", vstype) - io.write("--- msbuild output ---") - io.write(stdout, "\n", stderr) - io.write("--- sln file ---") - io.write(io.readfile("c_" .. vstype .. ".sln"), "\n") - io.write("--- vcx file ---") - io.write(io.readfile("project/project.vcxproj"), "\n") - io.write("--- filter file ---") - io.write(io.readfile("project/project.vcxprok.filters"), "\n") - raise("msbuild failed") - end + } } - } - environment.leave("toolchains") - -- clean up - os.cd("..") - os.tryrm(vstype) + environment.leave("toolchains") + -- clean up + os.cd("..") + os.tryrm(vstype) + end end os.cd("..") -- cgit v1.3.1