diff options
| author | ruki <[email protected]> | 2025-08-06 10:22:26 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-08-06 10:22:26 +0800 |
| commit | 9483bc6bab728fc71debdfb08f874a2234f2d665 (patch) | |
| tree | 4944ef2b35ad46fcce4905606f604f1f8c64d0ca /xmake/core/sandbox/modules | |
| parent | c6383c7675cfcca1d973be0e416d2668d887ceb8 (diff) | |
Revert "improve to config targets"
Diffstat (limited to 'xmake/core/sandbox/modules')
| -rw-r--r-- | xmake/core/sandbox/modules/import/core/project/project.lua | 55 |
1 files changed, 51 insertions, 4 deletions
diff --git a/xmake/core/sandbox/modules/import/core/project/project.lua b/xmake/core/sandbox/modules/import/core/project/project.lua index ae185dc2c..70f135706 100644 --- a/xmake/core/sandbox/modules/import/core/project/project.lua +++ b/xmake/core/sandbox/modules/import/core/project/project.lua @@ -126,7 +126,51 @@ function sandbox_core_project.check_options() end end --- config targets +-- config target +function sandbox_core_project._config_target(target, opt) + + -- enter the environments of the target packages + local oldenvs = os.addenvs(target:pkgenvs()) + + -- do config + local before_config = target:script("config_before") + if before_config then + before_config(target, opt) + end + 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) + end + end + local on_config = target:script("config") + 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 + local config_after = target:script("config_after") + if config_after then + config_after(target, opt) + end + + -- leave the environments of the target packages + os.setenvs(oldenvs) +end + +-- config targets, TODO: We should support parallel configuration -- -- @param opt the extra option, e.g. {recheck = false} -- @@ -138,9 +182,12 @@ end -- end -- function sandbox_core_project._config_targets(opt) - import("private.action.build.target", {alias = "target_buildutils"}) - local targets_root = target_buildutils.get_root_targets() - target_buildutils.run_targetjobs(targets_root, {job_kind = "config", job_opt = opt}) + opt = opt or {} + for _, target in ipairs(table.wrap(project.ordertargets())) do + if target:is_enabled() then + sandbox_core_project._config_target(target, opt) + end + end end -- load rules in the required packages for target |
