summaryrefslogtreecommitdiff
path: root/xmake/rules/rust/build/target.lua
diff options
context:
space:
mode:
Diffstat (limited to 'xmake/rules/rust/build/target.lua')
-rw-r--r--xmake/rules/rust/build/target.lua26
1 files changed, 7 insertions, 19 deletions
diff --git a/xmake/rules/rust/build/target.lua b/xmake/rules/rust/build/target.lua
index 67917ad29..5f0167693 100644
--- a/xmake/rules/rust/build/target.lua
+++ b/xmake/rules/rust/build/target.lua
@@ -21,19 +21,13 @@
-- imports
import("core.base.option")
import("core.base.hashset")
-import("core.theme.theme")
import("core.tool.compiler")
import("core.project.depend")
+import("utils.progress")
-- build the source files
function build_sourcefiles(target, sourcebatch, opt)
- -- is verbose?
- local verbose = option.get("verbose")
-
- -- get progress range
- local progress = assert(opt.progress, "no progress!")
-
-- get the target file
local targetfile = target:targetfile()
@@ -60,17 +54,10 @@ function build_sourcefiles(target, sourcebatch, opt)
end
-- trace progress into
- cprintf("${color.build.progress}" .. theme.get("text.build.progress_format") .. ":${clear} ", progress)
- if verbose then
- cprint("${dim color.build.target}linking.$(mode) %s", path.filename(targetfile))
- else
- cprint("${color.build.target}linking.$(mode) %s", path.filename(targetfile))
- end
+ progress.show(opt.progress, "${color.build.target}linking.$(mode) %s", path.filename(targetfile))
-- trace verbose info
- if verbose then
- print(compinst:buildcmd(sourcefiles, targetfile, {target = target, compflags = compflags}))
- end
+ vprint(compinst:buildcmd(sourcefiles, targetfile, {target = target, compflags = compflags}))
-- flush io buffer to update progress info
io.flush()
@@ -89,10 +76,11 @@ end
function main(target, opt)
-- @note only support one source kind!
- for _, sourcebatch in pairs(target:sourcebatches()) do
- if sourcebatch.sourcekind == "rc" then
+ local sourcebatches = target:sourcebatches()
+ if sourcebatches then
+ local sourcebatch = sourcebatches["rust.build"]
+ if sourcebatch then
build_sourcefiles(target, sourcebatch, opt)
- break
end
end
end