summaryrefslogtreecommitdiff
path: root/xmake/modules/lib
diff options
context:
space:
mode:
authorruki <[email protected]>2020-12-23 00:00:24 +0800
committerruki <[email protected]>2020-12-23 00:00:24 +0800
commit5eb09e88851744fb544c5b6ed5e20a448928daa0 (patch)
treef65e2570f193ec11693b174bc0b2b4ff1d37a421 /xmake/modules/lib
parentfd125f21ece875cd6a5037725f2d84f24e658f41 (diff)
remove lib.detect.cache
Diffstat (limited to 'xmake/modules/lib')
-rw-r--r--xmake/modules/lib/detect/find_cudadevices.lua7
-rw-r--r--xmake/modules/lib/detect/find_package.lua7
-rw-r--r--xmake/modules/lib/detect/has_flags.lua7
3 files changed, 12 insertions, 9 deletions
diff --git a/xmake/modules/lib/detect/find_cudadevices.lua b/xmake/modules/lib/detect/find_cudadevices.lua
index 92ffcf5cd..c55cc26f8 100644
--- a/xmake/modules/lib/detect/find_cudadevices.lua
+++ b/xmake/modules/lib/detect/find_cudadevices.lua
@@ -22,7 +22,7 @@
import("core.base.option")
import("core.platform.platform")
import("core.project.config")
-import("lib.detect.cache")
+import("core.cache.detectcache")
import("lib.detect.find_tool")
-- a magic string to filter output
@@ -181,7 +181,7 @@ function _get_devices(opt)
end
-- check cache
- local cachedata = cache.load(cachekey)
+ local cachedata = detectcache:get(cachekey) or {}
if cachedata.succeed and not opt.force then
return cachedata.data
end
@@ -196,7 +196,8 @@ function _get_devices(opt)
end
-- fill cache
- cache.save(cachekey, cachedata)
+ detectcache:set(cachekey, cachedata)
+ detectcache:save()
return devices
end
diff --git a/xmake/modules/lib/detect/find_package.lua b/xmake/modules/lib/detect/find_package.lua
index e6f4c8f21..5e50c2345 100644
--- a/xmake/modules/lib/detect/find_package.lua
+++ b/xmake/modules/lib/detect/find_package.lua
@@ -21,7 +21,7 @@
-- imports
import("core.base.option")
import("core.project.config")
-import("lib.detect.cache")
+import("core.cache.detectcache")
import("package.manager.find_package")
-- find package using the package manager
@@ -71,7 +71,7 @@ function main(name, opt)
end
-- attempt to get result from cache first
- local cacheinfo = cache.load(key)
+ local cacheinfo = detectcache:get(key) or {}
local result = cacheinfo[name]
if result == nil or opt.force then
@@ -87,7 +87,8 @@ function main(name, opt)
-- cache result
cacheinfo[name] = result and result or false
- cache.save(key, cacheinfo)
+ detectcache:set(key, cacheinfo)
+ detectcache:save()
-- trace
if opt.verbose or option.get("verbose") then
diff --git a/xmake/modules/lib/detect/has_flags.lua b/xmake/modules/lib/detect/has_flags.lua
index 4f151740f..4559f7959 100644
--- a/xmake/modules/lib/detect/has_flags.lua
+++ b/xmake/modules/lib/detect/has_flags.lua
@@ -22,7 +22,7 @@
import("core.base.option")
import("core.base.scheduler")
import("core.project.config")
-import("lib.detect.cache")
+import("core.cache.detectcache")
import("lib.detect.find_tool")
-- has the given flags for the current tool?
@@ -84,7 +84,7 @@ function main(name, flags, opt)
end
-- attempt to get result from cache first
- local cacheinfo = cache.load("lib.detect.has_flags")
+ local cacheinfo = detectcache:get("lib.detect.has_flags") or {}
local result = cacheinfo[key]
if result ~= nil and not opt.force then
return result
@@ -137,7 +137,8 @@ function main(name, flags, opt)
-- save result to cache
cacheinfo[key] = result
- cache.save("lib.detect.has_flags", cacheinfo)
+ detectcache:set("lib.detect.has_flags", cacheinfo)
+ detectcache:save()
return result
end