-
Notifications
You must be signed in to change notification settings - Fork 177
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add xmake ci --dump command * Add ci task to the existing plugin category
- Loading branch information
1 parent
2a436a6
commit e74956a
Showing
5 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import("core.project.project") | ||
import("core.base.json") | ||
|
||
function main() | ||
local modes = {} | ||
for _, mode in pairs(project.modes()) do | ||
table.append(modes, mode) | ||
end | ||
local jsonString = json.encode(modes) | ||
io.write(jsonString) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import("core.project.config") | ||
import("core.project.project") | ||
import("core.base.json") | ||
import("core.base.task") | ||
|
||
function main() | ||
project.lock() | ||
-- Check to ensure that config has been run. This will not trample the existing config if it exists. | ||
task.run("config", {yes=true}, {disable_dump = true}) | ||
project.load_targets() | ||
project.unlock() | ||
|
||
local targets = {} | ||
for targetname, target in pairs(project.targets()) do | ||
targets[targetname] = {target = target:targetfile(), symbol = target:symbolfile()} | ||
end | ||
|
||
local jsonString = json.encode(targets) | ||
io.write(jsonString) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import("core.base.option") | ||
|
||
function main() | ||
if option.get("dump") then | ||
local module_name = string.format("dump.%s", string.lower(option.get("dump"))) | ||
assert(import(module_name, {try = true, anonymous = true}))() | ||
else | ||
raise("No options provided to the xmake ci command.") | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
task("ci") | ||
set_category("plugin") | ||
on_run("main") | ||
|
||
set_menu { | ||
usage = "xmake ci [options]", | ||
description = "Pass build information to external tools.", | ||
options = | ||
{ | ||
{'d', "dump", "kv", nil, "Dump the specified information in JSON format.", | ||
values = {"modes", "targets"} } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters