summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2016-04-19 14:33:09 +0800
committerruki <[email protected]>2016-04-19 14:33:09 +0800
commit655f4fc9f27d19bb02eb6f131412f88db42f4253 (patch)
tree6b6bf66f8ab80c8c29e28bbbb08b175cc97303ae
parent223c87f37fb9e8f3ffe808fae5041a1c4aee95d0 (diff)
check ar and swiftc
-rw-r--r--xmake/core/tool/tool.lua2
-rw-r--r--xmake/tools/ar.lua5
-rw-r--r--xmake/tools/swiftc.lua7
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