diff options
| author | ruki <[email protected]> | 2025-10-06 23:08:20 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2025-10-06 23:08:20 +0800 |
| commit | 906d3f9c3f803a619cf6f3b3408d7420ae2a71e7 (patch) | |
| tree | 0f76ac23d0d3e069c2277b36da3788456b304d2e | |
| parent | d39631cdeee85cd98e3f5e54d80401c4d26b764c (diff) | |
enable remote only for distcc
| -rw-r--r-- | xmake/actions/build/build.lua | 3 | ||||
| -rw-r--r-- | xmake/core/project/policy.lua | 2 | ||||
| -rw-r--r-- | xmake/modules/async/runjobs.lua | 10 | ||||
| -rw-r--r-- | xmake/modules/private/action/build/target.lua | 8 |
4 files changed, 18 insertions, 5 deletions
diff --git a/xmake/actions/build/build.lua b/xmake/actions/build/build.lua index 168b015d6..1a9522b2c 100644 --- a/xmake/actions/build/build.lua +++ b/xmake/actions/build/build.lua @@ -41,6 +41,9 @@ function _build(targets_root, opt) opt.progress_factor = 0.95 if distcc_build_client.is_connected() then opt.distcc = distcc_build_client.singleton() + if project.policy("build.distcc.remote_only") then + opt.remote_only = true + end end target_buildutils.run_targetjobs(targets_root, opt) end diff --git a/xmake/core/project/policy.lua b/xmake/core/project/policy.lua index 967f9062e..50d9c25e6 100644 --- a/xmake/core/project/policy.lua +++ b/xmake/core/project/policy.lua @@ -115,6 +115,8 @@ function policy.policies() ["build.linker.output"] = {description = "Enable linker output.", type = "boolean"}, -- Enable build jobgraph ["build.jobgraph"] = {description = "Enable build jobgraph.", default = true, type = "boolean"}, + -- Enable build on only remote machines + ["build.distcc.remote_only"] = {description = "Enable build on only remote machines.", default = false, type = "boolean"}, -- Enable windows UAC and set level, e.g. invoker, admin, highest ["windows.manifest.uac"] = {description = "Enable windows manifest UAC.", type = "string"}, -- Enable ui access for windows UAC diff --git a/xmake/modules/async/runjobs.lua b/xmake/modules/async/runjobs.lua index e9d3a0c23..e43286a13 100644 --- a/xmake/modules/async/runjobs.lua +++ b/xmake/modules/async/runjobs.lua @@ -338,9 +338,13 @@ function main(name, jobs, opt) if distcc then state.distcc_semaphore = scheduler.co_semaphore(state.group_name .. "/distcc", 0) end - local local_comax = math.min(state.total, state.comax) - for id = 1, local_comax do - scheduler.co_start_withopt({name = name .. '/' .. tostring(id), isolate = opt.isolate}, _consume_jobs_loop, state, false) + -- @note we can set `remote_only = true` to run all jobs in remote only + local local_comax = 0 + if not opt.remote_only then + local_comax = math.min(state.total, state.comax) + for id = 1, local_comax do + scheduler.co_start_withopt({name = name .. '/' .. tostring(id), isolate = opt.isolate}, _consume_jobs_loop, state, false) + end end if distcc then local left_comax = state.total - local_comax diff --git a/xmake/modules/private/action/build/target.lua b/xmake/modules/private/action/build/target.lua index c8a7987d5..ccb3d2924 100644 --- a/xmake/modules/private/action/build/target.lua +++ b/xmake/modules/private/action/build/target.lua @@ -788,7 +788,9 @@ function run_targetjobs(targets_root, opt) if errors and progress.showing_without_scroll() then print("") end - end, comax = opt.jobs or option.get("jobs") or 1, curdir = curdir, distcc = opt.distcc, progress_factor = opt.progress_factor}) + end, + comax = opt.jobs or option.get("jobs") or 1, curdir = curdir, + distcc = opt.distcc, remote_only = opt.remote_only, progress_factor = opt.progress_factor}) os.cd(curdir) return true end @@ -806,7 +808,9 @@ function run_filejobs(targets_root, opt) if errors and progress.showing_without_scroll() then print("") end - end, comax = opt.jobs or option.get("jobs") or 1, curdir = curdir, distcc = opt.distcc, progress_factor = opt.progress_factor}) + end, + comax = opt.jobs or option.get("jobs") or 1, curdir = curdir, + distcc = opt.distcc, remote_only = opt.remote_only, progress_factor = opt.progress_factor}) os.cd(curdir) return true end |
