diff options
| author | ruki <[email protected]> | 2017-06-06 22:55:31 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-06-06 22:55:31 +0800 |
| commit | 0a28fb2991e2617fe9b75df176608537e07fa35a (patch) | |
| tree | 2085924eaf171666591e106d09d336b050b1a6cc | |
| parent | 8aceb2b14e224cf3ed28ab6cd326b32897135b68 (diff) | |
cache import modules
| -rw-r--r-- | xmake/core/base/interpreter.lua | 3 | ||||
| -rw-r--r-- | xmake/core/sandbox/modules/import/lib/detect/find_library.lua | 6 |
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) |
