summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2023-09-11 22:49:38 +0800
committerruki <[email protected]>2023-09-11 22:49:38 +0800
commit17b467d17875eb1fcc45522852a1bbe8a446028f (patch)
treefbb403b880bd39cee4aed221f28c5d936c81cc85
parent53383cc8a09235f148b99f45c20c29bcc7873977 (diff)
add recheck argument to on_config
-rw-r--r--xmake/actions/config/main.lua2
-rw-r--r--xmake/core/sandbox/modules/import/core/project/project.lua23
2 files changed, 17 insertions, 8 deletions
diff --git a/xmake/actions/config/main.lua b/xmake/actions/config/main.lua
index ec8964313..6b3bf8c60 100644
--- a/xmake/actions/config/main.lua
+++ b/xmake/actions/config/main.lua
@@ -399,7 +399,7 @@ force to build in current directory via run `xmake -P .`]], os.projectdir())
end
-- load targets
- project.load_targets()
+ project.load_targets({recheck = recheck})
-- update the config files
generate_configfiles({force = recheck})
diff --git a/xmake/core/sandbox/modules/import/core/project/project.lua b/xmake/core/sandbox/modules/import/core/project/project.lua
index f43590bb3..5573de619 100644
--- a/xmake/core/sandbox/modules/import/core/project/project.lua
+++ b/xmake/core/sandbox/modules/import/core/project/project.lua
@@ -125,24 +125,33 @@ function sandbox_core_project.check_options()
end
-- config target
-function sandbox_core_project._config_target(target)
+function sandbox_core_project._config_target(target, opt)
for _, rule in ipairs(table.wrap(target:orderules())) do
local on_config = rule:script("config")
if on_config then
- on_config(target)
+ on_config(target, opt)
end
end
local on_config = target:script("config")
if on_config then
- on_config(target)
+ on_config(target, opt)
end
end
-- config targets
-function sandbox_core_project._config_targets()
+--
+-- @param opt the extra option, e.g. {recheck = false}
+--
+-- on_config(target, opt)
+-- if opt.recheck then
+-- target:has_cfuncs(...)
+-- end
+-- end
+--
+function sandbox_core_project._config_targets(opt)
for _, target in ipairs(table.wrap(project.ordertargets())) do
if target:is_enabled() then
- sandbox_core_project._config_target(target)
+ sandbox_core_project._config_target(target, opt)
end
end
end
@@ -187,13 +196,13 @@ function sandbox_core_project._load_package_rules_for_targets()
end
-- load project targets
-function sandbox_core_project.load_targets()
+function sandbox_core_project.load_targets(opt)
-- load package rules for targets
sandbox_core_project._load_package_rules_for_targets()
-- config targets
- sandbox_core_project._config_targets()
+ sandbox_core_project._config_targets(opt)
end
-- get the filelock of the whole project directory