summaryrefslogtreecommitdiff
path: root/xmake/core/project/task.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2016-05-28 20:53:15 +0800
committerruki <[email protected]>2016-05-28 20:53:15 +0800
commita686ee37d66f509ba01dbe10c2999c32e96c59db (patch)
tree923949cbbd12ed5c99d54e83526fa9174b5da9ce /xmake/core/project/task.lua
parent7a0445c0612e9065461c1dff3eab6e992d742e4d (diff)
load tasks from project
Diffstat (limited to 'xmake/core/project/task.lua')
-rw-r--r--xmake/core/project/task.lua16
1 files changed, 15 insertions, 1 deletions
diff --git a/xmake/core/project/task.lua b/xmake/core/project/task.lua
index 2bdc7c353..dd7eabf2c 100644
--- a/xmake/core/project/task.lua
+++ b/xmake/core/project/task.lua
@@ -33,6 +33,7 @@ local interpreter = require("base/interpreter")
local sandbox = require("sandbox/sandbox")
local global = require("project/global")
local config = require("project/config")
+local project = require("project/project")
-- the directories of tasks
function task._directories()
@@ -164,7 +165,7 @@ function task._interpreter()
-- register api: set_category()
--
- -- category: main, action, plugin
+ -- category: main, action, plugin, task (default)
interp:api_register_set_values("task", "category")
-- register api: set_menu()
@@ -346,7 +347,20 @@ function task.tasks()
end
end
end
+ end
+ -- merge project tasks if exists
+ local projectasks, errors = project.tasks()
+ if projectasks then
+ for taskname, taskinfo in pairs(projectasks) do
+ if tasks[taskname] == nil then
+ tasks[taskname] = taskinfo
+ else
+ utils.warning("task(\"%s\") has been defined!", taskname)
+ end
+ end
+ else
+ os.raise(errors)
end
-- save it