summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2020-10-28 22:42:47 +0800
committerruki <[email protected]>2020-10-28 22:42:47 +0800
commit2aa699bb2c0e7e031ea7cfe98b0e60ff9eae073b (patch)
treebc81d5bea9d8a4632a567a6825b7b8c604768d25
parent3b74bb00d24587b4768ac10c9ef4222f01ae9225 (diff)
add global build_warning option
-rw-r--r--xmake/actions/build/main.lua1
-rw-r--r--xmake/actions/global/xmake.lua2
-rw-r--r--xmake/modules/core/tools/cl.lua3
-rw-r--r--xmake/modules/core/tools/gcc.lua3
-rw-r--r--xmake/modules/core/tools/llvm_rc.lua3
-rw-r--r--xmake/modules/core/tools/nvcc.lua3
-rw-r--r--xmake/modules/core/tools/sdcc.lua3
-rw-r--r--xmake/modules/core/tools/tcc.lua3
-rw-r--r--xmake/modules/core/tools/windres.lua3
9 files changed, 17 insertions, 7 deletions
diff --git a/xmake/actions/build/main.lua b/xmake/actions/build/main.lua
index 46e3d9ef7..c50faa2ca 100644
--- a/xmake/actions/build/main.lua
+++ b/xmake/actions/build/main.lua
@@ -20,6 +20,7 @@
-- imports
import("core.base.option")
+import("core.base.global")
import("core.base.task")
import("core.project.config")
import("core.project.project")
diff --git a/xmake/actions/global/xmake.lua b/xmake/actions/global/xmake.lua
index b895b129a..97a3da630 100644
--- a/xmake/actions/global/xmake.lua
+++ b/xmake/actions/global/xmake.lua
@@ -49,6 +49,8 @@ task("global")
return import("core.theme.theme.names")()
end}
, {nil, "debugger", "kv", "auto" , "The debugger program path." }
+ , {category = "Build Configuration"}
+ , {nil, "build_warning", "kv", nil , "Enable the warnings output by default when building." }
-- network configuration
, {category = "Network Configuration"}
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