summaryrefslogtreecommitdiff
path: root/xmake/modules/private/cache/build_cache.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2022-05-28 10:46:55 +0800
committerruki <[email protected]>2022-05-28 10:46:55 +0800
commit500a25f81136a0883a479bcd754dcaff2e0bbb04 (patch)
treeee3d279cb11938ddb2770c1a85bfdaec23ea89e1 /xmake/modules/private/cache/build_cache.lua
parent7d5a9b498a47c47554daee8839e4f9caac1dcc64 (diff)
add build.ccache policy
Diffstat (limited to 'xmake/modules/private/cache/build_cache.lua')
-rw-r--r--xmake/modules/private/cache/build_cache.lua11
1 files changed, 10 insertions, 1 deletions
diff --git a/xmake/modules/private/cache/build_cache.lua b/xmake/modules/private/cache/build_cache.lua
index b62165f29..4f098c983 100644
--- a/xmake/modules/private/cache/build_cache.lua
+++ b/xmake/modules/private/cache/build_cache.lua
@@ -22,6 +22,7 @@
import("core.base.bytes")
import("core.base.hashset")
import("core.project.config")
+import("core.project.project")
import("private.service.client_config")
import("private.service.remote_cache.client", {alias = "remote_cache_client"})
@@ -39,7 +40,15 @@ end
function is_enabled()
local build_cache = _g.build_cache
if build_cache == nil then
- build_cache = config.get("ccache") or false
+ if build_cache == nil and os.isfile(os.projectfile()) then
+ local policy = project.policy("build.ccache")
+ if policy ~= nil then
+ build_cache = policy
+ end
+ end
+ if build_cache == nil then
+ build_cache = config.get("ccache") or false
+ end
_g.build_cache = build_cache
end
return build_cache or false