diff options
| author | ruki <[email protected]> | 2023-10-27 23:30:59 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2023-10-27 23:30:59 +0800 |
| commit | 1cb74a5009d8fbcb792aa6cc787943453cc5234a (patch) | |
| tree | edf6a757ce76bac0a19813c4a37d5eab3940fc99 | |
| parent | 22fcc094b0a56e4cbc023fc6d4726eae72e312f0 (diff) | |
fix sort links
| -rw-r--r-- | xmake/core/tool/builder.lua | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/xmake/core/tool/builder.lua b/xmake/core/tool/builder.lua index 666d263a3..cfd3d19cf 100644 --- a/xmake/core/tool/builder.lua +++ b/xmake/core/tool/builder.lua @@ -599,12 +599,24 @@ function builder:_sort_links_of_items(items, opt) end -- we need remove cycle in original links -- e.g. + -- + -- case1: -- original_deps: a -> b -> c -> d -> e -- new deps: e -> b - -- graph: a -> b -> c -> d e (remove d -> e) - -- /\ | - -- | | + -- graph: a -> b -> c -> d e (remove d -> e, add d -> nil) + -- /|\ | -- -------------- + -- + -- case2: + -- original_deps: a -> b -> c -> d -> e + -- new deps: b -> a + -- + -- --------- + -- | \|/ + -- graph: a b -> c -> d -> e (remove a -> b, add a -> c) + -- /|\ | + -- ---- + -- local function remove_cycle_in_original_deps(f, t) local k local v = t @@ -616,7 +628,11 @@ function builder:_sort_links_of_items(items, opt) end end if v == f and k ~= nil then - original_deps[k] = nil + -- break the original from node, link to next node + -- e.g. + -- case1: d -x-> e, d -> nil, k: d, f: e + -- case2: a -x-> b, a -> c, k: a, f: b + original_deps[k] = original_deps[f] end end local links_set = hashset.from(links) |
