summaryrefslogtreecommitdiff
path: root/xmake/plugins/show/info/target.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2020-06-02 00:53:26 +0800
committerruki <[email protected]>2020-06-01 23:20:38 +0800
commit1c11bcdcccf8cf183d9840b56bd003890f0df66b (patch)
tree8f2d49a1cca3a737bf5568afd94537d1c1b35552 /xmake/plugins/show/info/target.lua
parentc9c6aec399bbf0e069f2e5ca2c6596bfb0b80e83 (diff)
show target
Diffstat (limited to 'xmake/plugins/show/info/target.lua')
-rw-r--r--xmake/plugins/show/info/target.lua62
1 files changed, 62 insertions, 0 deletions
diff --git a/xmake/plugins/show/info/target.lua b/xmake/plugins/show/info/target.lua
new file mode 100644
index 000000000..c80b31585
--- /dev/null
+++ b/xmake/plugins/show/info/target.lua
@@ -0,0 +1,62 @@
+--!A cross-platform build utility based on Lua
+--
+-- Licensed under the Apache License, Version 2.0 (the "License");
+-- you may not use this file except in compliance with the License.
+-- You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+-- Copyright (C) 2015-2020, TBOOX Open Source Group.
+--
+-- @author ruki
+-- @file target.lua
+--
+
+-- imports
+import("core.base.option")
+import("core.project.config")
+import("core.project.project")
+import("core.language.language")
+
+-- show target info
+function main(name)
+
+ -- get target
+ config.load()
+ local target = assert(project.target(name), "target(%s) not found!", name)
+
+ -- show target information
+ print("The information of target(%s):", name)
+ cprint(" ${color.dump.string}kind${clear}: %s", target:targetkind())
+ cprint(" ${color.dump.string}targetfile${clear}: %s", target:targetfile())
+ cprint(" ${color.dump.string}deps${clear}: %s", table.concat(table.wrap(target:get("deps")), ", "))
+ cprint(" ${color.dump.string}rules${clear}: %s", table.concat(table.wrap(target:get("rules")), ", "))
+ cprint(" ${color.dump.string}options${clear}: %s", table.concat(table.wrap(target:get("options")), ", "))
+ cprint(" ${color.dump.string}packages${clear}: %s", table.concat(table.wrap(target:get("packages")), ", "))
+ for _, apiname in ipairs(table.join(language.apis().values, language.apis().pathes)) do
+ if apiname:startswith("target.") then
+ local valuename = apiname:split('.add_', {plain = true})[2]
+ if valuename then
+ local values = target:get(valuename)
+ if values then
+ cprint(" ${color.dump.string}%s${clear}: %s", valuename, table.concat(table.wrap(values), ", "))
+ end
+ end
+ end
+ end
+ cprint(" ${color.dump.string}at${clear}: %s", path.join(target:scriptdir(), "xmake.lua"))
+ for _, sourcebatch in pairs(target:sourcebatches()) do
+ cprint(" ${color.dump.string}sourcebatch${clear}(%s): with rule(%s)", sourcebatch.sourcekind, sourcebatch.rulename)
+ for idx, sourcefile in ipairs(sourcebatch.sourcefiles) do
+ cprint(" -> %s", sourcefile)
+ cprint(" ${dim}-> %s", sourcebatch.objectfiles[idx])
+ cprint(" ${dim}-> %s", sourcebatch.dependfiles[idx])
+ end
+ end
+end