From: Michal Strehovský Date: Tue, 31 Jan 2023 16:25:08 +0000 (+0900) Subject: Allow overriding WarningsAsErrors policy with an env variable (#81402) X-Git-Tag: accepted/tizen/unified/riscv/20231226.055536~4315 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d7d154d7e25b5a4472b75c963b0a73dc23f5fb9b;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Allow overriding WarningsAsErrors policy with an env variable (#81402) * Allow overriding WarningsAsErrors policy with an env variable Placing `WarningsAsErrors=false` in an environment variable will disable the repo policy to waste people's time with frivolous warnings in their inner dev loop. * Update build.sh --- diff --git a/Directory.Build.props b/Directory.Build.props index f3f56ce..9e8b408 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -318,7 +318,7 @@ latest strict;nullablePublicOnly - true + true $(NoWarn),CS8969 diff --git a/eng/build.ps1 b/eng/build.ps1 index a6a3941..aed36f5 100644 --- a/eng/build.ps1 +++ b/eng/build.ps1 @@ -267,6 +267,10 @@ foreach ($argument in $PSBoundParameters.Keys) } } +if ($env:TreatWarningsAsErrors -eq 'false') { + $arguments += " -warnAsError 0" +} + # Disable targeting pack caching as we reference a partially constructed targeting pack and update it later. # The later changes are ignored when using the cache. $env:DOTNETSDK_ALLOW_TARGETING_PACK_CACHING=0 diff --git a/eng/build.sh b/eng/build.sh index 215d93f..1147ec2 100755 --- a/eng/build.sh +++ b/eng/build.sh @@ -512,6 +512,10 @@ if [[ "$os" == "wasi" ]]; then arch=wasm fi +if [[ "${TreatWarningsAsErrors:-}" == "false" ]]; then + arguments="$arguments -warnAsError 0" +fi + initDistroRid $os $arch $crossBuild $portableBuild # Disable targeting pack caching as we reference a partially constructed targeting pack and update it later. diff --git a/src/coreclr/System.Private.CoreLib/System.Private.CoreLib.csproj b/src/coreclr/System.Private.CoreLib/System.Private.CoreLib.csproj index 1671023..5ee434a 100644 --- a/src/coreclr/System.Private.CoreLib/System.Private.CoreLib.csproj +++ b/src/coreclr/System.Private.CoreLib/System.Private.CoreLib.csproj @@ -46,7 +46,6 @@ $(ProductVersion) $(ProductVersion) - true $(NoWarn),0419,0649,CA2249,CA1830 enable diff --git a/src/coreclr/nativeaot/Directory.Build.props b/src/coreclr/nativeaot/Directory.Build.props index 94ee136..275f039 100644 --- a/src/coreclr/nativeaot/Directory.Build.props +++ b/src/coreclr/nativeaot/Directory.Build.props @@ -25,7 +25,6 @@ false v4.0.30319 - true $(NoWarn),0419,0649,CA2249,CA1830 diff --git a/src/coreclr/tools/aot/ILCompiler/repro/repro.csproj b/src/coreclr/tools/aot/ILCompiler/repro/repro.csproj index f2d7f5c..48b2709 100644 --- a/src/coreclr/tools/aot/ILCompiler/repro/repro.csproj +++ b/src/coreclr/tools/aot/ILCompiler/repro/repro.csproj @@ -9,7 +9,6 @@ linux-x64;win-x64;osx-x64;freebsd-x64 Debug;Release;Checked true - false false diff --git a/src/mono/System.Private.CoreLib/System.Private.CoreLib.csproj b/src/mono/System.Private.CoreLib/System.Private.CoreLib.csproj index fd6ada4..db2a7d2 100644 --- a/src/mono/System.Private.CoreLib/System.Private.CoreLib.csproj +++ b/src/mono/System.Private.CoreLib/System.Private.CoreLib.csproj @@ -33,7 +33,6 @@ $(ProductVersion) $(ProductVersion) - true $(NoWarn),0419,0649 enable