diff options
| author | ruki <[email protected]> | 2025-03-20 22:39:52 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2025-04-08 15:31:54 +0800 |
| commit | 8954ac2acaf229a1007b37f4caadfb10a9d78fa4 (patch) | |
| tree | 0fb2e2f9c5bb62d334deacbb98ef33ac72fe5902 | |
| parent | 2277ac87ba989b2b4004c07627235b48760579cc (diff) | |
check cirular dependencies
| -rw-r--r-- | xmake/modules/async/jobgraph.lua | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/xmake/modules/async/jobgraph.lua b/xmake/modules/async/jobgraph.lua index bfeee3863..31a041911 100644 --- a/xmake/modules/async/jobgraph.lua +++ b/xmake/modules/async/jobgraph.lua @@ -32,8 +32,20 @@ function jobqueue:_build() local graph = self._jobgraph local dag = graph._dag local queue = self._queue + + -- check circular dependencies + local cycle = dag:find_cycle() + if cycle then + local names = {} + for _, job in ipairs(cycle) do + table.insert(names, job.name) + end + table.insert(names, names[1]) + raise("%s: circular job dependency detected!\n%s", graph, table.concat(names, "\n -> ")) + end + + -- build job queue queue:clear() - -- TODO find cycle for _, job in ipairs(dag:topological_sort()) do print("build job", job.name) queue:insert(job) |
