summaryrefslogtreecommitdiff
path: root/xmake/core/project/task.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2016-09-01 18:36:17 +0800
committerruki <[email protected]>2016-09-01 18:36:17 +0800
commiteb7401f0cf3d3039f3670c86ad05acbc7c042c39 (patch)
treebadb6faeee2a90147c49e6ba638e1b8f20421867 /xmake/core/project/task.lua
parent314a1cd63b8efe3e3f897cedabc3c73789ff117f (diff)
bind sandbox for project task
Diffstat (limited to 'xmake/core/project/task.lua')
-rw-r--r--xmake/core/project/task.lua21
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