Skip to content

Commit

Permalink
add after_config #5791
Browse files Browse the repository at this point in the history
  • Loading branch information
waruqi committed Nov 12, 2024
1 parent bfaaf9c commit e45e3bd
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
2 changes: 2 additions & 0 deletions xmake/core/project/rule.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down
14 changes: 14 additions & 0 deletions xmake/core/sandbox/modules/import/core/project/project.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion xmake/rules/utils/inherit_links/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@

-- define rule: utils.inherit.links
rule("utils.inherit.links")
on_config("inherit_links")
after_config("inherit_links")

0 comments on commit e45e3bd

Please # to comment.