summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2020-12-21 22:39:10 +0800
committerruki <[email protected]>2020-12-21 22:39:10 +0800
commit709765844261afbf8c188914c638ee7ff9380fd4 (patch)
treee21d66fbd5b2c8e5297ab41086b6042ef2909626
parentbcc7f92bf3779ab59dd7ab8783ba0eb27cc9be89 (diff)
add detectcache
-rw-r--r--xmake/core/cache/detectcache.lua22
-rw-r--r--xmake/core/cache/globalcache.lua2
-rw-r--r--xmake/core/cache/localcache.lua2
-rw-r--r--xmake/core/sandbox/modules/import/core/cache/detectcache.lua23
4 files changed, 47 insertions, 2 deletions
diff --git a/xmake/core/cache/detectcache.lua b/xmake/core/cache/detectcache.lua
new file mode 100644
index 000000000..65f2fadf9
--- /dev/null
+++ b/xmake/core/cache/detectcache.lua
@@ -0,0 +1,22 @@
+--!A cross-platform build utility based on Lua
+--
+-- Licensed under the Apache License, Version 2.0 (the "License");
+-- you may not use this file except in compliance with the License.
+-- You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+-- Copyright (C) 2015-present, TBOOX Open Source Group.
+--
+-- @author ruki
+-- @file detectcache.lua
+--
+
+return require("cache/localcache").cache("detect")
+
diff --git a/xmake/core/cache/globalcache.lua b/xmake/core/cache/globalcache.lua
index 3529b259b..2736cf2a4 100644
--- a/xmake/core/cache/globalcache.lua
+++ b/xmake/core/cache/globalcache.lua
@@ -50,7 +50,7 @@ end
-- load cache
function _instance:load()
local result = io.load(path.join(global.cachedir(), self:name()))
- if result then
+ if result ~= nil then
self._DATA = result
end
end
diff --git a/xmake/core/cache/localcache.lua b/xmake/core/cache/localcache.lua
index f937bc9d0..f6016ef60 100644
--- a/xmake/core/cache/localcache.lua
+++ b/xmake/core/cache/localcache.lua
@@ -50,7 +50,7 @@ end
-- load cache
function _instance:load()
local result = io.load(path.join(config.cachedir(), self:name()))
- if result then
+ if result ~= nil then
self._DATA = result
end
end
diff --git a/xmake/core/sandbox/modules/import/core/cache/detectcache.lua b/xmake/core/sandbox/modules/import/core/cache/detectcache.lua
new file mode 100644
index 000000000..8e3631cb1
--- /dev/null
+++ b/xmake/core/sandbox/modules/import/core/cache/detectcache.lua
@@ -0,0 +1,23 @@
+--!A cross-platform build utility based on Lua
+--
+-- Licensed under the Apache License, Version 2.0 (the "License");
+-- you may not use this file except in compliance with the License.
+-- You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+-- Copyright (C) 2015-present, TBOOX Open Source Group.
+--
+-- @author ruki
+-- @file detectcache.lua
+--
+
+-- return module
+return require("cache/detectcache")
+