From e45e3bd4c5255ad0ac88a9e9c593d427a9019f90 Mon Sep 17 00:00:00 2001 From: ruki Date: Tue, 12 Nov 2024 22:56:57 +0800 Subject: [PATCH] add after_config #5791 --- xmake/core/project/rule.lua | 2 ++ .../modules/import/core/project/project.lua | 14 ++++++++++++++ xmake/rules/utils/inherit_links/xmake.lua | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/xmake/core/project/rule.lua b/xmake/core/project/rule.lua index 8bf4e1b39d2..75da4da39d2 100644 --- a/xmake/core/project/rule.lua +++ b/xmake/core/project/rule.lua @@ -289,6 +289,7 @@ function rule.apis() , "rule.before_run" , "rule.before_test" , "rule.before_load" + , "rule.before_config" , "rule.before_link" , "rule.before_build" , "rule.before_build_file" @@ -307,6 +308,7 @@ function rule.apis() , "rule.after_run" , "rule.after_test" , "rule.after_load" + , "rule.after_config" , "rule.after_link" , "rule.after_build" , "rule.after_build_file" diff --git a/xmake/core/sandbox/modules/import/core/project/project.lua b/xmake/core/sandbox/modules/import/core/project/project.lua index c5f54dc0522..bada906d4db 100644 --- a/xmake/core/sandbox/modules/import/core/project/project.lua +++ b/xmake/core/sandbox/modules/import/core/project/project.lua @@ -127,6 +127,13 @@ end -- config target function sandbox_core_project._config_target(target, opt) + for _, rule in ipairs(table.wrap(target:orderules())) do + local before_config = rule:script("config_before") + if before_config then + before_config(target, opt) + end + end + for _, rule in ipairs(table.wrap(target:orderules())) do local on_config = rule:script("config") if on_config then @@ -137,6 +144,13 @@ function sandbox_core_project._config_target(target, opt) if on_config then on_config(target, opt) end + + for _, rule in ipairs(table.wrap(target:orderules())) do + local after_config = rule:script("config_after") + if after_config then + after_config(target, opt) + end + end end -- config targets diff --git a/xmake/rules/utils/inherit_links/xmake.lua b/xmake/rules/utils/inherit_links/xmake.lua index a6b13a9df66..213c7c4664a 100644 --- a/xmake/rules/utils/inherit_links/xmake.lua +++ b/xmake/rules/utils/inherit_links/xmake.lua @@ -20,5 +20,5 @@ -- define rule: utils.inherit.links rule("utils.inherit.links") - on_config("inherit_links") + after_config("inherit_links")