diff options
| author | ruki <[email protected]> | 2022-05-13 23:49:04 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2022-05-13 23:49:04 +0800 |
| commit | 2ff45f35b6e2c68ef4e9b84374e46bd8a204d4d2 (patch) | |
| tree | 709ae7b420af0ed25c4758d5b812776e88903b69 | |
| parent | ced902127370a7d81cc563b4d4079cb34ff18ff8 (diff) | |
mark distcc-able jobs
| -rw-r--r-- | xmake/actions/build/kinds/object.lua | 13 | ||||
| -rw-r--r-- | xmake/modules/private/action/build/object.lua | 2 | ||||
| -rw-r--r-- | xmake/modules/private/async/jobpool.lua | 10 | ||||
| -rw-r--r-- | xmake/rules/c++/xmake.lua | 4 |
4 files changed, 16 insertions, 13 deletions
diff --git a/xmake/actions/build/kinds/object.lua b/xmake/actions/build/kinds/object.lua index 742311370..1ebee8e94 100644 --- a/xmake/actions/build/kinds/object.lua +++ b/xmake/actions/build/kinds/object.lua @@ -38,7 +38,7 @@ function _add_batchjobs_for_rule(batchjobs, rootjob, target, sourcebatch, suffix local script = ruleinst:script(scriptname) if script then if ruleinst:extraconf(scriptname, "batch") then - script(target, batchjobs, sourcebatch, {rootjob = rootjob}) + script(target, batchjobs, sourcebatch, {rootjob = rootjob, distcc = ruleinst:extraconf(scriptname, "distcc")}) else batchjobs:addjob("rule/" .. rulename .. "/" .. scriptname, function (index, total) script(target, sourcebatch, {progress = (index * 100) / total}) @@ -55,7 +55,7 @@ function _add_batchjobs_for_rule(batchjobs, rootjob, target, sourcebatch, suffix for _, sourcefile in ipairs(sourcebatch.sourcefiles) do batchjobs:addjob(sourcefile, function (index, total) script(target, sourcefile, {sourcekind = sourcekind, progress = (index * 100) / total}) - end, {rootjob = rootjob}) + end, {rootjob = rootjob, distcc = ruleinst:extraconf(scriptname, "distcc")}) end end end @@ -67,7 +67,8 @@ function _add_batchjobs_for_rule(batchjobs, rootjob, target, sourcebatch, suffix if script then batchjobs:addjob("rule/" .. rulename .. "/" .. scriptname, function (index, total) local batchcmds_ = batchcmds.new({target = target}) - script(target, batchcmds_, sourcebatch, {progress = (index * 100) / total}) + local distcc = ruleinst:extraconf(scriptname, "distcc") + script(target, batchcmds_, sourcebatch, {progress = (index * 100) / total, distcc = distcc}) batchcmds_:runcmds({dryrun = option.get("dry-run")}) end, {rootjob = rootjob}) end @@ -84,7 +85,7 @@ function _add_batchjobs_for_rule(batchjobs, rootjob, target, sourcebatch, suffix local batchcmds_ = batchcmds.new({target = target}) script(target, batchcmds_, sourcefile, {sourcekind = sourcekind, progress = (index * 100) / total}) batchcmds_:runcmds({dryrun = option.get("dry-run")}) - end, {rootjob = rootjob}) + end, {rootjob = rootjob, distcc = ruleinst:extraconf(scriptname, "distcc")}) end end end @@ -98,7 +99,7 @@ function _add_batchjobs_for_target(batchjobs, rootjob, target, sourcebatch, suff local script = target:script(scriptname) if script then if target:extraconf(scriptname, "batch") then - script(target, batchjobs, sourcebatch, {rootjob = rootjob}) + script(target, batchjobs, sourcebatch, {rootjob = rootjob, distcc = target:extraconf(scriptname, "distcc")}) else batchjobs:addjob(target:name() .. "/" .. scriptname, function (index, total) script(target, sourcebatch, {progress = (index * 100) / total}) @@ -113,7 +114,7 @@ function _add_batchjobs_for_target(batchjobs, rootjob, target, sourcebatch, suff for _, sourcefile in ipairs(sourcebatch.sourcefiles) do batchjobs:addjob(sourcefile, function (index, total) script(target, sourcefile, {sourcekind = sourcekind, progress = (index * 100) / total}) - end, {rootjob = rootjob}) + end, {rootjob = rootjob, distcc = target:extraconf(scriptname, "distcc")}) end return true end diff --git a/xmake/modules/private/action/build/object.lua b/xmake/modules/private/action/build/object.lua index e07ab76b7..3d68dcfa2 100644 --- a/xmake/modules/private/action/build/object.lua +++ b/xmake/modules/private/action/build/object.lua @@ -114,6 +114,6 @@ function main(target, batchjobs, sourcebatch, opt) batchjobs:addjob(sourcefile, function (index, total) local build_opt = table.join({objectfile = objectfile, dependfile = dependfile, sourcekind = sourcekind, progress = (index * 100) / total}, opt) build_object(target, sourcefile, build_opt) - end, {rootjob = rootjob}) + end, {rootjob = rootjob, distcc = opt.distcc}) end end diff --git a/xmake/modules/private/async/jobpool.lua b/xmake/modules/private/async/jobpool.lua index 458b8802d..dfcf2b6d5 100644 --- a/xmake/modules/private/async/jobpool.lua +++ b/xmake/modules/private/async/jobpool.lua @@ -43,8 +43,9 @@ end -- jobpool:add(job, rootjob2) -- jobpool:add(job, rootjob3) -- -function jobpool:newjob(name, run) - return {name = name, run = run} +function jobpool:newjob(name, run, opt) + opt = opt or {} + return {name = name, run = run, distcc = opt.distcc} end -- add run job to the given job node @@ -54,11 +55,12 @@ end -- -- @param name the job name -- @param run the run command/script --- @param opt the options (rootjob) +-- @param opt the options (rootjob, distcc) +-- we can support distcc build if distcc is true -- function jobpool:addjob(name, run, opt) opt = opt or {} - return self:add({name = name, run = run}, opt.rootjob) + return self:add({name = name, run = run, distcc = opt.distcc}, opt.rootjob) end -- add job to the given job node diff --git a/xmake/rules/c++/xmake.lua b/xmake/rules/c++/xmake.lua index 91ac9549c..4fd167722 100644 --- a/xmake/rules/c++/xmake.lua +++ b/xmake/rules/c++/xmake.lua @@ -26,7 +26,7 @@ rule("c.build.pcheader") rule("c.build") set_sourcekinds("cc") add_deps("c.build.pcheader") - on_build_files("private.action.build.object", {batch = true}) + on_build_files("private.action.build.object", {batch = true, distcc = true}) rule("c++.build.pcheader") before_build(function (target, opt) @@ -36,7 +36,7 @@ rule("c++.build.pcheader") rule("c++.build") set_sourcekinds("cxx") add_deps("c++.build.pcheader", "c++.build.modules") - on_build_files("private.action.build.object", {batch = true}) + on_build_files("private.action.build.object", {batch = true, distcc = true}) rule("c++") |
