summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2024-05-05 19:05:25 +0800
committerruki <[email protected]>2024-05-05 19:05:25 +0800
commit4463ddbfdf57b712a577c63a4e4276117e0cdc31 (patch)
treed77f0417d32bde011b1ce7245d24cb21de5d42cf
parent57a6b50a9ff4b87360b0147fab067ee806ebf587 (diff)
improve to sort instances
-rw-r--r--xmake/core/base/private/instance_deps.lua30
1 files changed, 15 insertions, 15 deletions
diff --git a/xmake/core/base/private/instance_deps.lua b/xmake/core/base/private/instance_deps.lua
index 2f5c52a7c..02634695b 100644
--- a/xmake/core/base/private/instance_deps.lua
+++ b/xmake/core/base/private/instance_deps.lua
@@ -75,25 +75,25 @@ end
-- sort the given instance with deps
function instance_deps._sort_instance(instance, instances, orderinstances, instancerefs, depspath)
- for _, depname in ipairs(table.wrap(instance:get("deps"))) do
- local depinst = instances[depname]
- if depinst then
- local depspath_sub
- if depspath then
- for idx, name in ipairs(depspath) do
- if name == depname then
- local circular_deps = table.slice(depspath, idx)
- table.insert(circular_deps, depname)
- os.raise("circular dependency(%s) detected!", table.concat(circular_deps, ", "))
+ if not instancerefs[instance:name()] then
+ instancerefs[instance:name()] = true
+ for _, depname in ipairs(table.wrap(instance:get("deps"))) do
+ local depinst = instances[depname]
+ if depinst then
+ local depspath_sub
+ if depspath then
+ for idx, name in ipairs(depspath) do
+ if name == depname then
+ local circular_deps = table.slice(depspath, idx)
+ table.insert(circular_deps, depname)
+ os.raise("circular dependency(%s) detected!", table.concat(circular_deps, ", "))
+ end
end
+ depspath_sub = table.join(depspath, depname)
end
- depspath_sub = table.join(depspath, depname)
+ instance_deps._sort_instance(depinst, instances, orderinstances, instancerefs, depspath_sub)
end
- instance_deps._sort_instance(depinst, instances, orderinstances, instancerefs, depspath_sub)
end
- end
- if not instancerefs[instance:name()] then
- instancerefs[instance:name()] = true
table.insert(orderinstances, instance)
end
end