diff options
| author | Saikari <[email protected]> | 2026-07-11 00:08:12 +0300 |
|---|---|---|
| committer | ruki <[email protected]> | 2026-07-30 10:17:31 +0800 |
| commit | a12319420f9ba033b51f48761c28c30f863312c3 (patch) | |
| tree | cbbfa2f5416d41e94d424d20a00bdfa4ee5e1cd1 | |
| parent | 6e1cb54894a5aa4dbbb75318a9927f56533e4b36 (diff) | |
fix: skip configuration for host-only plugin installation and removal
| -rw-r--r-- | xmake/modules/private/xrepo/action/install.lua | 10 | ||||
| -rw-r--r-- | xmake/modules/private/xrepo/action/remove.lua | 10 |
2 files changed, 18 insertions, 2 deletions
diff --git a/xmake/modules/private/xrepo/action/install.lua b/xmake/modules/private/xrepo/action/install.lua index 6b38bca0f..d235b7a98 100644 --- a/xmake/modules/private/xrepo/action/install.lua +++ b/xmake/modules/private/xrepo/action/install.lua @@ -251,7 +251,15 @@ function _install_packages(packages) if #rcfiles > 0 then envs.XMAKE_RCFILES = path.joinenv(rcfiles) end - os.vrunv(os.programfile(), config_argv, {envs = envs}) + -- we can skip the repeated configuration and toolchain detection to speed up the plugin installation, + -- because the plugin package is host-only and does not depend on any build configuration. + -- we only skip it if no extra configuration arguments are given, e.g. `xrepo install -k plugin hello` + if kind == "plugin" and #config_argv == 3 + and os.isfile(path.join(workdir, ".xmake", os.host(), os.arch(), "xmake.conf")) then + vprint("skip the configuration for installing plugins") + else + os.vrunv(os.programfile(), config_argv, {envs = envs}) + end -- do install local require_argv = {"require"} diff --git a/xmake/modules/private/xrepo/action/remove.lua b/xmake/modules/private/xrepo/action/remove.lua index b59f6b7b0..989983955 100644 --- a/xmake/modules/private/xrepo/action/remove.lua +++ b/xmake/modules/private/xrepo/action/remove.lua @@ -152,7 +152,15 @@ function _remove_packages(packages) if #rcfiles > 0 then envs.XMAKE_RCFILES = path.joinenv(rcfiles) end - os.vrunv(os.programfile(), config_argv, {envs = envs}) + -- we can skip the repeated configuration and toolchain detection to speed up the plugin removal, + -- because the plugin package is host-only and does not depend on any build configuration. + -- we only skip it if no extra configuration arguments are given, e.g. `xrepo remove -k plugin hello` + if kind == "plugin" and #config_argv == 3 + and os.isfile(path.join(workdir, ".xmake", os.host(), os.arch(), "xmake.conf")) then + vprint("skip the configuration for removing plugins") + else + os.vrunv(os.programfile(), config_argv, {envs = envs}) + end -- do remove local require_argv = {"require", "--uninstall"} |
