summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2024-11-12 15:42:06 +0800
committerGitHub <[email protected]>2024-11-12 15:42:06 +0800
commit780c035f5b9af181d3f8e7f4a77f35b9ac52d458 (patch)
tree0028f864b9e72acc82405c58a0c5ea9b8684a997
parentbfaaf9c4dd380e88be0e45e520534248f7be4859 (diff)
parente45e3bd4c5255ad0ac88a9e9c593d427a9019f90 (diff)
Merge pull request #5813 from xmake-io/config
add before/after_config #5791
-rw-r--r--xmake/core/project/rule.lua2
-rw-r--r--xmake/core/sandbox/modules/import/core/project/project.lua14
-rw-r--r--xmake/rules/utils/inherit_links/xmake.lua2
3 files changed, 17 insertions, 1 deletions
diff --git a/xmake/core/project/rule.lua b/xmake/core/project/rule.lua
index 8bf4e1b39..75da4da39 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 c5f54dc05..bada906d4 100644
--- a/xmake/core/sandbox/modules/import/core/project/project.lua
+++ b/xmake/core/sandbox/modules/import/core/project/project.lua
@@ -128,6 +128,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
on_config(target, opt)
@@ -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 a6b13a9df..213c7c466 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")