summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2024-03-18 23:52:01 +0800
committerruki <[email protected]>2024-03-18 23:52:01 +0800
commit8f40dc67f661f46de7a073ea079587faebf0f1af (patch)
tree9a56acb9dac1c1b90c13fd34a8d59acf20a3150b
parentca16db30058d8a512d73a7bee28e57f72de4c338 (diff)
use new progress
-rw-r--r--xmake/actions/build/build.lua20
-rw-r--r--xmake/actions/build/kinds/binary.lua4
-rw-r--r--xmake/actions/build/kinds/object.lua24
-rw-r--r--xmake/actions/build/kinds/shared.lua4
-rw-r--r--xmake/actions/build/kinds/static.lua4
-rw-r--r--xmake/modules/async/runjobs.lua10
-rw-r--r--xmake/modules/private/action/build/object.lua4
-rw-r--r--xmake/modules/private/async/buildjobs.lua2
-rw-r--r--xmake/modules/utils/progress.lua4
-rw-r--r--xmake/rules/c++/modules/modules_support/clang/builder.lua14
-rw-r--r--xmake/rules/c++/modules/modules_support/gcc/builder.lua14
-rw-r--r--xmake/rules/c++/modules/modules_support/msvc/builder.lua14
-rw-r--r--xmake/rules/protobuf/proto.lua4
13 files changed, 61 insertions, 61 deletions
diff --git a/xmake/actions/build/build.lua b/xmake/actions/build/build.lua
index fbbb9fdbc..43e28bf21 100644
--- a/xmake/actions/build/build.lua
+++ b/xmake/actions/build/build.lua
@@ -48,16 +48,16 @@ function _add_batchjobs_builtin(batchjobs, rootjob, target)
if r:extraconf("build", "batch") then
job, job_leaf = assert(script(target, batchjobs, {rootjob = job or rootjob}), "rule(%s):on_build(): no returned job!", r:name())
else
- job = batchjobs:addjob("rule/" .. r:name() .. "/build", function (index, total)
- script(target, {progress = (index * 100) / total})
+ job = batchjobs:addjob("rule/" .. r:name() .. "/build", function (index, total, opt)
+ script(target, {progress = opt.progress})
end, {rootjob = job or rootjob})
end
else
local buildcmd = r:script("buildcmd")
if buildcmd then
- job = batchjobs:addjob("rule/" .. r:name() .. "/build", function (index, total)
+ job = batchjobs:addjob("rule/" .. r:name() .. "/build", function (index, total, opt)
local batchcmds_ = batchcmds.new({target = target})
- buildcmd(target, batchcmds_, {progress = (index * 100) / total})
+ buildcmd(target, batchcmds_, {progress = opt.progress})
batchcmds_:runcmds({changed = target:is_rebuilt(), dryrun = option.get("dry-run")})
end, {rootjob = job or rootjob})
end
@@ -100,8 +100,8 @@ function _add_batchjobs(batchjobs, rootjob, target)
-- print("build it")
-- end)
--
- job = batchjobs:addjob(target:name() .. "/build", function (index, total)
- script(target, {progress = (index * 100) / total})
+ job = batchjobs:addjob(target:name() .. "/build", function (index, total, opt)
+ script(target, {progress = opt.progress})
end, {rootjob = rootjob})
end
return job, job_leaf or job
@@ -118,10 +118,10 @@ function _add_batchjobs_for_target(batchjobs, rootjob, target)
-- add after_build job for target
local pkgenvs = _g.pkgenvs or {}
_g.pkgenvs = pkgenvs
- local job_build_after = batchjobs:addjob(target:name() .. "/after_build", function (index, total)
+ local job_build_after = batchjobs:addjob(target:name() .. "/after_build", function (index, total, opt)
-- do after_build
- local progress = (index * 100) / total
+ local progress = opt.progress
local after_build = target:script("build_after")
if after_build then
after_build(target, {progress = progress})
@@ -158,7 +158,7 @@ function _add_batchjobs_for_target(batchjobs, rootjob, target)
local job_build, job_build_leaf = _add_batchjobs(batchjobs, job_build_after, target)
-- add before_build job for target
- local job_build_before = batchjobs:addjob(target:name() .. "/before_build", function (index, total)
+ local job_build_before = batchjobs:addjob(target:name() .. "/before_build", function (index, total, opt)
-- enter package environments
-- https://github.com/xmake-io/xmake/issues/4033
@@ -184,7 +184,7 @@ function _add_batchjobs_for_target(batchjobs, rootjob, target)
-- do before_build
-- we cannot add batchjobs for this rule scripts, @see https://github.com/xmake-io/xmake/issues/2684
- local progress = (index * 100) / total
+ local progress = opt.progress
local before_build = target:script("build_before")
if before_build then
before_build(target, {progress = progress})
diff --git a/xmake/actions/build/kinds/binary.lua b/xmake/actions/build/kinds/binary.lua
index dd14d5c95..2f5bad0fc 100644
--- a/xmake/actions/build/kinds/binary.lua
+++ b/xmake/actions/build/kinds/binary.lua
@@ -156,8 +156,8 @@ end
function main(batchjobs, rootjob, target)
-- add link job
- local job_link = batchjobs:addjob(target:name() .. "/link", function (index, total)
- _link_target(target, {progress = (index * 100) / total})
+ local job_link = batchjobs:addjob(target:name() .. "/link", function (index, total, opt)
+ _link_target(target, {progress = opt.progress})
end, {rootjob = rootjob})
-- we only need to return and depend the link job for each target,
diff --git a/xmake/actions/build/kinds/object.lua b/xmake/actions/build/kinds/object.lua
index 829378f1b..ab7f3b149 100644
--- a/xmake/actions/build/kinds/object.lua
+++ b/xmake/actions/build/kinds/object.lua
@@ -100,8 +100,8 @@ function _add_batchjobs_for_rule(batchjobs, rootjob, target, sourcebatch, suffix
if ruleinst:extraconf(scriptname, "batch") then
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})
+ batchjobs:addjob("rule/" .. rulename .. "/" .. scriptname, function (index, total, opt)
+ script(target, sourcebatch, {progress = opt.progress})
end, {rootjob = rootjob})
end
end
@@ -113,8 +113,8 @@ function _add_batchjobs_for_rule(batchjobs, rootjob, target, sourcebatch, suffix
if script then
local sourcekind = sourcebatch.sourcekind
for _, sourcefile in ipairs(sourcebatch.sourcefiles) do
- batchjobs:addjob(sourcefile, function (index, total)
- script(target, sourcefile, {sourcekind = sourcekind, progress = (index * 100) / total})
+ batchjobs:addjob(sourcefile, function (index, total, opt)
+ script(target, sourcefile, {sourcekind = sourcekind, progress = opt.progress})
end, {rootjob = rootjob, distcc = ruleinst:extraconf(scriptname, "distcc")})
end
end
@@ -125,10 +125,10 @@ function _add_batchjobs_for_rule(batchjobs, rootjob, target, sourcebatch, suffix
scriptname = "buildcmd_files" .. (suffix and ("_" .. suffix) or "")
script = ruleinst:script(scriptname)
if script then
- batchjobs:addjob("rule/" .. rulename .. "/" .. scriptname, function (index, total)
+ batchjobs:addjob("rule/" .. rulename .. "/" .. scriptname, function (index, total, opt)
local batchcmds_ = batchcmds.new({target = target})
local distcc = ruleinst:extraconf(scriptname, "distcc")
- script(target, batchcmds_, sourcebatch, {progress = (index * 100) / total, distcc = distcc})
+ script(target, batchcmds_, sourcebatch, {progress = opt.progress, distcc = distcc})
batchcmds_:runcmds({changed = target:is_rebuilt(), dryrun = option.get("dry-run")})
end, {rootjob = rootjob})
end
@@ -141,9 +141,9 @@ function _add_batchjobs_for_rule(batchjobs, rootjob, target, sourcebatch, suffix
if script then
local sourcekind = sourcebatch.sourcekind
for _, sourcefile in ipairs(sourcebatch.sourcefiles) do
- batchjobs:addjob(sourcefile, function (index, total)
+ batchjobs:addjob(sourcefile, function (index, total, opt)
local batchcmds_ = batchcmds.new({target = target})
- script(target, batchcmds_, sourcefile, {sourcekind = sourcekind, progress = (index * 100) / total})
+ script(target, batchcmds_, sourcefile, {sourcekind = sourcekind, progress = opt.progress})
batchcmds_:runcmds({changed = target:is_rebuilt(), dryrun = option.get("dry-run")})
end, {rootjob = rootjob, distcc = ruleinst:extraconf(scriptname, "distcc")})
end
@@ -177,8 +177,8 @@ function _add_batchjobs_for_target(batchjobs, rootjob, target, sourcebatch, suff
if target:extraconf(scriptname, "batch") then
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})
+ batchjobs:addjob(target:name() .. "/" .. scriptname, function (index, total, opt)
+ script(target, sourcebatch, {progress = opt.progress})
end, {rootjob = rootjob})
end
return true
@@ -188,8 +188,8 @@ function _add_batchjobs_for_target(batchjobs, rootjob, target, sourcebatch, suff
if script then
local sourcekind = sourcebatch.sourcekind
for _, sourcefile in ipairs(sourcebatch.sourcefiles) do
- batchjobs:addjob(sourcefile, function (index, total)
- script(target, sourcefile, {sourcekind = sourcekind, progress = (index * 100) / total})
+ batchjobs:addjob(sourcefile, function (index, total, opt)
+ script(target, sourcefile, {sourcekind = sourcekind, progress = opt.progress})
end, {rootjob = rootjob, distcc = target:extraconf(scriptname, "distcc")})
end
return true
diff --git a/xmake/actions/build/kinds/shared.lua b/xmake/actions/build/kinds/shared.lua
index f4763c608..81cf0ebb5 100644
--- a/xmake/actions/build/kinds/shared.lua
+++ b/xmake/actions/build/kinds/shared.lua
@@ -156,8 +156,8 @@ end
function main(batchjobs, rootjob, target)
-- add link job
- local job_link = batchjobs:addjob(target:name() .. "/link", function (index, total)
- _link_target(target, {progress = (index * 100) / total})
+ local job_link = batchjobs:addjob(target:name() .. "/link", function (index, total, opt)
+ _link_target(target, {progress = opt.progress})
end, {rootjob = rootjob})
-- we only need to return and depend the link job for each target,
diff --git a/xmake/actions/build/kinds/static.lua b/xmake/actions/build/kinds/static.lua
index 0d75b58c6..47668770d 100644
--- a/xmake/actions/build/kinds/static.lua
+++ b/xmake/actions/build/kinds/static.lua
@@ -156,8 +156,8 @@ end
function main(batchjobs, rootjob, target)
-- add link job
- local job_link = batchjobs:addjob(target:name() .. "/link", function (index, total)
- _link_target(target, {progress = (index * 100) / total})
+ local job_link = batchjobs:addjob(target:name() .. "/link", function (index, total, opt)
+ _link_target(target, {progress = opt.progress})
end, {rootjob = rootjob})
-- we only need to return and depend the link job for each target,
diff --git a/xmake/modules/async/runjobs.lua b/xmake/modules/async/runjobs.lua
index 476efe08f..299b868df 100644
--- a/xmake/modules/async/runjobs.lua
+++ b/xmake/modules/async/runjobs.lua
@@ -40,12 +40,12 @@ end
-- runjobs("test", function () os.sleep(10000) end, { progress = { chars = {'/','\'} } }) -- see module utils.progress
--
-- local jobs = jobpool.new()
--- local root = jobs:addjob("job/root", function (index, total)
--- print(index, total)
+-- local root = jobs:addjob("job/root", function (index, total, opt)
+-- print(index, total, opt.progress)
-- end)
-- for i = 1, 3 do
--- local job = jobs:addjob("job/" .. i, function (index, total)
--- print(index, total)
+-- local job = jobs:addjob("job/" .. i, function (index, total, opt)
+-- print(index, total, opt.progress)
-- end, {rootjob = root})
-- end
-- runjobs("test", jobs, {comax = 6, timeout = 1000, on_timer = function (running_jobs_indices) end})
@@ -252,8 +252,8 @@ function main(name, jobs, opt)
if opt.curdir then
os.cd(opt.curdir)
end
- jobfunc(i, total, {progress = progress_wrapper})
count = count + 1
+ jobfunc(i, total, {progress = progress_wrapper})
end
running_jobs_indices[i] = nil
end,
diff --git a/xmake/modules/private/action/build/object.lua b/xmake/modules/private/action/build/object.lua
index 486c2e7ce..c4c646cba 100644
--- a/xmake/modules/private/action/build/object.lua
+++ b/xmake/modules/private/action/build/object.lua
@@ -142,8 +142,8 @@ function main(target, batchjobs, sourcebatch, opt)
local objectfile = sourcebatch.objectfiles[i]
local dependfile = sourcebatch.dependfiles[i]
local sourcekind = assert(sourcebatch.sourcekind, "%s: sourcekind not found!", sourcefile)
- batchjobs:addjob(sourcefile, function (index, total)
- local build_opt = table.join({objectfile = objectfile, dependfile = dependfile, sourcekind = sourcekind, progress = (index * 100) / total}, opt)
+ batchjobs:addjob(sourcefile, function (index, total, jobopt)
+ local build_opt = table.join({objectfile = objectfile, dependfile = dependfile, sourcekind = sourcekind, progress = jobopt.progress}, opt)
build_object(target, sourcefile, build_opt)
end, {rootjob = rootjob, distcc = opt.distcc})
end
diff --git a/xmake/modules/private/async/buildjobs.lua b/xmake/modules/private/async/buildjobs.lua
index d19335167..dc2e736f3 100644
--- a/xmake/modules/private/async/buildjobs.lua
+++ b/xmake/modules/private/async/buildjobs.lua
@@ -51,7 +51,7 @@ end
nodes["node1"] = {
name = "node1",
deps = {"node2", "node3"},
- job = batchjobs:newjob("/job/node1", function(index, total)
+ job = batchjobs:newjob("/job/node1", function(index, total, opt)
end)
}
--]]
diff --git a/xmake/modules/utils/progress.lua b/xmake/modules/utils/progress.lua
index 2655f0701..aefaef1af 100644
--- a/xmake/modules/utils/progress.lua
+++ b/xmake/modules/utils/progress.lua
@@ -75,7 +75,7 @@ end
-- show the message with progress
function show(progress, format, ...)
- progress = math.floor(progress)
+ progress = type(progress) == "table" and progress:percent() or math.floor(progress)
local progress_prefix = "${color.build.progress}" .. theme.get("text.build.progress_format") .. ":${clear} "
if option.get("verbose") then
cprint(progress_prefix .. "${dim}" .. format, progress, ...)
@@ -114,7 +114,7 @@ end
-- get the message text with progress
function text(progress, format, ...)
- progress = math.floor(progress)
+ progress = type(progress) == "table" and progress:percent() or math.floor(progress)
local progress_prefix = "${color.build.progress}" .. theme.get("text.build.progress_format") .. ":${clear} "
if option.get("verbose") then
return string.format(progress_prefix .. "${dim}" .. format, progress, ...)
diff --git a/xmake/rules/c++/modules/modules_support/clang/builder.lua b/xmake/rules/c++/modules/modules_support/clang/builder.lua
index 6c36feff6..f0b853b87 100644
--- a/xmake/rules/c++/modules/modules_support/clang/builder.lua
+++ b/xmake/rules/c++/modules/modules_support/clang/builder.lua
@@ -204,7 +204,7 @@ function make_module_buildjobs(target, batchjobs, job_name, deps, opt)
name = job_name,
deps = table.join(target:name() .. "_populate_module_map", deps),
sourcefile = opt.cppfile,
- job = batchjobs:newjob(name or opt.cppfile, function(index, total)
+ job = batchjobs:newjob(name or opt.cppfile, function(index, total, jobopt)
local mapped_bmi
if provide and compiler_support.memcache():get2(target:name() .. name, "reuse") then
if not target:is_binary() then
@@ -252,18 +252,18 @@ function make_module_buildjobs(target, batchjobs, job_name, deps, opt)
local bmifile = mapped_bmi or bmifile
if target:is_binary() then
if mapped_bmi then
- progress.show((index * 100) / total, "${color.build.target}<%s> ${clear}${color.build.object}compiling.objectfile.$(mode) %s", target:name(), name or opt.cppfile)
+ progress.show(jobopt.progress, "${color.build.target}<%s> ${clear}${color.build.object}compiling.objectfile.$(mode) %s", target:name(), name or opt.cppfile)
_compile_objectfile_step(target, bmifile, opt.cppfile, opt.objectfile)
else
- progress.show((index * 100) / total, "${color.build.target}<%s> ${clear}${color.build.object}compiling.module.$(mode) %s", target:name(), name or opt.cppfile)
+ progress.show(jobopt.progress, "${color.build.target}<%s> ${clear}${color.build.object}compiling.module.$(mode) %s", target:name(), name or opt.cppfile)
_compile_one_step(target, bmifile, opt.cppfile, opt.objectfile, {std = (name == "std" or name == "std.compat")})
end
else
if (not public and not external) or (external and private_dep) then
- progress.show((index * 100) / total, "${color.build.target}<%s> ${clear}${color.build.object}compiling.module.$(mode) %s", target:name(), name or opt.cppfile)
+ progress.show(jobopt.progress, "${color.build.target}<%s> ${clear}${color.build.object}compiling.module.$(mode) %s", target:name(), name or opt.cppfile)
_compile_one_step(target, bmifile, opt.cppfile, opt.objectfile, {std = (name == "std" or name == "std.compat")})
else
- progress.show((index * 100) / total, "${color.build.target}<%s> ${clear}${color.build.object}compiling.bmi.$(mode) %s", target:name(), name or opt.cppfile)
+ progress.show(jobopt.progress, "${color.build.target}<%s> ${clear}${color.build.object}compiling.bmi.$(mode) %s", target:name(), name or opt.cppfile)
_compile_bmi_step(target, bmifile, opt.cppfile, {std = (name == "std" or name == "std.compat")})
end
end
@@ -352,7 +352,7 @@ function make_headerunit_buildjobs(target, job_name, batchjobs, headerunit, bmif
return {
name = job_name,
sourcefile = headerunit.path,
- job = batchjobs:newjob(job_name, function(index, total)
+ job = batchjobs:newjob(job_name, function(index, total, jobopt)
if not os.isdir(outputdir) then
os.mkdir(outputdir)
end
@@ -366,7 +366,7 @@ function make_headerunit_buildjobs(target, job_name, batchjobs, headerunit, bmif
local depvalues = {compinst:program(), compflags}
if opt.build then
- progress.show((index * 100) / total, "${color.build.target}<%s> ${clear}${color.build.object}compiling.headerunit.$(mode) %s", target:name(), headerunit.name)
+ progress.show(jobopt.progress, "${color.build.target}<%s> ${clear}${color.build.object}compiling.headerunit.$(mode) %s", target:name(), headerunit.name)
_compile(target, _make_headerunitflags(target, headerunit, bmifile), headerunit.path, bmifile)
end
diff --git a/xmake/rules/c++/modules/modules_support/gcc/builder.lua b/xmake/rules/c++/modules/modules_support/gcc/builder.lua
index 0c9b8c1b1..e2d6f95c5 100644
--- a/xmake/rules/c++/modules/modules_support/gcc/builder.lua
+++ b/xmake/rules/c++/modules/modules_support/gcc/builder.lua
@@ -183,7 +183,7 @@ function make_module_buildjobs(target, batchjobs, job_name, deps, opt)
name = job_name,
deps = table.join(target:name() .. "_populate_module_map", deps),
sourcefile = opt.cppfile,
- job = batchjobs:newjob(name or opt.cppfile, function(index, total)
+ job = batchjobs:newjob(name or opt.cppfile, function(index, total, jobopt)
local mapped_bmi
if provide and compiler_support.memcache():get2(target:name() .. name, "reuse") then
if not target:is_binary() then
@@ -220,18 +220,18 @@ function make_module_buildjobs(target, batchjobs, job_name, deps, opt)
local sourcefile
if target:is_binary() then
if mapped_bmi then
- progress.show((index * 100) / total, "${color.build.target}<%s> ${clear}${color.build.object}compiling.objectfile.$(mode) %s", target:name(), name or opt.cppfile)
+ progress.show(jobopt.progress, "${color.build.target}<%s> ${clear}${color.build.object}compiling.objectfile.$(mode) %s", target:name(), name or opt.cppfile)
sourcefile = bmifile
else
- progress.show((index * 100) / total, "${color.build.target}<%s> ${clear}${color.build.object}compiling.module.$(mode) %s", target:name(), name or opt.cppfile)
+ progress.show(jobopt.progress, "${color.build.target}<%s> ${clear}${color.build.object}compiling.module.$(mode) %s", target:name(), name or opt.cppfile)
sourcefile = opt.cppfile
end
else
if (not public and not external) or (external and private_dep) then
- progress.show((index * 100) / total, "${color.build.target}<%s> ${clear}${color.build.object}compiling.module.$(mode) %s", target:name(), name or opt.cppfile)
+ progress.show(jobopt.progress, "${color.build.target}<%s> ${clear}${color.build.object}compiling.module.$(mode) %s", target:name(), name or opt.cppfile)
sourcefile = opt.cppfile
else
- progress.show((index * 100) / total, "${color.build.target}<%s> ${clear}${color.build.object}compiling.bmi.$(mode) %s", target:name(), name or opt.cppfile)
+ progress.show(jobopt.progress, "${color.build.target}<%s> ${clear}${color.build.object}compiling.bmi.$(mode) %s", target:name(), name or opt.cppfile)
local module_onlyflag = compiler_support.get_moduleonlyflag(target)
table.insert(flags, module_onlyflag)
sourcefile = opt.cppfile
@@ -333,7 +333,7 @@ function make_headerunit_buildjobs(target, job_name, batchjobs, headerunit, bmif
return {
name = job_name,
sourcefile = headerunit.path,
- job = batchjobs:newjob(job_name, function(index, total)
+ job = batchjobs:newjob(job_name, function(index, total, jobopt)
if not os.isdir(outputdir) then
os.mkdir(outputdir)
end
@@ -348,7 +348,7 @@ function make_headerunit_buildjobs(target, job_name, batchjobs, headerunit, bmif
if opt.build then
local headerunit_mapper = _generate_headerunit_modulemapper_file({name = path.normalize(headerunit.path), bmifile = bmifile})
- progress.show((index * 100) / total, "${color.build.target}<%s> ${clear}${color.build.object}compiling.headerunit.$(mode) %s", target:name(), headerunit.name)
+ progress.show(jobopt.progress, "${color.build.target}<%s> ${clear}${color.build.object}compiling.headerunit.$(mode) %s", target:name(), headerunit.name)
if option.get("diagnosis") then
print("mapper file:\n%s", io.readfile(headerunit_mapper))
end
diff --git a/xmake/rules/c++/modules/modules_support/msvc/builder.lua b/xmake/rules/c++/modules/modules_support/msvc/builder.lua
index a46dae34a..5a67df409 100644
--- a/xmake/rules/c++/modules/modules_support/msvc/builder.lua
+++ b/xmake/rules/c++/modules/modules_support/msvc/builder.lua
@@ -267,7 +267,7 @@ function make_module_buildjobs(target, batchjobs, job_name, deps, opt)
name = job_name,
deps = table.join(target:name() .. "_populate_module_map", deps),
sourcefile = opt.cppfile,
- job = batchjobs:newjob(name or opt.cppfile, function(index, total)
+ job = batchjobs:newjob(name or opt.cppfile, function(index, total, jobopt)
local mapped_bmi
if provide and compiler_support.memcache():get2(target:name() .. name, "reuse") then
@@ -316,18 +316,18 @@ function make_module_buildjobs(target, batchjobs, job_name, deps, opt)
local bmifile = mapped_bmi or bmifile
if target:is_binary() then
if mapped_bmi then
- progress.show((index * 100) / total, "${color.build.target}<%s> ${clear}${color.build.object}compiling.objectfile.$(mode) %s", target:name(), name or opt.cppfile)
+ progress.show(jobopt.progress, "${color.build.target}<%s> ${clear}${color.build.object}compiling.objectfile.$(mode) %s", target:name(), name or opt.cppfile)
_compile_objectfile_step(target, bmifile, opt.cppfile, opt.objectfile, provide)
else
- progress.show((index * 100) / total, "${color.build.target}<%s> ${clear}${color.build.object}compiling.module.$(mode) %s", target:name(), name or opt.cppfile)
+ progress.show(jobopt.progress, "${color.build.target}<%s> ${clear}${color.build.object}compiling.module.$(mode) %s", target:name(), name or opt.cppfile)
_compile_one_step(target, bmifile, opt.cppfile, opt.objectfile, provide)
end
else
if (not public and not external) or (external and private_dep) then
- progress.show((index * 100) / total, "${color.build.target}<%s> ${clear}${color.build.object}compiling.module.$(mode) %s", target:name(), name or opt.cppfile)
+ progress.show(jobopt.progress, "${color.build.target}<%s> ${clear}${color.build.object}compiling.module.$(mode) %s", target:name(), name or opt.cppfile)
_compile_one_step(target, bmifile, opt.cppfile, opt.objectfile, provide)
else
- progress.show((index * 100) / total, "${color.build.target}<%s> ${clear}${color.build.object}compiling.bmi.$(mode) %s", target:name(), name or opt.cppfile)
+ progress.show(jobopt.progress, "${color.build.target}<%s> ${clear}${color.build.object}compiling.bmi.$(mode) %s", target:name(), name or opt.cppfile)
_compile_bmi_step(target, bmifile, opt.cppfile, opt.objectfile, provide)
end
end
@@ -416,7 +416,7 @@ function make_headerunit_buildjobs(target, job_name, batchjobs, headerunit, bmif
return {
name = job_name,
sourcefile = headerunit.path,
- job = batchjobs:newjob(job_name, function(index, total)
+ job = batchjobs:newjob(job_name, function(index, total, jobopt)
if not os.isdir(outputdir) then
os.mkdir(outputdir)
end
@@ -432,7 +432,7 @@ function make_headerunit_buildjobs(target, job_name, batchjobs, headerunit, bmif
local name = headerunit.unique and headerunit.name or headerunit.path
if opt.build then
- progress.show((index * 100) / total, "${color.build.target}<%s> ${clear}${color.build.object}compiling.headerunit.$(mode) %s", target:name(), headerunit.name)
+ progress.show(jobopt.progress, "${color.build.target}<%s> ${clear}${color.build.object}compiling.headerunit.$(mode) %s", target:name(), headerunit.name)
_compile(target, _make_headerunitflags(target, headerunit, bmifile), name, target:objectfile(headerunit.path), true)
end
diff --git a/xmake/rules/protobuf/proto.lua b/xmake/rules/protobuf/proto.lua
index 0be0cbb96..91dc4c727 100644
--- a/xmake/rules/protobuf/proto.lua
+++ b/xmake/rules/protobuf/proto.lua
@@ -294,9 +294,9 @@ function build_cxfiles(target, batchjobs, sourcebatch, opt, sourcekind)
local nodename = node_rulename .. "/" .. sourcefile_proto
nodes[nodename] = {
name = nodename,
- job = batchjobs:addjob(nodename, function(index, total)
+ job = batchjobs:addjob(nodename, function(index, total, jobopt)
local batchcmds_ = batchcmds.new({target = target})
- buildcmd_pfiles(target, batchcmds_, sourcefile_proto, {progress = (index * 100) / total}, sourcekind)
+ buildcmd_pfiles(target, batchcmds_, sourcefile_proto, {progress = jobopt.progress}, sourcekind)
batchcmds_:runcmds({changed = target:is_rebuilt(), dryrun = option.get("dry-run")})
end)
}