summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2017-06-06 22:55:31 +0800
committerruki <[email protected]>2017-06-06 22:55:31 +0800
commit0a28fb2991e2617fe9b75df176608537e07fa35a (patch)
tree2085924eaf171666591e106d09d336b050b1a6cc
parent8aceb2b14e224cf3ed28ab6cd326b32897135b68 (diff)
cache import modules
-rw-r--r--xmake/core/base/interpreter.lua3
-rw-r--r--xmake/core/sandbox/modules/import/lib/detect/find_library.lua6
2 files changed, 6 insertions, 3 deletions
diff --git a/xmake/core/base/interpreter.lua b/xmake/core/base/interpreter.lua
index a22c35ed6..5c51b35e4 100644
--- a/xmake/core/base/interpreter.lua
+++ b/xmake/core/base/interpreter.lua
@@ -647,7 +647,8 @@ function interpreter:_script(script)
script = function (...)
-- import it
- return import(modulename, {anonymous = true})(...)
+ _g._module = _g._module or import(modulename, {anonymous = true})
+ return _g._module(...)
end
end
diff --git a/xmake/core/sandbox/modules/import/lib/detect/find_library.lua b/xmake/core/sandbox/modules/import/lib/detect/find_library.lua
index 732a24019..4b386f947 100644
--- a/xmake/core/sandbox/modules/import/lib/detect/find_library.lua
+++ b/xmake/core/sandbox/modules/import/lib/detect/find_library.lua
@@ -34,8 +34,10 @@ local target = require("project/target")
local config = require("project/config")
local raise = require("sandbox/modules/raise")
local import = require("sandbox/modules/import")
-local find_file = import("lib.detect.find_file", {anonymous = true})
-local find_pkg_config = import("detect.tool.find_pkg_config", {anonymous = true})
+
+-- import sandbox modules
+import("lib.detect.find_file")
+import("detect.tool.find_pkg_config")
-- get link name from the file name
function sandbox_lib_detect_find_library._link(filename)