summaryrefslogtreecommitdiff
path: root/xmake/actions/build/main.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2020-02-18 22:35:50 +0800
committerruki <[email protected]>2020-02-18 09:35:01 +0800
commit753309f3eca9445904c2e70d99fcdc49a67e5add (patch)
tree141d7d83ff6cbe8782c9ab85f981d993f573cfb8 /xmake/actions/build/main.lua
parent0835cadcfe5f48870790cce20d6a3968d7b1ccf7 (diff)
move trybuild config
Diffstat (limited to 'xmake/actions/build/main.lua')
-rw-r--r--xmake/actions/build/main.lua17
1 files changed, 10 insertions, 7 deletions
diff --git a/xmake/actions/build/main.lua b/xmake/actions/build/main.lua
index 4b14639a2..3e2f71aa2 100644
--- a/xmake/actions/build/main.lua
+++ b/xmake/actions/build/main.lua
@@ -32,30 +32,33 @@ import("statistics")
-- try to build
function _trybuild()
+ -- load config
+ config.load()
+
-- get the buildsystem tool
local configfile = nil
local tool = nil
- local try_tool = option.get("try-tool")
- if try_tool then
- tool = import("trybuild." .. try_tool, {try = true, anonymous = true})
+ local trybuild = config.get("trybuild")
+ if trybuild then
+ tool = import("private.action.trybuild." .. trybuild, {try = true, anonymous = true})
if tool then
configfile = tool.detect()
else
- raise("unknown build tool: %s", try_tool)
+ raise("unknown build tool: %s", trybuild)
end
else
for _, name in ipairs({"msbuild", "xcodebuild", "cmake", "autotools", "make"}) do
- tool = import("trybuild." .. name, {anonymous = true})
+ tool = import("private.action.trybuild." .. name, {anonymous = true})
configfile = tool.detect()
if configfile then
- try_tool = name
+ config.set("trybuild", name, {readonly = true, force = true})
break
end
end
end
-- try building it
- if configfile and tool and utils.confirm({default = true, description = "${bright}" .. path.filename(configfile) .. "${clear} found, try building it"}) then
+ if configfile and tool and (trybuild or utils.confirm({default = true, description = "${bright}" .. path.filename(configfile) .. "${clear} found, try building it"})) then
tool.build()
end
end