From 755d6cb62335f9b3a3cecf0830138886e9510f8a Mon Sep 17 00:00:00 2001 From: ruki Date: Thu, 25 Feb 2021 00:46:40 +0800 Subject: fix depend order for package --- xmake/core/package/package.lua | 6 +++--- xmake/modules/private/action/require/impl/package.lua | 10 +++++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua index ebb8c795c..d5dc5a3b2 100644 --- a/xmake/core/package/package.lua +++ b/xmake/core/package/package.lua @@ -838,9 +838,9 @@ function _instance:buildhash() end end if not sourcehashs:empty() then - for _, sourcehash in sourcehashs:keys() do - str = str .. "_" .. sourcehash - end + local hashs = sourcehashs:to_array() + table.sort(hashs) + str = str .. "_" .. table.concat(hashs, "_") end end return hash.uuid4(str):gsub('-', ''):lower() diff --git a/xmake/modules/private/action/require/impl/package.lua b/xmake/modules/private/action/require/impl/package.lua index 9d2c87bc4..3095e10a9 100644 --- a/xmake/modules/private/action/require/impl/package.lua +++ b/xmake/modules/private/action/require/impl/package.lua @@ -196,9 +196,13 @@ end -- function _sort_packagedeps(package) local orderdeps = {} - for _, dep in pairs(package:deps()) do - table.join2(orderdeps, _sort_packagedeps(dep)) - table.insert(orderdeps, dep) + local deps = package:deps() + if deps then + for _, depname in ipairs(table.orderkeys(deps)) do + local dep = deps[depname] + table.join2(orderdeps, _sort_packagedeps(dep)) + table.insert(orderdeps, dep) + end end return orderdeps end -- cgit v1.3.1