diff options
| author | JassJam <[email protected]> | 2026-02-25 09:55:53 +0000 |
|---|---|---|
| committer | ruki <[email protected]> | 2026-03-14 00:10:58 +0800 |
| commit | a35ec2dcea9ca5c639ca9d1332a46ede16b959c0 (patch) | |
| tree | 83c653a47a82343cabf8f8b94c88ed57426bdefc | |
| parent | 3cf64d9220b3c581becd99a8f6cb316462f1bad5 (diff) | |
refactor: update dotnet verbosity handling in C# rules, dont add a new policy
| -rw-r--r-- | xmake/core/project/policy.lua | 2 | ||||
| -rw-r--r-- | xmake/rules/csharp/buildcmd.lua | 2 | ||||
| -rw-r--r-- | xmake/rules/csharp/csharp_common.lua | 19 | ||||
| -rw-r--r-- | xmake/rules/csharp/install.lua | 2 | ||||
| -rw-r--r-- | xmake/rules/csharp/installcmd.lua | 2 | ||||
| -rw-r--r-- | xmake/rules/csharp/xmake.lua | 3 |
6 files changed, 8 insertions, 22 deletions
diff --git a/xmake/core/project/policy.lua b/xmake/core/project/policy.lua index 09751ba72..0cf184d91 100644 --- a/xmake/core/project/policy.lua +++ b/xmake/core/project/policy.lua @@ -125,8 +125,6 @@ function policy.policies() ["build.progress_style"] = {description = "Set the build progress output style.", type = "string", values = {"scroll", "singlerow", "multirow"}}, -- Show target name in build progress output ["build.progress_show_target"] = {description = "Show target name in build progress output.", default = true, type = "boolean"}, - -- Set dotnet verbosity for csharp rule, e.g. quiet|minimal|normal|detailed|diagnostic - ["build.csharp.dotnet_verbosity"] = {description = "Set dotnet verbosity for csharp rule.", type = "string", values = {"quiet", "minimal", "normal", "detailed", "diagnostic"}}, -- Enable windows UAC and set level, e.g. invoker, admin, highest ["windows.manifest.uac"] = {description = "Enable windows manifest UAC.", type = "string"}, -- Enable ui access for windows UAC diff --git a/xmake/rules/csharp/buildcmd.lua b/xmake/rules/csharp/buildcmd.lua index 209c76027..e3c45ace8 100644 --- a/xmake/rules/csharp/buildcmd.lua +++ b/xmake/rules/csharp/buildcmd.lua @@ -24,7 +24,7 @@ function main(target, batchcmds, opt) local csprojfile = assert(csharp_common.find_csproj(target), "target(%s): missing csharp .csproj file!", target:name()) local dotnet = csharp_common.get_dotnet_program(target) local configuration = csharp_common.build_mode_to_configuration() - local verbosity = csharp_common.get_dotnet_verbosity(target) + local verbosity = csharp_common.get_dotnet_verbosity() local command = target:is_binary() and "publish" or "build" local argv = { command, csprojfile, diff --git a/xmake/rules/csharp/csharp_common.lua b/xmake/rules/csharp/csharp_common.lua index ddfa241bc..1df548c60 100644 --- a/xmake/rules/csharp/csharp_common.lua +++ b/xmake/rules/csharp/csharp_common.lua @@ -18,6 +18,8 @@ -- @file csharp_common.lua -- +import("core.base.option") + function _map_rid_arch(arch) arch = (arch or ""):lower() if arch == "x64" or arch == "x86_64" or arch == "amd64" then @@ -121,20 +123,9 @@ function get_dotnet_runopt(csprojfile) } end -function get_dotnet_verbosity(target) - local verbosity = target:values("csharp.dotnet_verbosity") - if type(verbosity) == "table" then - verbosity = verbosity[1] - end - if not (verbosity and #verbosity > 0) then - verbosity = target:policy("build.csharp.dotnet_verbosity") - end - if verbosity and #verbosity > 0 then - verbosity = verbosity:lower() - if table.contains({"quiet", "minimal", "normal", "detailed", "diagnostic"}, verbosity) then - return verbosity - end - raise("target(%s): invalid csharp.dotnet_verbosity(%s), expected one of: quiet|minimal|normal|detailed|diagnostic", target:name(), verbosity) +function get_dotnet_verbosity() + if option.get("diagnosis") then + return "diagnostic" end return "quiet" end diff --git a/xmake/rules/csharp/install.lua b/xmake/rules/csharp/install.lua index 05d48e2c5..34109a054 100644 --- a/xmake/rules/csharp/install.lua +++ b/xmake/rules/csharp/install.lua @@ -32,7 +32,7 @@ function main(target, opt) local csprojfile = assert(csharp_common.find_csproj(target), "target(%s): missing csharp .csproj file!", target:name()) local dotnet = csharp_common.get_dotnet_program(target) local configuration = csharp_common.build_mode_to_configuration() - local verbosity = csharp_common.get_dotnet_verbosity(target) + local verbosity = csharp_common.get_dotnet_verbosity() local install_path = target:installdir() if target:is_binary() then diff --git a/xmake/rules/csharp/installcmd.lua b/xmake/rules/csharp/installcmd.lua index c483eb432..76c051a59 100644 --- a/xmake/rules/csharp/installcmd.lua +++ b/xmake/rules/csharp/installcmd.lua @@ -24,7 +24,7 @@ function main(target, batchcmds, opt) local csprojfile = assert(csharp_common.find_csproj(target), "target(%s): missing csharp .csproj file!", target:name()) local dotnet = csharp_common.get_dotnet_program(target) local configuration = csharp_common.build_mode_to_configuration() - local verbosity = csharp_common.get_dotnet_verbosity(target) + local verbosity = csharp_common.get_dotnet_verbosity() local install_path = target:installdir() if target:is_binary() then diff --git a/xmake/rules/csharp/xmake.lua b/xmake/rules/csharp/xmake.lua index 778ea4fc4..5d358e099 100644 --- a/xmake/rules/csharp/xmake.lua +++ b/xmake/rules/csharp/xmake.lua @@ -28,9 +28,6 @@ -- -- -- optional: override runtime identifier (arch-specific) for self-contained publish (e.g. "win-x64", "linux-x64", "osx-x64", "osx-arm64") -- -- add_values("csharp.runtime_identifier", "win-x64") --- --- -- optional: dotnet verbosity (quiet|minimal|normal|detailed|diagnostic) --- -- set_policy("build.csharp.dotnet_verbosity", "minimal") -- @endcode -- rule("csharp") |
