Skip to content

Commit

Permalink
Merge branch 'dev' into feature/nullableReference
Browse files Browse the repository at this point in the history
  • Loading branch information
nblumhardt authored Jul 12, 2021
2 parents d3d36f6 + ddb04ae commit 89af075
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 50 deletions.
17 changes: 10 additions & 7 deletions Build.ps1
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
Write-Host "build: Build started"
Write-Output "build: Build started"

& dotnet --info
& dotnet --list-sdks

Push-Location $PSScriptRoot

if(Test-Path .\artifacts) {
Write-Host "build: Cleaning .\artifacts"
Write-Output "build: Cleaning .\artifacts"
Remove-Item .\artifacts -Force -Recurse
}

Expand All @@ -15,13 +18,13 @@ $suffix = @{ $true = ""; $false = "$($branch.Substring(0, [math]::Min(10,$branch
$commitHash = $(git rev-parse --short HEAD)
$buildSuffix = @{ $true = "$($suffix)-$($commitHash)"; $false = "$($branch)-$($commitHash)" }[$suffix -ne ""]

Write-Host "build: Package version suffix is $suffix"
Write-Host "build: Build version suffix is $buildSuffix"
Write-Output "build: Package version suffix is $suffix"
Write-Output "build: Build version suffix is $buildSuffix"

foreach ($src in Get-ChildItem src/*) {
Push-Location $src

Write-Host "build: Packaging project in $src"
Write-Output "build: Packaging project in $src"

& dotnet build -c Release --version-suffix=$buildSuffix
if ($suffix) {
Expand All @@ -37,7 +40,7 @@ foreach ($src in Get-ChildItem src/*) {
foreach ($sample in Get-ChildItem sample/*) {
Push-Location $sample

Write-Host "build: Testing project in $sample"
Write-Output "build: Testing project in $sample"

& dotnet build -c Release --version-suffix=$buildSuffix
if($LASTEXITCODE -ne 0) { exit 3 }
Expand All @@ -48,7 +51,7 @@ foreach ($sample in Get-ChildItem sample/*) {
foreach ($test in Get-ChildItem test/*.Tests) {
Push-Location $test

Write-Host "build: Testing project in $test"
Write-Output "build: Testing project in $test"

& dotnet test -c Release
if($LASTEXITCODE -ne 0) { exit 3 }
Expand Down
2 changes: 1 addition & 1 deletion sample/ConsoleDemo/ConsoleDemo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net45;netcoreapp2.2</TargetFrameworks>
<TargetFrameworks>netcoreapp2.1;netcoreapp2.2;netcoreapp3.0;netcoreapp3.1;net452;net462;net472;net48</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ public static class ConsoleLoggerConfigurationExtensions
/// uses <see cref="SystemConsoleTheme.Literate"/>.</param>
/// <param name="applyThemeToRedirectedOutput">Applies the selected or default theme even when output redirection is detected.</param>
/// <returns>Configuration object allowing method chaining.</returns>
/// <exception cref="ArgumentNullException">When <paramref name="sinkConfiguration"/> is <code>null</code></exception>
/// <exception cref="ArgumentNullException">When <paramref name="outputTemplate"/> is <code>null</code></exception>
public static LoggerConfiguration Console(
this LoggerSinkConfiguration sinkConfiguration,
LogEventLevel restrictedToMinimumLevel = LevelAlias.Minimum,
Expand Down Expand Up @@ -89,6 +91,8 @@ public static LoggerConfiguration Console(
/// to be changed at runtime.</param>
/// <param name="standardErrorFromLevel">Specifies the level at which events will be written to standard error.</param>
/// <returns>Configuration object allowing method chaining.</returns>
/// <exception cref="ArgumentNullException">When <paramref name="sinkConfiguration"/> is <code>null</code></exception>
/// <exception cref="ArgumentNullException">When <paramref name="formatter"/> is <code>null</code></exception>
public static LoggerConfiguration Console(
this LoggerSinkConfiguration sinkConfiguration,
ITextFormatter formatter,
Expand Down
33 changes: 6 additions & 27 deletions src/Serilog.Sinks.Console/Serilog.Sinks.Console.csproj
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Description>A Serilog sink that writes log events to the console/terminal.</Description>
<VersionPrefix>4.0.0</VersionPrefix>
<Authors>Serilog Contributors</Authors>
<TargetFrameworks>net45;netstandard1.3;netstandard2.0;netstandard2.1;netcoreapp1.1;netcoreapp2.0;netcoreapp3.0;netcoreapp3.1;</TargetFrameworks>
<TargetFrameworks>net45;netstandard1.3;netstandard2.0;</TargetFrameworks>
<LangVersion>8.0</LangVersion>
<Nullable>enable</Nullable>
<AssemblyName>Serilog.Sinks.Console</AssemblyName>
Expand All @@ -22,39 +22,18 @@
<GenerateAssemblyFileVersionAttribute>true</GenerateAssemblyFileVersionAttribute>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<!-- Don't reference the full NETStandard.Library -->
<DisableImplicitFrameworkReferences Condition=" '$(TargetFramework)' != 'netstandard2.0' And '$(TargetFramework)' != 'netstandard2.1' And '$(TargetFramework)' != 'netcoreapp2.0' And '$(TargetFramework)' != 'netcoreapp3.0' And '$(TargetFramework)' != 'netcoreapp3.1' ">true</DisableImplicitFrameworkReferences>
<DisableImplicitFrameworkReferences Condition=" '$(TargetFramework)' != 'netstandard2.0' ">true</DisableImplicitFrameworkReferences>
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
<TreatSpecificWarningsAsErrors />
<RootNamespace>Serilog</RootNamespace>
</PropertyGroup>


<PropertyGroup Condition=" '$(TargetFramework)' == 'net45' ">
<DefineConstants>$(DefineConstants);PINVOKE</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == 'netcoreapp1.1' or '$(TargetFramework)' == 'netcoreapp2.0' or '$(TargetFramework)' == 'netcoreapp3.0' or '$(TargetFramework)' == 'netcoreapp3.1' ">
<DefineConstants>$(DefineConstants);PINVOKE;RUNTIME_INFORMATION</DefineConstants>
<PropertyGroup Condition=" '$(TargetFramework)' != 'net45' ">
<DefineConstants>$(DefineConstants);RUNTIME_INFORMATION</DefineConstants>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Serilog" Version="2.8.0" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net45' ">
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.3' or '$(TargetFramework)' == 'netstandard2.0' or '$(TargetFramework)' == 'netstandard2.1' ">
<PackageReference Include="System.Console" Version="4.3.0" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp1.1' or '$(TargetFramework)' == 'netcoreapp2.0' or '$(TargetFramework)' == 'netcoreapp3.0' or '$(TargetFramework)' == 'netcoreapp3.1' ">
<PackageReference Include="System.Console" Version="4.3.0" />
<PackageReference Include="System.Runtime.InteropServices" Version="4.3.0" />
<PackageReference Include="System.Runtime.InteropServices.RuntimeInformation" Version="4.3.0" />
</ItemGroup>

</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,13 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#if PINVOKE
using System;
using System.Runtime.InteropServices;
#endif

namespace Serilog.Sinks.SystemConsole.Platform
{
static class WindowsConsole
{
#if PINVOKE
public static void EnableVirtualTerminalProcessing()
{
#if RUNTIME_INFORMATION
Expand Down Expand Up @@ -50,10 +47,6 @@ public static void EnableVirtualTerminalProcessing()

[DllImport("kernel32.dll", SetLastError = true)]
static extern bool SetConsoleMode(IntPtr handle, uint mode);
#else
public static void EnableVirtualTerminalProcessing()
{
}
#endif

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public class AnsiConsoleTheme : ConsoleTheme
/// Construct a theme given a set of styles.
/// </summary>
/// <param name="styles">Styles to apply within the theme.</param>
/// <exception cref="ArgumentNullException">When <paramref name="styles"/> is <code>null</code></exception>
public AnsiConsoleTheme(IReadOnlyDictionary<ConsoleThemeStyle, string> styles)
{
if (styles is null) throw new ArgumentNullException(nameof(styles));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public class SystemConsoleTheme : ConsoleTheme
/// Construct a theme given a set of styles.
/// </summary>
/// <param name="styles">Styles to apply within the theme.</param>
/// <exception cref="ArgumentNullException">When <paramref name="styles"/> is <code>null</code></exception>
public SystemConsoleTheme(IReadOnlyDictionary<ConsoleThemeStyle, SystemConsoleThemeStyle> styles)
{
if (styles is null) throw new ArgumentNullException(nameof(styles));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net452;net462;net472;net48;netcoreapp2.2;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>netcoreapp2.1;netcoreapp2.2;netcoreapp3.0;netcoreapp3.1;net452;net462;net472;net48</TargetFrameworks>
<AssemblyName>Serilog.Sinks.SystemConsole.Tests</AssemblyName>
<PackageId>Serilog.Sinks.Console.Tests</PackageId>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
Expand All @@ -27,16 +27,12 @@

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.2">
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
</ItemGroup>

<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>

</Project>

0 comments on commit 89af075

Please sign in to comment.