summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2016-02-24 21:25:58 +0800
committerruki <[email protected]>2016-02-24 21:26:10 +0800
commit2717cbcfc0d3c1d6726c8b8512b53f31edd1d72d (patch)
treed090b37461f52c2901eaf21c2814c22490f63785
parentac6323f24c35b446c1f550378c19aad9b6a6940f (diff)
add more tasks and menus
-rwxr-xr-xxmake/core/tasks/create.lua58
-rwxr-xr-xxmake/core/tasks/global.lua34
-rwxr-xr-xxmake/core/tasks/install.lua35
-rwxr-xr-xxmake/core/tasks/package.lua56
-rwxr-xr-xxmake/core/tasks/run.lua38
-rwxr-xr-xxmake/core/tasks/uninstall.lua34
6 files changed, 255 insertions, 0 deletions
diff --git a/xmake/core/tasks/create.lua b/xmake/core/tasks/create.lua
new file mode 100755
index 000000000..f5d500cc3
--- /dev/null
+++ b/xmake/core/tasks/create.lua
@@ -0,0 +1,58 @@
+-- define task
+task("create")
+
+ -- set category
+ set_task_category("action")
+
+ -- set menu
+ set_task_menu({
+ -- usage
+ usage = "xmake create [options] [target]"
+
+ -- description
+ , description = "Create a new project."
+
+ -- options
+ , options =
+ {
+ {'n', "name", "kv", nil, "The project name." }
+ , {'f', "file", "kv", "xmake.lua", "Create a given xmake.lua file." }
+ , {'P', "project", "kv", nil, "Create from the given project directory."
+ , "Search priority:"
+ , " 1. The Given Command Argument"
+ , " 2. The Envirnoment Variable: XMAKE_PROJECT_DIR"
+ , " 3. The Current Directory" }
+--[[ , {'l', "language", "kv", "c", "The project language"
+ , function ()
+ local descriptions = {}
+ local languages = template.languages()
+ for _, language in ipairs(languages) do
+ table.insert(descriptions, " - " .. language)
+ end
+ return descriptions
+ end }
+ , {'t', "template", "kv", "1", "Select the project template id of the given language."
+ , function ()
+ local descriptions = {}
+ local languages = template.languages()
+ for _, language in ipairs(languages) do
+ table.insert(descriptions, string.format(" - language: %s", language))
+ local templates = template.loadall(language)
+ if templates then
+ for i, template in ipairs(templates) do
+ table.insert(descriptions, string.format(" %d. %s", i, utils.ifelse(template.description, template.description, "The Unknown Project")))
+ end
+ end
+ end
+ return descriptions
+ end }
+
+ , {}]]
+ , {}
+ , {nil, "target", "v", nil, "Create the given target."
+ , "Uses the project name as target if not exists." }
+ }
+ })
+
+
+
diff --git a/xmake/core/tasks/global.lua b/xmake/core/tasks/global.lua
new file mode 100755
index 000000000..45b0bbc5c
--- /dev/null
+++ b/xmake/core/tasks/global.lua
@@ -0,0 +1,34 @@
+-- define task
+task("global")
+
+ -- set category
+ set_task_category("action")
+
+ -- set menu
+ set_task_menu({
+ -- usage
+ usage = "xmake global|g [options] [target]"
+
+ -- description
+ , description = "Configure the global options for xmake."
+
+ -- xmake g
+ , shortname = 'g'
+
+ -- options
+ , options =
+ {
+ {'c', "clean", "k", nil, "Clean the cached configure and configure all again." }
+ , {nil, "make", "kv", "auto", "Set the make path." }
+ , {nil, "ccache", "kv", "auto", "Enable or disable the c/c++ compiler cache."
+ , " --ccache=[y|n]" }
+
+ , {}
+ -- the options for all platforms
+-- , function () return platform.menu("global") end
+
+ }
+ })
+
+
+
diff --git a/xmake/core/tasks/install.lua b/xmake/core/tasks/install.lua
new file mode 100755
index 000000000..a8cef2137
--- /dev/null
+++ b/xmake/core/tasks/install.lua
@@ -0,0 +1,35 @@
+-- define task
+task("install")
+
+ -- set category
+ set_task_category("action")
+
+ -- set menu
+ set_task_menu({
+ -- usage
+ usage = "xmake install|i [options] [target]"
+
+ -- description
+ , description = "Package and install the project binary files."
+
+ -- xmake i
+ , shortname = 'i'
+
+ -- options
+ , options =
+ {
+ {'f', "file", "kv", "xmake.lua", "Read a given xmake.lua file." }
+ , {'P', "project", "kv", nil, "Change to the given project directory."
+ , "Search priority:"
+ , " 1. The Given Command Argument"
+ , " 2. The Envirnoment Variable: XMAKE_PROJECT_DIR"
+ , " 3. The Current Directory" }
+ , {'o', "installdir", "kv", nil, "Set the install directory." }
+
+ , {}
+ , {nil, "target", "v", "all", "Install the given target." }
+ }
+ })
+
+
+
diff --git a/xmake/core/tasks/package.lua b/xmake/core/tasks/package.lua
new file mode 100755
index 000000000..3bdf35f10
--- /dev/null
+++ b/xmake/core/tasks/package.lua
@@ -0,0 +1,56 @@
+-- define task
+task("package")
+
+ -- set category
+ set_task_category("action")
+
+ -- set menu
+ set_task_menu({
+ -- usage
+ usage = "xmake package|p [options] [target]"
+
+ -- description
+ , description = "Package target."
+
+ -- xmake p
+ , shortname = 'p'
+
+ -- options
+ , options =
+ {
+--[[ {'a', "archs", "kv", nil, "Package multiple given architectures."
+ , " .e.g --archs=\"armv7, arm64\" or -a i386"
+ , ""
+ , function ()
+ local descriptions = {}
+ local plats = platform.plats()
+ if plats then
+ for i, plat in ipairs(plats) do
+ descriptions[i] = " - " .. plat .. ":"
+ local archs = platform.archs(plat)
+ if archs then
+ for _, arch in ipairs(archs) do
+ descriptions[i] = descriptions[i] .. " " .. arch
+ end
+ end
+ end
+ end
+ return descriptions
+ end }]]
+
+ , {}
+ , {'f', "file", "kv", "xmake.lua", "Create a given xmake.lua file." }
+ , {'P', "project", "kv", nil, "Create from the given project directory."
+ , "Search priority:"
+ , " 1. The Given Command Argument"
+ , " 2. The Envirnoment Variable: XMAKE_PROJECT_DIR"
+ , " 3. The Current Directory" }
+ , {'o', "outputdir", "kv", nil, "Set the output directory." }
+
+ , {}
+ , {nil, "target", "v", "all", "Package a given target" }
+ }
+ })
+
+
+
diff --git a/xmake/core/tasks/run.lua b/xmake/core/tasks/run.lua
new file mode 100755
index 000000000..a0b7f4dab
--- /dev/null
+++ b/xmake/core/tasks/run.lua
@@ -0,0 +1,38 @@
+-- define task
+task("run")
+
+ -- set category
+ set_task_category("action")
+
+ -- set menu
+ set_task_menu({
+ -- usage
+ usage = "xmake run|r [options] [target] [arguments]"
+
+ -- description
+ , description = "Run the project target."
+
+ -- xmake r
+ , shortname = 'r'
+
+ -- options
+ , options =
+ {
+ {'d', "debug", "k", nil, "Run and debug the given target." }
+ , {nil, "debugger", "kv", "auto", "Set the debugger path." }
+
+ , {}
+ , {'f', "file", "kv", "xmake.lua", "Read a given xmake.lua file." }
+ , {'P', "project", "kv", nil, "Change to the given project directory."
+ , "Search priority:"
+ , " 1. The Given Command Argument"
+ , " 2. The Envirnoment Variable: XMAKE_PROJECT_DIR"
+ , " 3. The Current Directory" }
+ , {}
+ , {nil, "target", "v", nil, "Run the given target." }
+ , {nil, "arguments", "vs", nil, "The target arguments" }
+ }
+ })
+
+
+
diff --git a/xmake/core/tasks/uninstall.lua b/xmake/core/tasks/uninstall.lua
new file mode 100755
index 000000000..b576a7c02
--- /dev/null
+++ b/xmake/core/tasks/uninstall.lua
@@ -0,0 +1,34 @@
+-- define task
+task("uninstall")
+
+ -- set category
+ set_task_category("action")
+
+ -- set menu
+ set_task_menu({
+ -- usage
+ usage = "xmake uninstall|u [options] [target]"
+
+ -- description
+ , description = "Uninstall the project binary files."
+
+ -- xmake u
+ , shortname = 'u'
+
+ -- options
+ , options =
+ {
+ {'f', "file", "kv", "xmake.lua", "Read a given xmake.lua file." }
+ , {'P', "project", "kv", nil, "Change to the given project directory."
+ , "Search priority:"
+ , " 1. The Given Command Argument"
+ , " 2. The Envirnoment Variable: XMAKE_PROJECT_DIR"
+ , " 3. The Current Directory" }
+
+ , {}
+ , {nil, "target", "v", "all", "Install the given target." }
+ }
+ })
+
+
+