Skip to content

Commit

Permalink
don't convert hashset to table and some cleanup for module builders
Browse files Browse the repository at this point in the history
  • Loading branch information
Arthapz committed Oct 7, 2024
1 parent 03f7c11 commit e589a60
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
13 changes: 5 additions & 8 deletions xmake/rules/c++/modules/modules_support/builder.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -488,5 +485,5 @@ function is_dependencies_changed(target, module)
end
end

return requires:to_array(), changed
return requires, changed
end
2 changes: 1 addition & 1 deletion xmake/rules/c++/modules/modules_support/clang/builder.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
3 changes: 1 addition & 2 deletions xmake/rules/c++/modules/modules_support/msvc/builder.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e589a60

Please sign in to comment.