diff options
| author | ruki <[email protected]> | 2020-06-20 22:31:14 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2020-06-20 22:31:14 +0800 |
| commit | 550f5225b01a3c3c0c88bc2c702d38c667b28528 (patch) | |
| tree | b7dcb72313b66fa5a54ba26d5b59f60483ca860e | |
| parent | f7432806254222aff2889eef5eba27716985ba51 (diff) | |
improve test
| -rw-r--r-- | tests/plugins/project/test.lua | 6 | ||||
| -rw-r--r-- | xmake/core/sandbox/modules/import/core/tool/toolchain.lua | 4 | ||||
| -rw-r--r-- | xmake/core/tool/tool.lua | 20 | ||||
| -rw-r--r-- | xmake/core/tool/toolchain.lua | 20 | ||||
| -rw-r--r-- | xmake/toolchains/msvc/xmake.lua | 2 |
5 files changed, 26 insertions, 26 deletions
diff --git a/tests/plugins/project/test.lua b/tests/plugins/project/test.lua index e3295d68d..fd16f8645 100644 --- a/tests/plugins/project/test.lua +++ b/tests/plugins/project/test.lua @@ -1,7 +1,7 @@ import("detect.sdks.find_vstudio") import("core.project.config") import("core.platform.platform") -import("core.platform.environment") +import("core.tool.toolchain") function test_vsxmake(t) @@ -34,9 +34,7 @@ function test_vsxmake(t) try { function () - environment.enter("toolchains") - os.exec("msbuild /P:XmakeDiagnosis=true /P:XmakeVerbose=true") - environment.leave("toolchains") + os.execv("msbuild", {"/P:XmakeDiagnosis=true", "/P:XmakeVerbose=true"}, {envs = toolchain.load("msvc"):runenvs()}) end, catch { diff --git a/xmake/core/sandbox/modules/import/core/tool/toolchain.lua b/xmake/core/sandbox/modules/import/core/tool/toolchain.lua index 8f4202f2b..26af1f141 100644 --- a/xmake/core/sandbox/modules/import/core/tool/toolchain.lua +++ b/xmake/core/sandbox/modules/import/core/tool/toolchain.lua @@ -39,8 +39,8 @@ function sandbox_core_tool_toolchain.list() end -- load the toolchain from the given name -function sandbox_core_tool_toolchain.load(name) - local instance, errors = toolchain.load(name) +function sandbox_core_tool_toolchain.load(name, opt) + local instance, errors = toolchain.load(name, opt) if not instance then raise(errors) end diff --git a/xmake/core/tool/tool.lua b/xmake/core/tool/tool.lua index 144ea0d61..0a45c48c1 100644 --- a/xmake/core/tool/tool.lua +++ b/xmake/core/tool/tool.lua @@ -104,25 +104,7 @@ end -- get run environments function _instance:runenvs() - local runenvs = self._RUNENVS - if runenvs == nil then - local toolchain = self:toolchain() - if toolchain then - local toolchain_runenvs = toolchain:get("runenvs") - if toolchain_runenvs then - runenvs = {} - for name, values in pairs(toolchain_runenvs) do - if type(values) == "table" then - values = path.joinenv(values) - end - runenvs[name] = values - end - end - end - runenvs = runenvs or false - self._RUNENVS = runenvs - end - return runenvs or nil + return self:toolchain() and self:toolchain():runenvs() end -- set the value to the platform info diff --git a/xmake/core/tool/toolchain.lua b/xmake/core/tool/toolchain.lua index e405fe1f8..f6eafa94b 100644 --- a/xmake/core/tool/toolchain.lua +++ b/xmake/core/tool/toolchain.lua @@ -133,6 +133,26 @@ function _instance:standalone() return self:kind() == "standalone" end +-- get the run environments +function _instance:runenvs() + local runenvs = self._RUNENVS + if runenvs == nil then + local toolchain_runenvs = self:get("runenvs") + if toolchain_runenvs then + runenvs = {} + for name, values in pairs(toolchain_runenvs) do + if type(values) == "table" then + values = path.joinenv(values) + end + runenvs[name] = values + end + end + runenvs = runenvs or false + self._RUNENVS = runenvs + end + return runenvs or nil +end + -- get the program and name of the given tool kind function _instance:tool(toolkind) local toolpathes = self:get("toolset." .. toolkind) diff --git a/xmake/toolchains/msvc/xmake.lua b/xmake/toolchains/msvc/xmake.lua index bbef5815d..b9f80cdc1 100644 --- a/xmake/toolchains/msvc/xmake.lua +++ b/xmake/toolchains/msvc/xmake.lua @@ -23,7 +23,7 @@ toolchain("msvc") -- set homepage set_homepage("https://visualstudio.microsoft.com") - set_description("VisualStudio IDE") + set_description("Microsoft Visual C/C++ Compiler") -- mark as standalone toolchain set_kind("standalone") |
