summaryrefslogtreecommitdiff
path: root/xmake/modules/private/action/build/object.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2020-11-14 17:10:32 +0800
committerruki <[email protected]>2020-11-14 17:10:32 +0800
commit76dc49d6ea92fa8d22f24725de7e661f55bce3ca (patch)
tree07f553884a5a5d9eaa5746f4ab33403c213aa2c6 /xmake/modules/private/action/build/object.lua
parent5643311ff8d29840261853b4b21c653d169b0b8f (diff)
fix dry-run build
Diffstat (limited to 'xmake/modules/private/action/build/object.lua')
-rw-r--r--xmake/modules/private/action/build/object.lua21
1 files changed, 12 insertions, 9 deletions
diff --git a/xmake/modules/private/action/build/object.lua b/xmake/modules/private/action/build/object.lua
index 357c58aea..9164ee08c 100644
--- a/xmake/modules/private/action/build/object.lua
+++ b/xmake/modules/private/action/build/object.lua
@@ -44,11 +44,14 @@ function _do_build_file(target, sourcefile, opt)
-- load dependent info
local dependinfo = option.get("rebuild") and {} or (depend.load(dependfile) or {})
+ -- dry run?
+ local dryrun = option.get("dry-run")
+
-- need build this object?
-- @note we use mtime(dependfile) instead of mtime(objectfile) to ensure the object file is is fully compiled.
-- @see https://github.com/xmake-io/xmake/issues/748
local depvalues = {compinst:program(), compflags}
- if not depend.is_changed(dependinfo, {lastmtime = os.mtime(dependfile), values = depvalues}) then
+ if not dryrun and not depend.is_changed(dependinfo, {lastmtime = os.mtime(dependfile), values = depvalues}) then
return
end
@@ -68,17 +71,17 @@ function _do_build_file(target, sourcefile, opt)
-- show the full link command with raw arguments, it will expand @xxx.args for msvc/link on windows
print(compinst:compcmd(sourcefile, objectfile, {compflags = compflags, rawargs = true}))
end
+ if not dryrun then
- -- compile it
- dependinfo.files = {}
- if not option.get("dry-run") then
+ -- do compile
+ dependinfo.files = {}
assert(compinst:compile(sourcefile, objectfile, {dependinfo = dependinfo, compflags = compflags}))
- end
- -- update files and values to the dependent file
- dependinfo.values = depvalues
- table.join2(dependinfo.files, sourcefile, target:pcoutputfile("cxx") or {}, target:pcoutputfile("c"))
- depend.save(dependinfo, dependfile)
+ -- update files and values to the dependent file
+ dependinfo.values = depvalues
+ table.join2(dependinfo.files, sourcefile, target:pcoutputfile("cxx") or {}, target:pcoutputfile("c"))
+ depend.save(dependinfo, dependfile)
+ end
end
-- build object