Skip to content

Commit a6f7331

Browse files
authored
Merge pull request #26 from serilog/dev
Push stable release
2 parents 9dfac39 + fd287b7 commit a6f7331

File tree

12 files changed

+112
-138
lines changed

12 files changed

+112
-138
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,4 +192,5 @@ FakesAssemblies/
192192
.idea
193193

194194
# macOS
195-
.DS_Store
195+
.DS_Store
196+
/.vs

Build.ps1

Lines changed: 26 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,42 @@
1-
param(
2-
[String] $majorMinorPatch = "0.0.0", # 2.0
3-
[String] $revision = "0", # $env:APPVEYOR_BUILD_VERSION
4-
[String] $customLogger = "", # C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll
5-
[Switch] $notouch,
6-
[String] $sln # e.g serilog-sink-name
7-
)
1+
echo "build: Build started"
82

9-
function Set-AssemblyVersions($informational, $assembly)
10-
{
11-
(Get-Content assets/CommonAssemblyInfo.cs) |
12-
ForEach-Object { $_ -replace """1.0.0.0""", """$assembly""" } |
13-
ForEach-Object { $_ -replace """1.0.0""", """$informational""" } |
14-
ForEach-Object { $_ -replace """1.1.1.1""", """$($informational).0""" } |
15-
Set-Content assets/CommonAssemblyInfo.cs
16-
}
17-
18-
function Install-NuGetPackages($solution)
19-
{
20-
nuget restore $solution
21-
}
3+
Push-Location $PSScriptRoot
224

