summaryrefslogtreecommitdiff
path: root/xmake/scripts/platform/linux/prober.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2015-06-10 18:25:18 +0800
committerruki <[email protected]>2015-06-10 18:25:18 +0800
commit62f8e7581602d698a341db16257bd3d9304fa30d (patch)
treedf06a9cade4d74d149b924d2f6dfe0f95632e28b /xmake/scripts/platform/linux/prober.lua
parent72faab4c7e6468d94364e2fec7c11614845d0c74 (diff)
trace probe verbose
Diffstat (limited to 'xmake/scripts/platform/linux/prober.lua')
-rw-r--r--xmake/scripts/platform/linux/prober.lua48
1 files changed, 31 insertions, 17 deletions
diff --git a/xmake/scripts/platform/linux/prober.lua b/xmake/scripts/platform/linux/prober.lua
index f6e6ff5de..70f877bb7 100644
--- a/xmake/scripts/platform/linux/prober.lua
+++ b/xmake/scripts/platform/linux/prober.lua
@@ -33,31 +33,31 @@ local global = require("base/global")
local prober = prober or {}
-- probe the architecture
-function prober._probe_arch()
+function prober._probe_arch(configs)
-- get the architecture
- local arch = config.get("arch")
+ local arch = configs.get("arch")
-- ok?
if arch then return true end
-- init the default architecture
- config.set("arch", xmake._ARCH)
+ configs.set("arch", xmake._ARCH)
-- ok
return true
end
-- probe the ccache
-function prober._probe_ccache()
+function prober._probe_ccache(configs)
-- ok?
- local ccache_enable = config.get("ccache")
- if ccache_enable and config.get("__ccache") then return true end
+ local ccache_enable = configs.get("ccache")
+ if ccache_enable and configs.get("__ccache") then return true end
-- disable?
if type(ccache_enable) == "boolean" and not ccache_enable then
- config.set("__ccache", nil)
+ configs.set("__ccache", nil)
return true
end
@@ -66,10 +66,10 @@ function prober._probe_ccache()
-- probe ok? update it
if ccache_path then
- config.set("ccache", true)
- config.set("__ccache", ccache_path)
+ configs.set("ccache", true)
+ configs.set("__ccache", ccache_path)
else
- config.set("ccache", false)
+ configs.set("ccache", false)
end
-- ok
@@ -79,20 +79,34 @@ end
-- probe the project configure
function prober.config()
- -- probe the architecture
- if not prober._probe_arch() then return end
-
- -- probe the ccache
- if not prober._probe_ccache() then return end
+ -- call all probe functions
+ utils.call( prober
+ , { "_probe_arch"
+ , "_probe_ccache"}
+
+ , function (name, result)
+ -- trace
+ utils.verbose("checking %s ...: %s", name:gsub("_probe_", ""), utils.ifelse(result, "ok", "no"))
+ return result
+ end
+ , config)
end
-- probe the global configure
function prober.global()
- -- probe the ccache
- if not prober._probe_ccache() then return end
+ -- call all probe functions
+ utils.call( prober
+ , { "_probe_ccache"}
+
+ , function (name, result)
+ -- trace
+ utils.verbose("checking %s ...: %s", name:gsub("_probe_", ""), utils.ifelse(result, "ok", "no"))
+ return result
+ end
+ , global)
end
-- return module: prober