diff options
| author | ruki <[email protected]> | 2026-04-24 23:20:44 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2026-04-24 23:20:44 +0800 |
| commit | 388c1813adcb65e09828cdbc4497c931b504d968 (patch) | |
| tree | 625a9114bc16d91edfc9ce3483b723db4f37b457 /xmake/rules/rust | |
| parent | e7d86ead6c2760d1ca3548093673ef1db99e85c3 (diff) | |
fix rust buildrust
Diffstat (limited to 'xmake/rules/rust')
| -rw-r--r-- | xmake/rules/rust/build/target.lua | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/xmake/rules/rust/build/target.lua b/xmake/rules/rust/build/target.lua index 6eb5001ff..d7f4d9e26 100644 --- a/xmake/rules/rust/build/target.lua +++ b/xmake/rules/rust/build/target.lua @@ -25,6 +25,22 @@ import("core.tool.compiler") import("core.project.depend") import("utils.progress") +-- get dependent target files +function _get_target_depfiles(target) + local depfiles = {} + for _, dep in ipairs(target:orderdeps()) do + if dep:is_static() or dep:is_shared() then + table.insert(depfiles, dep:targetfile()) + end + end + local linkdepfiles = target:data("linkdepfiles") + if linkdepfiles then + table.join2(depfiles, linkdepfiles) + end + table.sort(depfiles) + return depfiles +end + -- build the source files function build_sourcefiles(target, sourcebatch, opt) @@ -49,7 +65,8 @@ function build_sourcefiles(target, sourcebatch, opt) -- need build this object? local depvalues = {compinst:program(), compflags} - if not depend.is_changed(dependinfo, {lastmtime = os.mtime(targetfile), values = depvalues}) then + local depfiles = table.join(table.clone(sourcefiles), _get_target_depfiles(target)) + if not depend.is_changed(dependinfo, {lastmtime = os.mtime(targetfile), values = depvalues, files = depfiles}) then return end @@ -68,7 +85,7 @@ function build_sourcefiles(target, sourcebatch, opt) -- update files and values to the dependent file dependinfo.values = depvalues - table.join2(dependinfo.files, sourcefiles) + table.join2(dependinfo.files, depfiles) depend.save(dependinfo, dependfile) end |
