diff options
| author | ruki <[email protected]> | 2025-04-09 00:45:04 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2025-04-09 00:45:04 +0800 |
| commit | 117ae687a27f34cf183e967e8688eb3d7e8e4f81 (patch) | |
| tree | 7fc96ddd9e8bc734579522fda94a22e436eebe2e | |
| parent | bd6f305cd44634dd9829407d01749ae150a7b2d8 (diff) | |
compatible with order deps
| -rw-r--r-- | xmake/core/project/rule.lua | 12 | ||||
| -rw-r--r-- | xmake/modules/private/action/build/target.lua | 6 | ||||
| -rw-r--r-- | xmake/modules/private/utils/rule.lua | 6 |
3 files changed, 20 insertions, 4 deletions
diff --git a/xmake/core/project/rule.lua b/xmake/core/project/rule.lua index ccab257c7..89ee45f8b 100644 --- a/xmake/core/project/rule.lua +++ b/xmake/core/project/rule.lua @@ -61,6 +61,18 @@ function _instance:_build_deps() self._DEPS = self._DEPS or {} self._ORDERDEPS = self._ORDERDEPS or {} instance_deps.load_deps(self, instances, self._DEPS, self._ORDERDEPS, {self:fullname()}) + + -- compatible with `add_deps("foo", {order = true})` + local plaindeps = self:get("deps") + if plaindeps then + for _, depname in ipairs(table.wrap(plaindeps)) do + if self:extraconf("deps", depname, "order") then + self:add("orders", depname, self:name()) + utils.warning("add_deps(%s, {order = true}) has been deprecated, please use `add_orders(%s, %s) instead of it`", + depname, depname, self:name()) + end + end + end end -- clone rule diff --git a/xmake/modules/private/action/build/target.lua b/xmake/modules/private/action/build/target.lua index b6d428692..beb6f9cb2 100644 --- a/xmake/modules/private/action/build/target.lua +++ b/xmake/modules/private/action/build/target.lua @@ -223,6 +223,7 @@ function add_targetjobs_with_stage(jobgraph, target, stage, opt) scriptcmd_name = scriptcmd_name } for _, instance in ipairs(instances) do + -- we need to use this group to sort rule scripts with add_orders local script_group = group_name .. "/" .. instance:fullname() jobgraph:group(script_group, function () if add_targetjobs_for_script(jobgraph, target, instance, script_opt) then @@ -247,7 +248,7 @@ function add_targetjobs_with_stage(jobgraph, target, stage, opt) end -- sort build rules - rule_utils.build_orders_in_jobgraph(jobgraph, instances, {root_group = group_name}) + rule_utils.build_orders_in_jobgraph(jobgraph, target, instances, {root_group = group_name}) return group_name end @@ -526,6 +527,7 @@ function add_filejobs_with_stage(jobgraph, target, sourcebatches, stage, opt) } local has_target_script = false for _, instance in ipairs(instances) do + -- we need to use this group to sort rule scripts with add_orders local script_group = group_name .. "/" .. instance:fullname() jobgraph:group(script_group, function () if instance == target then @@ -552,7 +554,7 @@ function add_filejobs_with_stage(jobgraph, target, sourcebatches, stage, opt) end -- sort build rules - rule_utils.build_orders_in_jobgraph(jobgraph, instances, {root_group = group_name}) + rule_utils.build_orders_in_jobgraph(jobgraph, target, instances, {root_group = group_name}) return group_name end diff --git a/xmake/modules/private/utils/rule.lua b/xmake/modules/private/utils/rule.lua index 531486f61..ed6aec451 100644 --- a/xmake/modules/private/utils/rule.lua +++ b/xmake/modules/private/utils/rule.lua @@ -46,7 +46,7 @@ end -- end) -- end -- -function build_orders_in_jobgraph(jobgraph, rules, opt) +function build_orders_in_jobgraph(jobgraph, target, rules, opt) opt = opt or {} local root_group = assert(opt.root_group) for _, ruleinst in ipairs(rules) do @@ -55,7 +55,9 @@ function build_orders_in_jobgraph(jobgraph, rules, opt) for _, order in ipairs(orders) do local joborders = {} for _, rulename in ipairs(order) do - local script_group = root_group .. "/" .. rulename + -- we need to use fullname to support namespace + local ruleinst = get_rule(target, rulename) + local script_group = root_group .. "/" .. ruleinst:fullname() if jobgraph:has(script_group) then table.insert(joborders, script_group) end |
