From 655f4fc9f27d19bb02eb6f131412f88db42f4253 Mon Sep 17 00:00:00 2001 From: ruki Date: Tue, 19 Apr 2016 14:33:09 +0800 Subject: check ar and swiftc --- xmake/core/tool/tool.lua | 2 +- xmake/tools/ar.lua | 5 ++++- xmake/tools/swiftc.lua | 7 +++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/xmake/core/tool/tool.lua b/xmake/core/tool/tool.lua index c885f9e48..a6d077de5 100644 --- a/xmake/core/tool/tool.lua +++ b/xmake/core/tool/tool.lua @@ -212,7 +212,7 @@ function tool.check(shellname, dirs) -- check assert(shellname) - + -- attempt to check it directly first if tool._check(shellname) then return shellname diff --git a/xmake/tools/ar.lua b/xmake/tools/ar.lua index 0999672f1..9aaf70b80 100644 --- a/xmake/tools/ar.lua +++ b/xmake/tools/ar.lua @@ -68,5 +68,8 @@ end function check(flags) -- check it - os.run("%s %s", _g.shellname, ifelse(flags, flags, "")) + local ok = os.execute("%s %s > %s 2>&1", _g.shellname, ifelse(flags, flags, ""), os.nuldev()) + if ok ~= 0 and ok ~= 256 then + raise("not found!") + end end diff --git a/xmake/tools/swiftc.lua b/xmake/tools/swiftc.lua index 65e6f8245..2cfc94cc0 100644 --- a/xmake/tools/swiftc.lua +++ b/xmake/tools/swiftc.lua @@ -110,3 +110,10 @@ function run(...) os.run(...) end +-- check the given flags +function check(flags) + + -- check it + os.run("%s -h", _g.shellname) + +end -- cgit v1.3.1