summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2024-01-25 23:01:17 +0800
committerruki <[email protected]>2024-01-25 23:01:17 +0800
commit37ea03445cb35ed3f3966f3433211451175eead1 (patch)
treee93a8fe542959be3aa5f7d4088d0f97b99c892bd
parentef5cf74c8e31fbda01b75187e6c934331ad46009 (diff)
use build warnings policy
-rw-r--r--xmake/actions/build/xmake.lua2
-rw-r--r--xmake/actions/global/xmake.lua3
-rw-r--r--xmake/core/sandbox/modules/import/core/project/policy.lua3
-rw-r--r--xmake/modules/core/tools/armasm.lua3
-rw-r--r--xmake/modules/core/tools/armasm_msvc.lua3
-rw-r--r--xmake/modules/core/tools/armcc.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/sdasstm8.lua6
-rw-r--r--xmake/modules/core/tools/sdcc.lua5
-rw-r--r--xmake/modules/core/tools/tcc.lua3
-rw-r--r--xmake/modules/core/tools/windres.lua3
12 files changed, 22 insertions, 18 deletions
diff --git a/xmake/actions/build/xmake.lua b/xmake/actions/build/xmake.lua
index 6f54fb69e..61174105c 100644
--- a/xmake/actions/build/xmake.lua
+++ b/xmake/actions/build/xmake.lua
@@ -42,7 +42,7 @@ task("build")
, {'j', "jobs", "kv", tostring(os.default_njob()),
"Set the number of parallel compilation jobs." }
, {nil, "linkjobs", "kv", nil, "Set the number of parallel link jobs." }
- , {'w', "warning", "k", false , "Enable the warnings output." }
+ , {'w', "warning", "k", false , "Enable the warnings output. (deprecated)" }
, {nil, "files", "kv", nil , "Build the given source files.",
"e.g. ",
" - xmake --files=src/main.c",
diff --git a/xmake/actions/global/xmake.lua b/xmake/actions/global/xmake.lua
index f9bd90921..b8709d70f 100644
--- a/xmake/actions/global/xmake.lua
+++ b/xmake/actions/global/xmake.lua
@@ -37,12 +37,11 @@ task("global")
{nil, "debugger", "kv", "auto" , "The debugger program path." },
{nil, "ccache", "kv", nil , "Enable or disable the c/c++ compiler cache." },
{category = "Build Configuration"},
- {nil, "build_warning", "kv", nil , "Enable the warnings output by default when building." },
{nil, "cachedir", "kv", nil , "The global cache directory." },
{nil, "policies", "kv", nil , "Set the global project policies.",
" e.g.",
" - xmake g --policies=run.autobuild",
- " - xmake g --policies=build.warning" },
+ " - xmake g --policies=build.warning:n" },
-- network configuration
{category = "Network Configuration"},
{nil, "network", "kv", "public" , "Set the network mode."
diff --git a/xmake/core/sandbox/modules/import/core/project/policy.lua b/xmake/core/sandbox/modules/import/core/project/policy.lua
index 254ab8620..7a1338a6b 100644
--- a/xmake/core/sandbox/modules/import/core/project/policy.lua
+++ b/xmake/core/sandbox/modules/import/core/project/policy.lua
@@ -40,9 +40,6 @@ function sandbox_core_project_policy.build_warnings()
if warnings == nil and os.isfile(os.projectfile()) and project.policy("build.warning") ~= nil then
warnings = project.policy("build.warning")
end
- if warnings == nil then
- warnings = global.get("build_warning")
- end
sandbox_core_project_policy._BUILD_WARNINGS = warnings or false
end
return warnings
diff --git a/xmake/modules/core/tools/armasm.lua b/xmake/modules/core/tools/armasm.lua
index 84c38b8c6..4da0d83ab 100644
--- a/xmake/modules/core/tools/armasm.lua
+++ b/xmake/modules/core/tools/armasm.lua
@@ -21,6 +21,7 @@
-- imports
import("core.base.option")
import("core.base.global")
+import("core.project.policy")
import("core.language.language")
import("utils.progress")
@@ -126,7 +127,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") or global.get("build_warning")) then
+ if warnings and #warnings > 0 and policy.build_warnings() then
if progress.showing_without_scroll() then
print("")
end
diff --git a/xmake/modules/core/tools/armasm_msvc.lua b/xmake/modules/core/tools/armasm_msvc.lua
index 6a2e5c755..cc21b94b1 100644
--- a/xmake/modules/core/tools/armasm_msvc.lua
+++ b/xmake/modules/core/tools/armasm_msvc.lua
@@ -21,6 +21,7 @@
-- imports
import("core.base.option")
import("core.base.global")
+import("core.project.policy")
import("core.language.language")
import("utils.progress")
@@ -120,7 +121,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") or global.get("build_warning")) then
+ if warnings and #warnings > 0 and policy.build_warnings() then
if progress.showing_without_scroll() then
print("")
end
diff --git a/xmake/modules/core/tools/armcc.lua b/xmake/modules/core/tools/armcc.lua
index b4c349873..369ebaa48 100644
--- a/xmake/modules/core/tools/armcc.lua
+++ b/xmake/modules/core/tools/armcc.lua
@@ -21,6 +21,7 @@
-- imports
import("core.base.option")
import("core.base.global")
+import("core.project.policy")
import("core.language.language")
import("utils.progress")
@@ -175,7 +176,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") or global.get("build_warning")) then
+ if warnings and #warnings > 0 and policy.build_warnings() then
if progress.showing_without_scroll() then
print("")
end
diff --git a/xmake/modules/core/tools/llvm_rc.lua b/xmake/modules/core/tools/llvm_rc.lua
index 7feb8a621..e1f353902 100644
--- a/xmake/modules/core/tools/llvm_rc.lua
+++ b/xmake/modules/core/tools/llvm_rc.lua
@@ -21,6 +21,7 @@
-- imports
import("core.base.option")
import("core.base.global")
+import("core.project.policy")
import("core.project.project")
-- init it
@@ -78,7 +79,7 @@ function compile(self, sourcefile, objectfile, dependinfo, flags)
function (ok, warnings)
-- print some warnings
- if warnings and #warnings > 0 and (option.get("diagnosis") or option.get("warning") or global.get("build_warning")) then
+ if warnings and #warnings > 0 and policy.build_warnings() 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 e67dc0749..49041d7ba 100644
--- a/xmake/modules/core/tools/nvcc.lua
+++ b/xmake/modules/core/tools/nvcc.lua
@@ -25,6 +25,7 @@ import("core.project.config")
import("core.project.project")
import("core.platform.platform")
import("core.language.language")
+import("core.project.policy")
import("utils.progress")
-- init it
@@ -423,7 +424,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") or global.get("build_warning")) then
+ if warnings and #warnings > 0 and policy.build_warnings() then
if progress.showing_without_scroll() then
print("")
end
diff --git a/xmake/modules/core/tools/sdasstm8.lua b/xmake/modules/core/tools/sdasstm8.lua
index 82c19c9fe..86927a345 100644
--- a/xmake/modules/core/tools/sdasstm8.lua
+++ b/xmake/modules/core/tools/sdasstm8.lua
@@ -21,9 +21,9 @@
-- imports
import("core.base.option")
import("core.base.global")
-import("utils.progress")
+import("core.project.policy")
import("core.language.language")
-
+import("utils.progress")
-- make the includedir flag
function nf_includedir(self, dir)
@@ -85,7 +85,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") or global.get("build_warning")) then
+ if warnings and #warnings > 0 and policy.build_warnings() 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 624b23454..fbbe496d6 100644
--- a/xmake/modules/core/tools/sdcc.lua
+++ b/xmake/modules/core/tools/sdcc.lua
@@ -21,8 +21,9 @@
-- imports
import("core.base.option")
import("core.base.global")
-import("utils.progress")
+import("core.project.policy")
import("core.language.language")
+import("utils.progress")
-- init it
function init(self)
@@ -225,7 +226,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") or global.get("build_warning")) then
+ if warnings and #warnings > 0 and policy.build_warnings() 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 84eae246d..13592a045 100644
--- a/xmake/modules/core/tools/tcc.lua
+++ b/xmake/modules/core/tools/tcc.lua
@@ -23,6 +23,7 @@ import("core.base.option")
import("core.base.global")
import("core.project.config")
import("core.project.project")
+import("core.project.policy")
import("core.language.language")
-- init it
@@ -186,7 +187,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") or global.get("build_warning")) then
+ if warnings and #warnings > 0 and policy.build_warnings() 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 a7940ce67..74f8da7c0 100644
--- a/xmake/modules/core/tools/windres.lua
+++ b/xmake/modules/core/tools/windres.lua
@@ -21,6 +21,7 @@
-- imports
import("core.base.option")
import("core.base.global")
+import("core.project.policy")
import("core.project.project")
-- init it
@@ -72,7 +73,7 @@ function compile(self, sourcefile, objectfile, dependinfo, flags)
finally
{
function (ok, warnings)
- if warnings and #warnings > 0 and (option.get("diagnosis") or option.get("warning") or global.get("build_warning")) then
+ if warnings and #warnings > 0 and policy.build_warnings() then
cprint("${color.warning}%s", table.concat(table.slice(warnings:split('\n'), 1, 8), '\n'))
end
end