diff options
| author | ruki <[email protected]> | 2020-03-16 23:46:09 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2020-03-16 16:36:56 +0800 |
| commit | 9669ee1d0a0aaa19e5e63c9fd94eb3a9e49ac965 (patch) | |
| tree | 22fceb54519a5b133af12047200f1cdbefa0c4be | |
| parent | eab12862d905574ada90a75af8ccf246be152ea4 (diff) | |
add dump_buildjobs
| -rw-r--r-- | xmake/actions/build/build.lua | 6 | ||||
| -rw-r--r-- | xmake/modules/private/async/jobpool.lua | 12 | ||||
| -rw-r--r-- | xmake/modules/private/diagnosis/dump_buildjobs.lua | 30 |
3 files changed, 39 insertions, 9 deletions
diff --git a/xmake/actions/build/build.lua b/xmake/actions/build/build.lua index 58657981a..f079fc99a 100644 --- a/xmake/actions/build/build.lua +++ b/xmake/actions/build/build.lua @@ -170,8 +170,8 @@ function _add_batchjobs_for_target_and_deps(batchjobs, rootjob, inserted, target end end --- get batch jobs -function _get_batchjobs(targetname) +-- get batch jobs, @note we need export it for private.diagnosis.dump_buildjobs +function get_batchjobs(targetname) -- get root targets local targets_root = {} @@ -209,7 +209,7 @@ end function main(targetname) -- build all jobs - local batchjobs = _get_batchjobs(targetname) + local batchjobs = get_batchjobs(targetname) if batchjobs and batchjobs:size() > 0 then environment.enter("toolchains") runjobs("build", batchjobs, {comax = option.get("jobs") or 1}) diff --git a/xmake/modules/private/async/jobpool.lua b/xmake/modules/private/async/jobpool.lua index 9df167598..702d1aa89 100644 --- a/xmake/modules/private/async/jobpool.lua +++ b/xmake/modules/private/async/jobpool.lua @@ -21,6 +21,7 @@ -- imports import("core.base.dlist") import("core.base.object") +import("core.base.hashset") -- define module local jobpool = jobpool or object {_init = {"_size", "_rootjob", "_leafjobs"}} @@ -170,17 +171,16 @@ function jobpool:_gentree(job, groups) end end -- strip tree - local smalltree = {} + local smalltree = hashset.new() for _, item in ipairs(tree) do item = table.unwrap(item) - if #smalltree < 16 or type(item) == "table" then - table.insert(smalltree, item) + if smalltree:size() < 16 or type(item) == "table" then + smalltree:insert(item) else - table.insert(smalltree, "...") - break + smalltree:insert("...") end end - return smalltree + return smalltree:to_array() end -- tostring diff --git a/xmake/modules/private/diagnosis/dump_buildjobs.lua b/xmake/modules/private/diagnosis/dump_buildjobs.lua new file mode 100644 index 000000000..01ba42d7b --- /dev/null +++ b/xmake/modules/private/diagnosis/dump_buildjobs.lua @@ -0,0 +1,30 @@ +--!A cross-platform build utility based on Lua +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- +-- Copyright (C) 2015-2020, TBOOX Open Source Group. +-- +-- @author ruki +-- @file object.lua +-- + +-- imports +import("core.project.config") +import("actions.build.build", {rootdir = os.programdir()}) + +-- dump the build jobs, e.g. xmake l private.diagnosis.dump_buildjobs [targetname] +function main(targetname) + config.load() + print(build.get_batchjobs(targetname)) +end + |
