diff --git a/Build.ps1 b/Build.ps1 index fab3228..fd8264e 100644 --- a/Build.ps1 +++ b/Build.ps1 @@ -3,8 +3,8 @@ echo "build: Build started" Push-Location $PSScriptRoot if(Test-Path .\artifacts) { - echo "build: Cleaning ./artifacts" - Remove-Item ./artifacts -Force -Recurse + echo "build: Cleaning .\artifacts" + Remove-Item .\artifacts -Force -Recurse } & dotnet restore --no-cache @@ -16,32 +16,31 @@ $commitHash = $(git rev-parse --short HEAD) $buildSuffix = @{ $true = "$($suffix)-$($commitHash)"; $false = "$($branch)-$($commitHash)" }[$suffix -ne ""] echo "build: Package version suffix is $suffix" -echo "build: Build version suffix is $buildSuffix" +echo "build: Build version suffix is $buildSuffix" -foreach ($src in gci src/*) { +foreach ($src in ls src/*) { Push-Location $src echo "build: Packaging project in $src" - & dotnet build -c Release --version-suffix=$buildSuffix - - if($suffix) { - & dotnet pack -c Release --include-source --no-build -o ../../artifacts --version-suffix=$suffix + & dotnet build -c Release --version-suffix=$buildSuffix -p:EnableSourceLink=true + if ($suffix) { + & dotnet pack -c Release -o ..\..\artifacts --version-suffix=$suffix --no-build } else { - & dotnet pack -c Release --include-source --no-build -o ../../artifacts + & dotnet pack -c Release -o ..\..\artifacts --no-build } - if($LASTEXITCODE -ne 0) { exit 1 } + if($LASTEXITCODE -ne 0) { throw "build failed" } Pop-Location } -foreach ($test in gci test/*.Tests) { +foreach ($test in ls test/*.Tests) { Push-Location $test echo "build: Testing project in $test" & dotnet test -c Release - if($LASTEXITCODE -ne 0) { exit 3 } + if($LASTEXITCODE -ne 0) { throw "tests failed" } Pop-Location } @@ -49,10 +48,10 @@ foreach ($test in gci test/*.Tests) { foreach ($test in ls test/*.PerformanceTests) { Push-Location $test - echo "build: Building performance test project in $test" + echo "build: Building project in $test" & dotnet build -c Release - if($LASTEXITCODE -ne 0) { exit 2 } + if($LASTEXITCODE -ne 0) { throw "performance test build failed" } Pop-Location } diff --git a/src/Serilog.Expressions/Expressions/Helpers.cs b/src/Serilog.Expressions/Expressions/Helpers.cs index 20f57af..e18e19c 100644 --- a/src/Serilog.Expressions/Expressions/Helpers.cs +++ b/src/Serilog.Expressions/Expressions/Helpers.cs @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if NETSTANDARD2_0 +#if NO_CI_STRING_CONTAINS namespace Serilog.Expressions { diff --git a/src/Serilog.Expressions/Expressions/Runtime/Coerce.cs b/src/Serilog.Expressions/Expressions/Runtime/Coerce.cs index dd42ba0..6f9f424 100644 --- a/src/Serilog.Expressions/Expressions/Runtime/Coerce.cs +++ b/src/Serilog.Expressions/Expressions/Runtime/Coerce.cs @@ -60,7 +60,7 @@ public static bool IsTrue(LogEventPropertyValue? value) return Boolean(value, out var b) && b; } - public static bool String(LogEventPropertyValue? value, [MaybeNullWhen(false)] out string str) + public static bool String(LogEventPropertyValue? value, [NotNullWhen(true)] out string? str) { if (value is ScalarValue sv) { diff --git a/src/Serilog.Expressions/Expressions/Runtime/RuntimeOperators.cs b/src/Serilog.Expressions/Expressions/Runtime/RuntimeOperators.cs index 00058ce..331e20d 100644 --- a/src/Serilog.Expressions/Expressions/Runtime/RuntimeOperators.cs +++ b/src/Serilog.Expressions/Expressions/Runtime/RuntimeOperators.cs @@ -206,6 +206,7 @@ static bool UnboxedEqualHelper(StringComparison sc, LogEventPropertyValue? left, for (var i = 0; i < arr.Elements.Count; ++i) { var element = arr.Elements[i]; + // ReSharper disable once ConditionIsAlwaysTrueOrFalseAccordingToNullableAPIContract if (element != null && UnboxedEqualHelper(sc, element, item)) return ConstantTrue; } @@ -350,6 +351,7 @@ public static LogEventPropertyValue IsDefined(LogEventPropertyValue? value) { // The lack of eager numeric type coercion means that here, `sv` may logically equal one // of the keys, but not be equal according to the dictionary's `IEqualityComparer`. + // ReSharper disable once ConditionIsAlwaysTrueOrFalseAccordingToNullableAPIContract var entry = dict.Elements.FirstOrDefault(kv => kv.Key != null && UnboxedEqualHelper(sc, kv.Key, sv)); return entry.Value; // KVP is a struct; default is a pair of nulls. } diff --git a/src/Serilog.Expressions/Serilog.Expressions.csproj b/src/Serilog.Expressions/Serilog.Expressions.csproj index 9a2b2bd..5c49a66 100644 --- a/src/Serilog.Expressions/Serilog.Expressions.csproj +++ b/src/Serilog.Expressions/Serilog.Expressions.csproj @@ -3,7 +3,7 @@ An embeddable mini-language for filtering, enriching, and formatting Serilog events, ideal for use with JSON or XML configuration. - 5.0.1 + 5.0.0 Serilog Contributors net471;net462 @@ -22,12 +22,21 @@ README.md + + $(DefineConstants);NO_CI_STRING_CONTAINS + + + + $(DefineConstants);NO_CI_STRING_CONTAINS + + + + $(DefineConstants);NO_CI_STRING_CONTAINS + + - - - diff --git a/test/Serilog.Expressions.Tests/Cases/expression-evaluation-cases.asv b/test/Serilog.Expressions.Tests/Cases/expression-evaluation-cases.asv index 102b748..edd8f8a 100644 --- a/test/Serilog.Expressions.Tests/Cases/expression-evaluation-cases.asv +++ b/test/Serilog.Expressions.Tests/Cases/expression-evaluation-cases.asv @@ -302,7 +302,6 @@ undefined() = undefined() ci ⇶ undefined() 'test' like '%' ⇶ true 'test' like 't%s%' ⇶ true 'test' like 'es' ⇶ false -'test' like '%' ⇶ true 'test' like '' ⇶ false '' like '' ⇶ true diff --git a/test/Serilog.Expressions.Tests/ExpressionTranslationTests.cs b/test/Serilog.Expressions.Tests/ExpressionTranslationTests.cs index e2df67d..45926aa 100644 --- a/test/Serilog.Expressions.Tests/ExpressionTranslationTests.cs +++ b/test/Serilog.Expressions.Tests/ExpressionTranslationTests.cs @@ -7,11 +7,11 @@ namespace Serilog.Expressions.Tests; public class ExpressionTranslationTests { - public static IEnumerable ExpressionEvaluationCases => + public static IEnumerable ExpressionTranslationCases => AsvCases.ReadCases("translation-cases.asv"); [Theory] - [MemberData(nameof(ExpressionEvaluationCases))] + [MemberData(nameof(ExpressionTranslationCases))] public void ExpressionsAreCorrectlyTranslated(string expr, string expected) { var parsed = new ExpressionParser().Parse(expr);