summaryrefslogtreecommitdiff
path: root/xmake/core
diff options
context:
space:
mode:
authorruki <[email protected]>2026-02-10 18:39:31 +0800
committerGitHub <[email protected]>2026-02-10 18:39:31 +0800
commitd5eb58a3964d9665cecb50aa9894469e9dfe7b66 (patch)
tree76d9372e10747bdd511474ee417dab990683ad1b /xmake/core
parentee98b61be7054e1b8b8e2668b67c662ba12e264b (diff)
parentf59677a14435189b9bd9f11bd8e88147efc2439d (diff)
Merge pull request #7309 from xmake-io/keepsrc
keep package source
Diffstat (limited to 'xmake/core')
-rw-r--r--xmake/core/package/package.lua9
-rw-r--r--xmake/core/project/policy.lua2
2 files changed, 11 insertions, 0 deletions
diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua
index 692be9ae8..1b55257a8 100644
--- a/xmake/core/package/package.lua
+++ b/xmake/core/package/package.lua
@@ -662,6 +662,15 @@ function _instance:is_debug()
return self:config("debug") or self:config("asan")
end
+-- should keep package source code after installing?
+function _instance:has_source()
+ local project = package._project()
+ return self:is_debug() or
+ self:is_source_embed() or
+ (project and project.policy("package.keep_source")) or
+ self:policy("package.keep_source")
+end
+
-- is the supported package?
function _instance:is_supported()
-- attempt to get the install script with the current plat/arch
diff --git a/xmake/core/project/policy.lua b/xmake/core/project/policy.lua
index 0fdd70831..a1aad6d97 100644
--- a/xmake/core/project/policy.lua
+++ b/xmake/core/project/policy.lua
@@ -151,6 +151,8 @@ function policy.policies()
["package.install_always"] = {description = "Always install packages every time.", type = "boolean"},
-- Install packages in the local project folder
["package.install_locally"] = {description = "Install packages in the local project folder.", default = false, type = "boolean"},
+ -- Keep package source code after installing (disable source dir cleanup)
+ ["package.keep_source"] = {description = "Keep package source code after installing.", default = false, type = "boolean"},
-- Set custom headers when downloading package
["package.download.http_headers"] = {description = "Set the custom http headers when downloading package.", type = "table"},
-- Use includes as external header files? e.g. -isystem ..