summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2022-03-05 00:30:33 +0800
committerruki <[email protected]>2022-03-05 00:30:33 +0800
commit824bba3286c79e2969214924cdb78a59778cefcc (patch)
tree95bda58fe6623731982563214482609de3648ce8
parent5b4fb54904dd927d0190a0a50affedbc81732640 (diff)
add precompile policy
-rw-r--r--xmake/core/project/policy.lua4
-rw-r--r--xmake/modules/private/action/require/impl/package.lua4
2 files changed, 7 insertions, 1 deletions
diff --git a/xmake/core/project/policy.lua b/xmake/core/project/policy.lua
index 8491e6883..0841f25b0 100644
--- a/xmake/core/project/policy.lua
+++ b/xmake/core/project/policy.lua
@@ -48,7 +48,9 @@ function policy.policies()
-- we need enable longpaths when building target or installing package
["platform.longpaths"] = {description = "Enable long paths when building target or installing package on windows.", default = false, type = "boolean"},
-- lock required packages
- ["package.requires_lock"] = {description = "Enable xmake-requires.lock to lock required packages.", default = false, type = "boolean"}
+ ["package.requires_lock"] = {description = "Enable xmake-requires.lock to lock required packages.", default = false, type = "boolean"},
+ -- enable the precompiled packages, it will be enabled by default
+ ["package.precompiled"] = {description = "Enable precompiled packages.", default = true, type = "boolean"}
}
policy._POLICIES = policies
end
diff --git a/xmake/modules/private/action/require/impl/package.lua b/xmake/modules/private/action/require/impl/package.lua
index dbeb13d9a..057b56a99 100644
--- a/xmake/modules/private/action/require/impl/package.lua
+++ b/xmake/modules/private/action/require/impl/package.lua
@@ -664,6 +664,10 @@ end
-- select to use precompiled artifacts?
function _select_artifacts(package, artifacts_manifest)
+ -- the precompile policy is disabled?
+ if package:policy("package.precompiled") == false then
+ return
+ end
local artifacts_info
if package:is_plat("windows") then -- for msvc
artifacts_info = _select_artifacts_for_msvc(package, artifacts_manifest)