diff options
| author | ruki <[email protected]> | 2016-09-01 18:36:17 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2016-09-01 18:36:17 +0800 |
| commit | eb7401f0cf3d3039f3670c86ad05acbc7c042c39 (patch) | |
| tree | badb6faeee2a90147c49e6ba638e1b8f20421867 /xmake/core/project/task.lua | |
| parent | 314a1cd63b8efe3e3f897cedabc3c73789ff117f (diff) | |
bind sandbox for project task
Diffstat (limited to 'xmake/core/project/task.lua')
| -rw-r--r-- | xmake/core/project/task.lua | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/xmake/core/project/task.lua b/xmake/core/project/task.lua index 1c513439e..b94685066 100644 --- a/xmake/core/project/task.lua +++ b/xmake/core/project/task.lua @@ -214,13 +214,13 @@ function task._interpreter() end -- bind tasks for menu with an sandbox instance -function task._bind(tasks) +function task._bind(tasks, interp) -- check assert(tasks) -- get interpreter - local interp = task._interpreter() + interp = interp or task._interpreter() assert(interp) -- bind sandbox for menus @@ -306,14 +306,14 @@ function task._load(filepath) local tasks, errors = interp:load(filepath, "task", true, true) if not tasks and os.isfile(filepath) then -- trace - utils.error(errors) + os.raise(errors) end -- bind tasks for menu with an sandbox instance local ok, errors = task._bind(tasks) if not ok then -- trace - utils.error(errors) + os.raise(errors) return end @@ -353,6 +353,19 @@ function task.tasks() -- merge project tasks if exists local projectasks, errors = project.tasks() if projectasks then + + -- the project interpreter + local interp = errors + + -- bind tasks for menu with an sandbox instance + local ok, errors = task._bind(projectasks, interp) + if not ok then + -- trace + os.raise(errors) + return + end + + -- save tasks for taskname, taskinfo in pairs(projectasks) do if tasks[taskname] == nil then tasks[taskname] = taskinfo |
