summaryrefslogtreecommitdiff
path: root/xmake/actions/build/main.lua
diff options
context:
space:
mode:
Diffstat (limited to 'xmake/actions/build/main.lua')
-rw-r--r--xmake/actions/build/main.lua27
1 files changed, 14 insertions, 13 deletions
diff --git a/xmake/actions/build/main.lua b/xmake/actions/build/main.lua
index fe7fcc771..d9ad6818f 100644
--- a/xmake/actions/build/main.lua
+++ b/xmake/actions/build/main.lua
@@ -101,20 +101,18 @@ function _do_project_rules(scriptname, opt)
end
-- do build
-function _do_build(targetname, group_pattern)
+function _do_build(targetname, opt)
local sourcefiles = option.get("files")
if sourcefiles then
- build_files(targetname, group_pattern, sourcefiles)
+ build_files(targetname, {group_pattern = opt.group_pattern, sourcefiles = sourcefiles})
else
- build(targetname, group_pattern)
+ build(targetname, {group_pattern = opt.group_pattern})
end
end
-- build targets
function build_targets(targetnames, opt)
opt = opt or {}
-
- local group_pattern = opt.group_pattern
try
{
function ()
@@ -123,7 +121,7 @@ function build_targets(targetnames, opt)
_do_project_rules("build_before")
-- do build
- _do_build(targetnames, group_pattern)
+ _do_build(targetnames, opt)
-- do check
check_targets(targetnames, {build = true})
@@ -146,8 +144,8 @@ function build_targets(targetnames, opt)
-- raise
if errors then
raise(errors)
- elseif group_pattern then
- raise("build targets with group(%s) failed!", group_pattern)
+ elseif opt.group_pattern then
+ raise("build targets with group(%s) failed!", opt.group_pattern)
elseif targetnames then
targetnames = table.wrap(targetnames)
raise("build target: %s failed!", table.concat(targetnames, ", "))
@@ -162,7 +160,8 @@ function build_targets(targetnames, opt)
_do_project_rules("build_after")
end
-function main()
+function main(opt)
+ opt = opt or {}
-- try building it using third-party buildsystem if xmake.lua not exists
if not os.isfile(project.rootfile()) and _try_build() then
@@ -208,9 +207,11 @@ function main()
project.unlock()
-- trace
- local str = ""
- if build_time then
- str = string.format(", spent %ss", build_time / 1000)
+ if not opt.disable_dump then
+ local str = ""
+ if build_time then
+ str = string.format(", spent %ss", build_time / 1000)
+ end
+ progress.show(100, "${color.success}build ok%s", str)
end
- progress.show(100, "${color.success}build ok%s", str)
end