From 2aa699bb2c0e7e031ea7cfe98b0e60ff9eae073b Mon Sep 17 00:00:00 2001 From: ruki Date: Wed, 28 Oct 2020 22:42:47 +0800 Subject: add global build_warning option --- xmake/modules/core/tools/cl.lua | 3 ++- xmake/modules/core/tools/gcc.lua | 3 ++- xmake/modules/core/tools/llvm_rc.lua | 3 ++- xmake/modules/core/tools/nvcc.lua | 3 ++- xmake/modules/core/tools/sdcc.lua | 3 ++- xmake/modules/core/tools/tcc.lua | 3 ++- xmake/modules/core/tools/windres.lua | 3 ++- 7 files changed, 14 insertions(+), 7 deletions(-) (limited to 'xmake/modules') diff --git a/xmake/modules/core/tools/cl.lua b/xmake/modules/core/tools/cl.lua index 2f08ff189..e31a9909e 100644 --- a/xmake/modules/core/tools/cl.lua +++ b/xmake/modules/core/tools/cl.lua @@ -20,6 +20,7 @@ -- imports import("core.base.option") +import("core.base.glboal") import("core.project.project") import("core.language.language") import("private.tools.vstool") @@ -426,7 +427,7 @@ function compile(self, sourcefile, objectfile, dependinfo, flags, opt) function (ok, outdata, errdata) -- show warnings? - if ok and (option.get("diagnosis") or option.get("warning")) then + if ok and (option.get("diagnosis") or option.get("warning") or global.get("build_warning")) then local output = outdata or "" if #output:trim() == 0 then output = errdata or "" diff --git a/xmake/modules/core/tools/gcc.lua b/xmake/modules/core/tools/gcc.lua index 38ad7c8fd..5418ecf27 100644 --- a/xmake/modules/core/tools/gcc.lua +++ b/xmake/modules/core/tools/gcc.lua @@ -21,6 +21,7 @@ -- imports import("core.base.option") import("core.base.colors") +import("core.base.global") import("core.project.config") import("core.project.project") import("core.language.language") @@ -477,7 +478,7 @@ function compile(self, sourcefile, objectfile, dependinfo, flags) { function (ok, outdata, errdata) -- show warnings? - if ok and errdata and #errdata > 0 and (option.get("diagnosis") or option.get("warning")) then + if ok and errdata and #errdata > 0 and (option.get("diagnosis") or option.get("warning") or global.get("build_warning")) then local lines = errdata:split('\n', {plain = true}) if #lines > 0 then local warnings = table.concat(table.slice(lines, 1, ifelse(#lines > 8, 8, #lines)), "\n") diff --git a/xmake/modules/core/tools/llvm_rc.lua b/xmake/modules/core/tools/llvm_rc.lua index 4b291aa25..d8733037d 100644 --- a/xmake/modules/core/tools/llvm_rc.lua +++ b/xmake/modules/core/tools/llvm_rc.lua @@ -20,6 +20,7 @@ -- imports import("core.base.option") +import("core.base.global") import("core.project.project") -- init it @@ -72,7 +73,7 @@ function _compile1(self, sourcefile, objectfile, dependinfo, flags) function (ok, warnings) -- print some warnings - if warnings and #warnings > 0 and option.get("verbose") then + if warnings and #warnings > 0 and (option.get("diagnosis") or option.get("warning") or global.get("build_warning")) then cprint("${color.warning}%s", table.concat(table.slice(warnings:split('\n'), 1, 8), '\n')) end end diff --git a/xmake/modules/core/tools/nvcc.lua b/xmake/modules/core/tools/nvcc.lua index 3b340b9cb..d5a7ef6d2 100644 --- a/xmake/modules/core/tools/nvcc.lua +++ b/xmake/modules/core/tools/nvcc.lua @@ -20,6 +20,7 @@ -- imports import("core.base.option") +import("core.base.global") import("core.project.config") import("core.project.project") import("core.platform.platform") @@ -354,7 +355,7 @@ function compile(self, sourcefile, objectfile, dependinfo, flags) function (ok, warnings) -- print some warnings - if warnings and #warnings > 0 and (option.get("verbose") or option.get("warning")) then + if warnings and #warnings > 0 and (option.get("verbose") or option.get("warning") or global.get("build_warning")) then if progress.showing_without_scroll() then print("") end diff --git a/xmake/modules/core/tools/sdcc.lua b/xmake/modules/core/tools/sdcc.lua index 36f6a9a96..89739c7cf 100644 --- a/xmake/modules/core/tools/sdcc.lua +++ b/xmake/modules/core/tools/sdcc.lua @@ -20,6 +20,7 @@ -- imports import("core.base.option") +import("core.base.global") import("private.utils.progress") -- init it @@ -215,7 +216,7 @@ function compile(self, sourcefile, objectfile, dependinfo, flags) function (ok, warnings) -- print some warnings - if warnings and #warnings > 0 and (option.get("verbose") or option.get("warning")) then + if warnings and #warnings > 0 and (option.get("verbose") or option.get("warning") or global.get("build_warning")) then if progress.showing_without_scroll() then print("") end diff --git a/xmake/modules/core/tools/tcc.lua b/xmake/modules/core/tools/tcc.lua index a9f8fd4f8..271792ffe 100644 --- a/xmake/modules/core/tools/tcc.lua +++ b/xmake/modules/core/tools/tcc.lua @@ -20,6 +20,7 @@ -- imports import("core.base.option") +import("core.base.global") import("core.project.config") import("core.project.project") import("core.language.language") @@ -185,7 +186,7 @@ function _compile1(self, sourcefile, objectfile, dependinfo, flags) function (ok, warnings) -- print some warnings - if warnings and #warnings > 0 and (option.get("verbose") or option.get("warning")) then + if warnings and #warnings > 0 and (option.get("verbose") or option.get("warning") or global.get("build_warning")) then cprint("${color.warning}%s", table.concat(table.slice(warnings:split('\n'), 1, 8), '\n')) end end diff --git a/xmake/modules/core/tools/windres.lua b/xmake/modules/core/tools/windres.lua index 8d36c66a2..85aad2a20 100644 --- a/xmake/modules/core/tools/windres.lua +++ b/xmake/modules/core/tools/windres.lua @@ -20,6 +20,7 @@ -- imports import("core.base.option") +import("core.base.global") import("core.project.project") -- init it @@ -72,7 +73,7 @@ function _compile1(self, sourcefile, objectfile, dependinfo, flags) function (ok, warnings) -- print some warnings - if warnings and #warnings > 0 and option.get("verbose") then + if warnings and #warnings > 0 and (option.get("diagnosis") or option.get("warning") or global.get("build_warning")) then cprint("${color.warning}%s", table.concat(table.slice(warnings:split('\n'), 1, 8), '\n')) end end -- cgit v1.3.1