23-
function Invoke-MSBuild($solution, $assembly, $customLogger)
24-
{
25-
if ($customLogger)
26-
{
27-
msbuild "$solution" /verbosity:minimal /p:Configuration=Release /p:AssemblyVersion=$assembly /p:FileVersion=$assembly /p:InformationalVersion=$assembly /logger:"$customLogger"
28-
}
29-
else
30-
{
31-
msbuild "$solution" /verbosity:minimal /p:Configuration=Release /p:AssemblyVersion=$assembly /p:FileVersion=$assembly /p:InformationalVersion=$assembly
32-
}
5+
if(Test-Path .\artifacts) {
6+
echo "build: Cleaning .\artifacts"
7+
Remove-Item .\artifacts -Force -Recurse
338
}
349

35-
function Invoke-NuGetPack($version)
36-
{
37-
nuget pack "src/Serilog.Sinks.Xamarin.nuspec" -Version $version -OutputDirectory artifacts\ -properties Configuration=Release
38-
}
10+
$branch = @{ $true = $env:APPVEYOR_REPO_BRANCH; $false = $(git symbolic-ref --short -q HEAD) }[$env:APPVEYOR_REPO_BRANCH -ne $NULL];
11+
$revision = @{ $true = "{0:00000}" -f [convert]::ToInt32("0" + $env:APPVEYOR_BUILD_NUMBER, 10); $false = "local" }[$env:APPVEYOR_BUILD_NUMBER -ne $NULL];
12+
$suffix = @{ $true = ""; $false = "$($branch.Substring(0, [math]::Min(10,$branch.Length)))-$revision"}[$branch -eq "main" -and $revision -ne "local"]
13+
$commitHash = $(git rev-parse --short HEAD)
14+
$buildSuffix = @{ $true = "$($suffix)-$($commitHash)"; $false = "$($branch)-$($commitHash)" }[$suffix -ne ""]
3915

40-
function Invoke-Build($majorMinorPatch, $revision, $customLogger, $notouch, $sln)
41-
{
42-
$package="$majorMinorPatch.$revision"
43-
$slnfile = "$sln.sln"
16+
echo "build: Package version suffix is $suffix"
17+
echo "build: Build version suffix is $buildSuffix"
4418

45-
Write-Output "$sln $package"
19+
foreach ($src in ls src/*) {
20+
Push-Location $src
4621

47-
if (-not $notouch)
48-
{
49-
$assembly = "$majorMinorPatch.$revision"
22+
echo "build: Packaging project in $src"
5023

51-
Write-Output "Assembly version will be set to $assembly"
52-
Set-AssemblyVersions $package $assembly
53-
}
24+
& msbuild /r /m /p:Configuration=Release /p:VersionSuffix=$buildSuffix /p:EnableSourceLink=true "/p:PackageOutputPath=..\..\artifacts"
5425

55-
$assembly = "$majorMinorPatch.$revision"
26+
if($LASTEXITCODE -ne 0) { exit 1 }
5627

57-
Write-Output "Assembly version will be set to $assembly"
58-
Set-AssemblyVersions $package $assembly
59-
60-
Install-NuGetPackages $slnfile
61-
62-
Invoke-MSBuild $slnfile $assembly $customLogger
63-
64-
Invoke-NuGetPack $package
28+
Pop-Location
6529
}
6630

67-
$ErrorActionPreference = "Stop"
31+
foreach ($test in ls test/*.Tests) {
32+
Push-Location $test
33+
34+
echo "build: Testing project in $test"
6835

69-
if (-not $sln)
70-
{
71-
$slnfull = ls *.sln |
72-
Where-Object { -not ($_.Name -like "*net40*") } |
73-
Select -first 1
36+
& dotnet test -c Release
37+
if($LASTEXITCODE -ne 0) { exit 3 }
7438

75-
$sln = $slnfull.BaseName
39+
Pop-Location
7640
}
7741

78-
Invoke-Build $majorMinorPatch $revision $customLogger $notouch $sln
42+
Pop-Location

README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,3 @@ Log.Information("This will be written to either NSLog or AndroidLog");
3636
```
3737

3838
Because the memory buffer may contain events that have not yet been written to the target sink, it is important to call `Log.CloseAndFlush()` or `Logger.Dispose()` when the application/activity exits.
39-
40-
### About this sink
41-
42-
This sink is maintained by [Geoffrey Huntley](https://ghuntley.com/).

appveyor.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,27 @@
11
version: '{build}'
22
skip_tags: true
3-
image: Visual Studio 2019
3+
image: Visual Studio 2022
44
configuration: Release
55
install:
6+
- ps: mkdir -Force ".\build\" | Out-Null
7+
- cmd: dotnet workload install maui macos android ios maccatalyst
68
- ps: mkdir -Force ".\artifacts\" | Out-Null
79
build_script:
8-
- ps: ./Build.ps1 -majorMinor 0.2.0 -revision "$env:APPVEYOR_BUILD_VERSION" -branch "$env:APPVEYOR_REPO_BRANCH"
10+
- ps: ./Build.ps1
911
test: off
1012
artifacts:
1113
- path: artifacts/Serilog.*.nupkg
1214
deploy:
1315
- provider: NuGet
1416
api_key:
15-
secure: N59tiJECUYpip6tEn0xvdmDAEiP9SIzyLEFLpwiigm/8WhJvBNs13QxzT1/3/JW/
17+
secure: 1vfQHBQJGc6+0gH8WeuPc2mcD8aAIih+umHmgR8V8tP4dGCs90uD70cbiY2oISAj
1618
skip_symbols: true
1719
on:
18-
branch: /^(master|dev)$/
20+
branch: /^(main|dev)$/
1921
- provider: GitHub
2022
auth_token:
2123
secure: p4LpVhBKxGS5WqucHxFQ5c7C8cP74kbNB0Z8k9Oxx/PMaDQ1+ibmoexNqVU5ZlmX
2224
artifact: /Serilog.*\.nupkg/
2325
tag: v$(appveyor_build_version)
2426
on:
25-
branch: master
27+
branch: main

assets/CommonAssemblyInfo.cs

Lines changed: 0 additions & 5 deletions
This file was deleted.

assets/serilog-sink-nuget.png

20.4 KB
Loading

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"msbuild-sdks": {
3-
"MSBuild.Sdk.Extras": "2.0.54"
3+
"MSBuild.Sdk.Extras": "3.0.44"
44
}
55
}

serilog-sinks-xamarin.sln

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
1-
21
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio 14
4-
VisualStudioVersion = 14.0.25420.1
2+
# Visual Studio Version 17
3+
VisualStudioVersion = 17.3.32708.82
54
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".solution", ".solution", "{D0A9316F-8F65-4C36-9FF4-EAE8E65EC005}"
5+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "sln", "sln", "{322FD05A-A274-4AF2-99CA-BCCB0B4400F5}"
76
ProjectSection(SolutionItems) = preProject
7+
appveyor.yml = appveyor.yml
8+
Build.ps1 = Build.ps1
9+
.gitignore = .gitignore
810
CHANGES.md = CHANGES.md
11+
global.json = global.json
912
LICENSE = LICENSE
1013
README.md = README.md
11-
.gitignore = .gitignore
12-
global.json = global.json
1314
EndProjectSection
1415
EndProject
15-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".build", ".build", "{322FD05A-A274-4AF2-99CA-BCCB0B4400F5}"
16-
ProjectSection(SolutionItems) = preProject
17-
appveyor.yml = appveyor.yml
18-
Build.ps1 = Build.ps1
19-
EndProjectSection
16+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Serilog.Sinks.Xamarin", "src\Serilog.Sinks.Xamarin\Serilog.Sinks.Xamarin.csproj", "{717384AC-F5BC-44BE-92B0-CC7DAF50CB8A}"
17+
EndProject
18+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{B2CE2F52-1413-4B3D-86CB-555235E9B71C}"
2019
EndProject
21-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Serilog.Sinks.Xamarin", "src\Serilog.Sinks.Xamarin\Serilog.Sinks.Xamarin.csproj", "{717384AC-F5BC-44BE-92B0-CC7DAF50CB8A}"
20+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{8D712A90-44C6-47F4-9746-2D21743137CE}"
2221
EndProject
2322
Global
2423
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -34,4 +33,9 @@ Global
3433
GlobalSection(SolutionProperties) = preSolution
3534
HideSolutionNode = FALSE
3635
EndGlobalSection
36+
GlobalSection(NestedProjects) = preSolution
37+
{717384AC-F5BC-44BE-92B0-CC7DAF50CB8A} = {B2CE2F52-1413-4B3D-86CB-555235E9B71C}
38+
GlobalSection(ExtensibilityGlobals) = postSolution
39+
SolutionGuid = {37019599-01BF-43D7-BE49-21A7A56EC8E2}
40+
EndGlobalSection
3741
EndGlobal

src/Serilog.Sinks.Xamarin.nuspec

Lines changed: 0 additions & 26 deletions
This file was deleted.
Lines changed: 59 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,66 @@
1-
<Project Sdk="MSBuild.Sdk.Extras">
1+
<Project Sdk="MSBuild.Sdk.Extras">
22

3-
<PropertyGroup>
4-
<TargetFrameworks>Xamarin.iOS10;Xamarin.Mac20;MonoAndroid90</TargetFrameworks>
5-
<NuspecFile>.\src\Serilog.Sinks.Xamarin.nuspec</NuspecFile>
6-
</PropertyGroup>
3+
<PropertyGroup>
4+
<Description>A Serilog sink that writes log events to Xamarin Android AndroidLogger and/or Xamarin iOS or Xamarin macOS NSLog.</Description>
5+
<VersionPrefix>1.0.0</VersionPrefix>
6+
<Authors>Serilog Contributors</Authors>
7+
<TargetFrameworks>Xamarin.iOS10;Xamarin.Mac20;MonoAndroid90;net6.0-ios;net6.0-macos;net6.0-android;net6.0-maccatalyst</TargetFrameworks>
8+
<AssemblyOriginatorKeyFile>../../assets/Serilog.snk</AssemblyOriginatorKeyFile>
9+
<SignAssembly>true</SignAssembly>
10+
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
11+
<PackageTags>serilog;xamarin;android;androidlogger;monodroid;monotouch;ios;macos;nslog</PackageTags>
12+
<PackageIcon>images\icon.png</PackageIcon>
13+
<PackageProjectUrl>https://github.com/serilog/serilog-sinks-xamarin</PackageProjectUrl>
14+
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
15+
<RepositoryUrl>https://github.com/serilog/serilog-sinks-xamarin</RepositoryUrl>
16+
<RepositoryType>git</RepositoryType>
17+
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
18+
<TreatSpecificWarningsAsErrors />
19+
<RootNamespace>Serilog</RootNamespace>
20+
<GeneratePackageOnBuild Condition="'$(Configuration)'=='Release'">true</GeneratePackageOnBuild>
21+
</PropertyGroup>
722

8-
<ItemGroup>
9-
<Compile Remove="Sinks\Xamarin\**\*.cs" />
10-
<None Include="Sinks\Xamarin\**\*.cs" />
11-
</ItemGroup>
23+
<PropertyGroup>
24+
<IsMonoAndroid>false</IsMonoAndroid>
25+
<IsMonoAndroid Condition="$(TargetFramework.ToLower().StartsWith('monoandroid'))">true</IsMonoAndroid>
1226

13-
<ItemGroup Condition=" $(TargetFramework.StartsWith('Xamarin.iOS')) ">
14-
<Compile Include="Sinks\Xamarin\apple-common\**\*.cs" />
15-
</ItemGroup>
27+
<IsXamarinIOS>false</IsXamarinIOS>
28+
<IsXamarinIOS Condition="'$(TargetFramework)'=='net6.0-maccatalyst' or $(TargetFramework.ToLower().StartsWith('xamarin.ios'))">true</IsXamarinIOS>
1629

17-
<ItemGroup Condition=" $(TargetFramework.StartsWith('Xamarin.Mac')) ">
18-
<Compile Include="Sinks\Xamarin\apple-common\**\*.cs" />
19-
</ItemGroup>
30+
<IsXamarinMac>false</IsXamarinMac>
31+
<IsXamarinMac Condition="$(TargetFramework.ToLower().StartsWith('xamarin.mac'))">true</IsXamarinMac>
2032

21-
<ItemGroup Condition=" $(TargetFramework.StartsWith('MonoAndroid')) ">
22-
<Compile Include="Sinks\Xamarin\android\**\*.cs" />
23-
</ItemGroup>
33+
<_IsAndroid>false</_IsAndroid>
34+
<_IsAndroid Condition="$(IsMonoAndroid) or '$(TargetFramework)'=='net6.0-android'">true</_IsAndroid>
2435

25-
<ItemGroup>
26-
<PackageReference Include="Serilog" Version="2.1.0" />
27-
</ItemGroup>
36+
<_IsCatalyst>false</_IsCatalyst>
37+
<_IsCatalyst Condition="$(_IsCatalyst) or '$(TargetFramework)'=='net6.0-maccatalyst'">true</_IsCatalyst>
38+
39+
<_IsIOS>false</_IsIOS>
40+
<_IsIOS Condition="$(IsXamarinIOS) or '$(TargetFramework)'=='net6.0-ios'">true</_IsIOS>
41+
42+
<_IsMacOS>false</_IsMacOS>
43+
<_IsMacOS Condition="$(IsXamarinMac) or '$(TargetFramework)'=='net6.0-macos'">true</_IsMacOS>
44+
</PropertyGroup>
45+
46+
<ItemGroup>
47+
<PackageReference Include="Serilog" Version="2.1.0" />
48+
</ItemGroup>
49+
50+
<ItemGroup>
51+
<None Include="..\..\assets\serilog-sink-nuget.png" Pack="true" Visible="false" PackagePath="images\icon.png" />
52+
</ItemGroup>
53+
54+
<ItemGroup>
55+
<Compile Remove="**\*.cs" />
56+
<None Include="Sinks\**\*.cs" />
57+
</ItemGroup>
58+
59+
<ItemGroup Condition=" $(_IsIOS) or $(_IsCatalyst) or $(_IsMacOS) ">
60+
<Compile Include="Sinks\Xamarin\apple-common\**\*.cs" />
61+
</ItemGroup>
62+
63+
<ItemGroup Condition=" $(_IsAndroid) ">
64+
<Compile Include="Sinks\Xamarin\android\**\*.cs" />
65+
</ItemGroup>
2866
</Project>

src/Serilog.Sinks.Xamarin/Sinks/Xamarin/apple-common/LoggerConfigurationXamarinExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ namespace Serilog
2323
/// <summary>
2424
/// Adds WriteTo.NSLog() to the logger configuration.
2525
/// </summary>
26-
public static class oggerConfigurationXamarinExtensions
26+
public static class LoggerConfigurationXamarinExtensions
2727
{
2828
const string DefaultNSLogOutputTemplate = "[{Level}] {Message:l}{NewLine:l}{Exception:l}";
2929

test/Blank.txt

Whitespace-only changes.

0 commit comments

Comments
 (0)