diff --git a/xmake/rules/c++/modules/modules_support/builder.lua b/xmake/rules/c++/modules/modules_support/builder.lua index 9133bad604..7e51ad6f89 100644 --- a/xmake/rules/c++/modules/modules_support/builder.lua +++ b/xmake/rules/c++/modules/modules_support/builder.lua @@ -465,21 +465,18 @@ end function is_dependencies_changed(target, module) local cachekey = target:name() .. module.name - local requires + local requires = hashset.new() for required, _ in table.orderpairs(module.requires) do - requires = requires or hashset.new() requires:insert(required) end local oldrequires = compiler_support.memcache():get2(cachekey, "oldrequires") - local changed = false - if oldrequires and requires then - oldrequires = hashset.from(oldrequires) - if oldrequires:size() ~= requires:size() then + if oldrequires then + if oldrequires ~= requires:size() then requires_changed = true else - for required in requires:keys() do + for _, required in requires:keys() do if not oldrequires:has(required) then requires_changed = true break @@ -488,5 +485,5 @@ function is_dependencies_changed(target, module) end end - return requires:to_array(), changed + return requires, changed end diff --git a/xmake/rules/c++/modules/modules_support/clang/builder.lua b/xmake/rules/c++/modules/modules_support/clang/builder.lua index 2ad97a9436..ad30aa158d 100644 --- a/xmake/rules/c++/modules/modules_support/clang/builder.lua +++ b/xmake/rules/c++/modules/modules_support/clang/builder.lua @@ -126,7 +126,7 @@ function _get_requiresflags(target, module, opt) local requiresflags = compiler_support.memcache():get2(cachekey, "requiresflags") if not requiresflags or requires_changed then requiresflags = {} - for required, _ in table.orderpairs(module.requires) do + for required, _ in requires:orderkeys() do local dep_module = get_from_target_mapper(target, required) assert(dep_module, "module dependency %s required for %s not found", required, name) diff --git a/xmake/rules/c++/modules/modules_support/msvc/builder.lua b/xmake/rules/c++/modules/modules_support/msvc/builder.lua index de4f97bd41..bb7090cb49 100644 --- a/xmake/rules/c++/modules/modules_support/msvc/builder.lua +++ b/xmake/rules/c++/modules/modules_support/msvc/builder.lua @@ -173,9 +173,8 @@ function _get_requiresflags(target, module, opt) local requiresflags = compiler_support.memcache():get2(cachekey, "requiresflags") if not requiresflags or requires_changed then local deps_flags = {} - for required, _ in table.orderpairs(module.requires) do + for required, _ in requires:orderkeys() do local dep_module = get_from_target_mapper(target, required) - assert(dep_module, "module dependency %s required for %s not found <%s>", required, name, target:name()) local mapflag