diff options
| author | ruki <[email protected]> | 2017-02-17 20:50:39 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-02-17 20:50:39 +0800 |
| commit | a388453e3d7a91cf2f17a1137197767521803071 (patch) | |
| tree | 06b502b5fd365a4c6b1aa448982a56de6cbab602 | |
| parent | cc7f4047231bbed2b6768ab38d8c836db27b4d40 (diff) | |
remove some trace
| -rwxr-xr-x | xmake/actions/build/main.lua | 8 | ||||
| -rwxr-xr-x | xmake/actions/clean/main.lua | 3 | ||||
| -rwxr-xr-x | xmake/actions/config/main.lua | 3 | ||||
| -rwxr-xr-x | xmake/actions/global/main.lua | 3 | ||||
| -rwxr-xr-x | xmake/actions/install/main.lua | 3 | ||||
| -rwxr-xr-x | xmake/actions/package/main.lua | 3 | ||||
| -rwxr-xr-x | xmake/actions/uninstall/main.lua | 3 | ||||
| -rw-r--r-- | xmake/core/base/utils.lua | 28 | ||||
| -rw-r--r-- | xmake/core/project/config.lua | 5 | ||||
| -rw-r--r-- | xmake/core/project/global.lua | 5 | ||||
| -rw-r--r-- | xmake/core/project/task.lua | 19 | ||||
| -rw-r--r-- | xmake/core/sandbox/modules/import/core/project/task.lua | 2 | ||||
| -rw-r--r-- | xmake/core/sandbox/modules/utils.lua | 12 | ||||
| -rwxr-xr-x | xmake/plugins/macro/main.lua | 3 |
14 files changed, 53 insertions, 47 deletions
diff --git a/xmake/actions/build/main.lua b/xmake/actions/build/main.lua index 14e73b8f7..e0edbc37a 100755 --- a/xmake/actions/build/main.lua +++ b/xmake/actions/build/main.lua @@ -45,7 +45,11 @@ function main() cache.enter("local.config") -- rebuild? + local rebuild = false if option.get("rebuild") or cache.get("rebuild") then + + -- mark as rebuild + rebuild = true -- clean it first task.run("clean", {target = targetname}) @@ -88,5 +92,7 @@ function main() os.cd(olddir) -- trace - cprint("${bright}build ok!${clear}${ok_hand}") + if rebuild then + cprint("${bright}build ok!${clear}${ok_hand}") + end end diff --git a/xmake/actions/clean/main.lua b/xmake/actions/clean/main.lua index d92ff1322..1950002a8 100755 --- a/xmake/actions/clean/main.lua +++ b/xmake/actions/clean/main.lua @@ -164,7 +164,4 @@ function main() -- leave project directory os.cd(olddir) - - -- trace - cprint("${bright}clean ok!") end diff --git a/xmake/actions/config/main.lua b/xmake/actions/config/main.lua index 57ddc2a4e..66bf33404 100755 --- a/xmake/actions/config/main.lua +++ b/xmake/actions/config/main.lua @@ -246,9 +246,6 @@ function main() -- dump it config.dump() - - -- trace - cprint("${bright}configure ok!") end -- finished diff --git a/xmake/actions/global/main.lua b/xmake/actions/global/main.lua index bf3e50327..14b98fc07 100755 --- a/xmake/actions/global/main.lua +++ b/xmake/actions/global/main.lua @@ -62,7 +62,4 @@ function main() -- dump it global.dump() - - -- trace - cprint("${bright}configure ok!") end diff --git a/xmake/actions/install/main.lua b/xmake/actions/install/main.lua index 5c964e284..766d50aa7 100755 --- a/xmake/actions/install/main.lua +++ b/xmake/actions/install/main.lua @@ -96,7 +96,4 @@ function main() else _install_target_and_deps(project.target(targetname)) end - - -- trace - cprint("${bright}install ok!") end diff --git a/xmake/actions/package/main.lua b/xmake/actions/package/main.lua index c60974c37..0597eeb6e 100755 --- a/xmake/actions/package/main.lua +++ b/xmake/actions/package/main.lua @@ -209,7 +209,4 @@ function main() else _package_target_and_deps(project.target(targetname)) end - - -- trace - cprint("${bright}package ok!") end diff --git a/xmake/actions/uninstall/main.lua b/xmake/actions/uninstall/main.lua index 989d55cff..b4217f3d3 100755 --- a/xmake/actions/uninstall/main.lua +++ b/xmake/actions/uninstall/main.lua @@ -96,7 +96,4 @@ function main() else _uninstall_target_and_deps(project.target(targetname)) end - - -- trace - cprint("${bright}uninstall ok!") end diff --git a/xmake/core/base/utils.lua b/xmake/core/base/utils.lua index abcb0b261..030c10d5c 100644 --- a/xmake/core/base/utils.lua +++ b/xmake/core/base/utils.lua @@ -30,6 +30,24 @@ local option = require("base/option") local colors = require("base/colors") local string = require("base/string") +-- print string with newline +function utils._print(...) + + -- print it if not quiet + if not option.get("quiet") then + print(...) + end +end + +-- print string without newline +function utils._iowrite(...) + + -- print it if not quiet + if not option.get("quiet") then + io.write(...) + end +end + -- print format string with newline function utils.print(format, ...) @@ -37,7 +55,7 @@ function utils.print(format, ...) assert(format) -- trace - print(string.tryformat(format, ...)) + utils._print(string.tryformat(format, ...)) end -- print format string without newline @@ -47,7 +65,7 @@ function utils.printf(format, ...) assert(format) -- trace - io.write(string.tryformat(format, ...)) + utils._iowrite(string.tryformat(format, ...)) end -- print format string and colors with newline @@ -57,7 +75,7 @@ function utils.cprint(format, ...) assert(format) -- trace - print(colors(string.tryformat(format, ...))) + utils._print(colors(string.tryformat(format, ...))) end -- print format string and colors without newline @@ -67,7 +85,7 @@ function utils.cprintf(format, ...) assert(format) -- trace - io.write(colors(string.tryformat(format, ...))) + utils._iowrite(colors(string.tryformat(format, ...))) end -- the verbose function @@ -77,7 +95,7 @@ function utils.verbose(format, ...) if option.get("verbose") and format ~= nil then -- trace - print(string.tryformat(format, ...)) + utils._print(string.tryformat(format, ...)) end end diff --git a/xmake/core/project/config.lua b/xmake/core/project/config.lua index e189390e3..8765b535d 100644 --- a/xmake/core/project/config.lua +++ b/xmake/core/project/config.lua @@ -207,8 +207,9 @@ end function config.dump() -- dump - table.dump(config.options(), "__%w*", "configure") - + if not option.get("quiet") then + table.dump(config.options(), "__%w*", "configure") + end end -- the configure has been changed for the given target? diff --git a/xmake/core/project/global.lua b/xmake/core/project/global.lua index 658c10700..788afd1f3 100644 --- a/xmake/core/project/global.lua +++ b/xmake/core/project/global.lua @@ -143,8 +143,9 @@ end function global.dump() -- dump - table.dump(global.options(), "__%w*", "configure") - + if not option.get("quiet") then + table.dump(global.options(), "__%w*", "configure") + end end -- return module diff --git a/xmake/core/project/task.lua b/xmake/core/project/task.lua index 7c7787f02..ed0150694 100644 --- a/xmake/core/project/task.lua +++ b/xmake/core/project/task.lua @@ -132,19 +132,20 @@ function task._translate_menu(menu) end -- add common options - table.insert(options, 1, {'v', "verbose", "k", nil, "Print lots of verbose information." }) - table.insert(options, 2, {nil, "backtrace", "k", nil, "Print backtrace information for debugging." }) - table.insert(options, 3, {nil, "profile", "k", nil, "Print performance data for debugging." }) - table.insert(options, 4, {nil, "version", "k", nil, "Print the version number and exit." }) - table.insert(options, 5, {'h', "help", "k", nil, "Print this help message and exit." }) - table.insert(options, 6, {}) - table.insert(options, 7, {'F', "file", "kv", nil, "Read a given xmake.lua file." }) - table.insert(options, 8, {'P', "project", "kv", nil, "Change to the given project directory." + table.insert(options, 1, {'q', "quiet", "k", nil, "Quiet operation." }) + table.insert(options, 2, {'v', "verbose", "k", nil, "Print lots of verbose information." }) + table.insert(options, 3, {nil, "backtrace", "k", nil, "Print backtrace information for debugging." }) + table.insert(options, 4, {nil, "profile", "k", nil, "Print performance data for debugging." }) + table.insert(options, 5, {nil, "version", "k", nil, "Print the version number and exit." }) + table.insert(options, 6, {'h', "help", "k", nil, "Print this help message and exit." }) + table.insert(options, 7, {}) + table.insert(options, 8, {'F', "file", "kv", nil, "Read a given xmake.lua file." }) + table.insert(options, 9, {'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" }) - table.insert(options, 9, {}) + table.insert(options, 10, {}) end diff --git a/xmake/core/sandbox/modules/import/core/project/task.lua b/xmake/core/sandbox/modules/import/core/project/task.lua index 58e1db976..f0fb69380 100644 --- a/xmake/core/sandbox/modules/import/core/project/task.lua +++ b/xmake/core/sandbox/modules/import/core/project/task.lua @@ -41,7 +41,7 @@ function sandbox_core_project_task.run(taskname, options, ...) options = table.wrap(options) -- inherit some parent options - for _, name in ipairs({"file", "project", "verbose"}) do + for _, name in ipairs({"file", "project", "verbose", "quiet"}) do if not options[name] and option.get(name) then options[name] = option.get(name) end diff --git a/xmake/core/sandbox/modules/utils.lua b/xmake/core/sandbox/modules/utils.lua index 46f82ea09..f09f8ccf5 100644 --- a/xmake/core/sandbox/modules/utils.lua +++ b/xmake/core/sandbox/modules/utils.lua @@ -55,20 +55,20 @@ function sandbox_utils.print(format, ...) { function () -- attempt to print format string first - io.write(vformat(format, unpack(args)) .. "\n") + utils._iowrite(vformat(format, unpack(args)) .. "\n") end, catch { function () -- print multi-variables with raw lua action - print(format, unpack(args)) + utils._print(format, unpack(args)) end } } else -- print multi-variables with raw lua action - print(format, ...) + utils._print(format, ...) end end @@ -76,21 +76,21 @@ end function sandbox_utils.printf(format, ...) -- done - io.write(vformat(format, ...)) + utils._iowrite(vformat(format, ...)) end -- print format string, the builtin variables and colors with newline function sandbox_utils.cprint(format, ...) -- done - io.write(colors(vformat(format, ...) .. "\n")) + utils._iowrite(colors(vformat(format, ...) .. "\n")) end -- print format string, the builtin variables and colors without newline function sandbox_utils.cprintf(format, ...) -- done - io.write(colors(vformat(format, ...))) + utils._iowrite(colors(vformat(format, ...))) end -- assert diff --git a/xmake/plugins/macro/main.lua b/xmake/plugins/macro/main.lua index ab9cbf084..ca2ca02b2 100755 --- a/xmake/plugins/macro/main.lua +++ b/xmake/plugins/macro/main.lua @@ -292,9 +292,6 @@ function _run(macroname) -- run macro macro.main(option.get("arguments") or {}) - - -- trace - cprint("${bright}run macro(%s) ok!", macroname) end -- main |
