diff options
| author | ruki <[email protected]> | 2025-03-23 23:35:51 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2025-04-08 15:31:55 +0800 |
| commit | 812d8ec053376a541193dc943362797fd2c4541e (patch) | |
| tree | 32061d60f67c09bfa5b75c27dcbe760198f5187d | |
| parent | b8b96a08063228fd7832862275c9f47c24b1546c (diff) | |
fix build files
| -rw-r--r-- | xmake/actions/build/build_files.lua | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/xmake/actions/build/build_files.lua b/xmake/actions/build/build_files.lua index 8848962db..1b29cd6c0 100644 --- a/xmake/actions/build/build_files.lua +++ b/xmake/actions/build/build_files.lua @@ -115,15 +115,28 @@ function _add_batchjobs_for_target_and_deps(batchjobs, rootjob, jobrefs, target, end -- get batch jobs -function _get_batchjobs(targetname, opt) +function _get_batchjobs(targetnames, opt) -- convert all sourcefiles to lua pattern local filepatterns = _get_file_patterns(opt.sourcefiles) -- get root targets local targets_root = {} - if targetname then - table.insert(targets_root, project.target(targetname)) + if targetnames then + for _, targetname in ipairs(table.wrap(targetnames)) do + local target = project.target(targetname) + if target then + table.insert(targets_root, target) + if option.get("rebuild") then + target:data_set("rebuilt", true) + if not option.get("shallow") then + for _, dep in ipairs(target:orderdeps()) do + dep:data_set("rebuilt", true) + end + end + end + end + end else local group_pattern = opt.group_pattern local depset = hashset.new() @@ -140,6 +153,14 @@ function _get_batchjobs(targetname, opt) for _, target in pairs(targets) do if not depset:has(target:name()) then table.insert(targets_root, target) + if option.get("rebuild") then + target:data_set("rebuilt", true) + if not option.get("shallow") then + for _, dep in ipairs(target:orderdeps()) do + dep:data_set("rebuilt", true) + end + end + end end end end @@ -198,13 +219,13 @@ function _get_file_patterns(sourcefiles) end -- the main entry -function main(targetname, opt) +function main(targetnames, opt) -- prepare to build files prepare_build_files(targetnames, opt) -- build all jobs - local batchjobs = _get_batchjobs(targetname, opt) + local batchjobs = _get_batchjobs(targetnames, opt) if batchjobs and batchjobs:size() > 0 then local curdir = os.curdir() runjobs("build_files", batchjobs, {comax = option.get("jobs") or 1, curdir = curdir}) |
