diff options
| author | ruki <[email protected]> | 2017-06-01 11:30:44 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-06-01 11:30:44 +0800 |
| commit | 2d60578f16d189e3b2d619d8890fb722d7356e55 (patch) | |
| tree | d8bb471a0227f1db6c41920fdfaef03b0b7cddef | |
| parent | 2743cb2ee2b2640bbb22aa39d63c134563949a05 (diff) | |
delay get builtin-vars
| -rw-r--r-- | xmake/core/project/project.lua | 11 | ||||
| -rw-r--r-- | xmake/core/project/task.lua | 12 |
2 files changed, 15 insertions, 8 deletions
diff --git a/xmake/core/project/project.lua b/xmake/core/project/project.lua index ea70777de..649d41141 100644 --- a/xmake/core/project/project.lua +++ b/xmake/core/project/project.lua @@ -309,11 +309,11 @@ function project._interpreter() local maps = { os = platform.os() - , host = xmake._HOST + , host = os.host() , prefix = "$(prefix)" - , tmpdir = os.tmpdir() - , curdir = os.curdir() - , scriptdir = sandbox_os.scriptdir() + , tmpdir = function () return os.tmpdir() end + , curdir = function () return os.curdir() end + , scriptdir = function () return sandbox_os.scriptdir() end , globaldir = global.directory() , configdir = config.directory() , projectdir = project.directory() @@ -323,6 +323,9 @@ function project._interpreter() -- map it result = maps[variable] + if type(result) == "function" then + result = result() + end end -- ok? diff --git a/xmake/core/project/task.lua b/xmake/core/project/task.lua index 08097ded6..f1aad65a0 100644 --- a/xmake/core/project/task.lua +++ b/xmake/core/project/task.lua @@ -36,6 +36,7 @@ local global = require("project/global") local config = require("project/config") local project = require("project/project") local package = require("project/package") +local sandbox_os = require("sandbox/modules/os") -- the directories of tasks function task._directories() @@ -194,10 +195,10 @@ function task._interpreter() -- init maps local maps = { - host = xmake._HOST - , nuldev = os.nuldev() - , tmpdir = os.tmpdir() - , curdir = os.curdir() + host = os.host() + , tmpdir = function () return os.tmpdir() end + , curdir = function () return os.curdir() end + , scriptdir = function () return sandbox_os.scriptdir() end , globaldir = global.directory() , configdir = config.directory() , projectdir = xmake._PROJECT_DIR @@ -207,6 +208,9 @@ function task._interpreter() -- map it result = maps[variable] + if type(result) == "function" then + result = result() + end end -- ok? |
