Skip to content

Commit cde0d64

Browse files
authored
Merge pull request #3 from TheDataShed/dotnet-core
Upgraded solution to support .NET Core 1.1 as well as .NET FX 4.5.2
2 parents 94a5712 + b738bf5 commit cde0d64

File tree

11 files changed

+93
-287
lines changed

11 files changed

+93
-287
lines changed

Build.ps1

Lines changed: 28 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,44 @@
1-
param(
2-
[String] $majorMinor = "0.0", # 2.0
3-
[String] $patch = "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-
}
3+
Push-Location $PSScriptRoot
174

18-
function Install-NuGetPackages($solution)
19-
{
20-
nuget restore $solution
5+
if(Test-Path .\artifacts) {
6+
echo "build: Cleaning .\artifacts"
7+
Remove-Item .\artifacts -Force -Recurse
218
}
229

23-
function Invoke-MSBuild($solution, $customLogger)
24-
{
25-
if ($customLogger)
26-
{
27-
msbuild "$solution" /verbosity:minimal /p:Configuration=Release /logger:"$customLogger"
28-
}
29-
else
30-
{
31-
msbuild "$solution" /verbosity:minimal /p:Configuration=Release
32-
}
33-
}
10+
& dotnet restore --no-cache
3411

35-
function Invoke-NuGetPackProj($csproj)
36-
{
37-
nuget pack -Prop Configuration=Release -Symbols $csproj
38-
}
12+
$branch = @{ $true = $env:APPVEYOR_REPO_BRANCH; $false = $(git symbolic-ref --short -q HEAD) }[$env:APPVEYOR_REPO_BRANCH -ne $NULL];
13+
$revision = @{ $true = "{0:00000}" -f [convert]::ToInt32("0" + $env:APPVEYOR_BUILD_NUMBER, 10); $false = "local" }[$env:APPVEYOR_BUILD_NUMBER -ne $NULL];
14+
$suffix = @{ $true = ""; $false = "$($branch.Substring(0, [math]::Min(10,$branch.Length)))-$revision"}[$branch -eq "master" -and $revision -ne "local"]
15+
$commitHash = $(git rev-parse --short HEAD)
16+
$buildSuffix = @{ $true = "$($suffix)-$($commitHash)"; $false = "$($branch)-$($commitHash)" }[$suffix -ne ""]
3917

40-
function Invoke-NuGetPackSpec($nuspec, $version)
41-
{
42-
nuget pack $nuspec -Version $version -OutputDirectory ..\..\
43-
}
18+
echo "build: Package version suffix is $suffix"
19+
echo "build: Build version suffix is $buildSuffix"
4420

45-
function Invoke-NuGetPack($version)
46-
{
47-
ls src/**/*.csproj |
48-
Where-Object { -not ($_.Name -like "*net40*") } |
49-
ForEach-Object { Invoke-NuGetPackProj $_ }
50-
}
21+
foreach ($src in ls src/*) {
22+
Push-Location $src
5123

52-
function Invoke-Build($majorMinor, $patch, $customLogger, $notouch, $sln)
53-
{
54-
$package="$majorMinor.$patch"
55-
$slnfile = "$sln.sln"
24+
echo "build: Packaging project in $src"
5625

57-
Write-Output "$sln $package"
26+
& dotnet build -c Release --version-suffix=$buildSuffix
27+
& dotnet pack -c Release --include-symbols -o ..\..\artifacts --version-suffix=$suffix --no-build
28+
if($LASTEXITCODE -ne 0) { exit 1 }
5829

59-
if (-not $notouch)
60-
{
61-
$assembly = "$majorMinor.0.0"
62-
63-
Write-Output "Assembly version will be set to $assembly"
64-
Set-AssemblyVersions $package $assembly
65-
}
66-
67-
Install-NuGetPackages $slnfile
68-
69-
Invoke-MSBuild $slnfile $customLogger
70-
71-
Invoke-NuGetPack $package
30+
Pop-Location
7231
}
7332

74-
$ErrorActionPreference = "Stop"
33+
foreach ($test in ls test/*.Tests) {
34+
Push-Location $test
35+
36+
echo "build: Testing project in $test"
7537

76-
if (-not $sln)
77-
{
78-
$slnfull = ls *.sln |
79-
Where-Object { -not ($_.Name -like "*net40*") } |
80-
Select -first 1
38+
& dotnet test -c Release
39+
if($LASTEXITCODE -ne 0) { exit 3 }
8140

82-
$sln = $slnfull.BaseName
41+
Pop-Location
8342
}
8443

85-
Invoke-Build $majorMinor $patch $customLogger $notouch $sln
44+
Pop-Location

appveyor.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
version: '{build}'
2+
skip_tags: true
3+
image: Visual Studio 2017
4+
configuration: Release
5+
test: off
6+
build_script:
7+
- ps: ./Build.ps1
8+
artifacts:
9+
- path: artifacts/Destructurama.*.nupkg
10+
deploy:
11+
- provider: NuGet
12+
api_key:
13+
secure: Db273rounfdesOqPXjqPrP6jeHGKkI52Rk+FSdnh6X/S6MuCelVFMpVMn67CcZgv
14+
skip_symbols: true
15+
on:
16+
branch: /^(master|dev)$/

destructurama-json-net.sln

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio 2013
4-
VisualStudioVersion = 12.0.31101.0
3+
# Visual Studio 15
4+
VisualStudioVersion = 15.0.26430.12
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Destructurama.JsonNet", "src\Destructurama.JsonNet\Destructurama.JsonNet.csproj", "{A79F906E-0298-49DC-93EC-CE4F1F5D13E2}"
77
EndProject
Lines changed: 24 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,34 @@
1-
<?xml version="1.0" encoding="utf-8"?>
2-
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3-
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
43
<PropertyGroup>
5-
<MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion>
6-
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
7-
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
8-
<ProjectGuid>{A79F906E-0298-49DC-93EC-CE4F1F5D13E2}</ProjectGuid>
9-
<OutputType>Library</OutputType>
10-
<AppDesignerFolder>Properties</AppDesignerFolder>
4+
<TargetFrameworks>net452;netcoreapp1.1</TargetFrameworks>
115
<RootNamespace>Destructurama</RootNamespace>
12-
<AssemblyName>Destructurama.JsonNet</AssemblyName>
13-
<DefaultLanguage>en-US</DefaultLanguage>
14-
<FileAlignment>512</FileAlignment>
15-
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
16-
<TargetFrameworkProfile>Profile78</TargetFrameworkProfile>
17-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
6+
<SignAssembly>True</SignAssembly>
7+
<AssemblyOriginatorKeyFile>..\..\assets\Destructurama.snk</AssemblyOriginatorKeyFile>
8+
<DelaySign>False</DelaySign>
9+
<Authors>Destructurama Contributors</Authors>
10+
<Description>Adds support for logging JSON.NET dynamic types as structured data with Serilog.</Description>
11+
<PackageTags>serilog json</PackageTags>
12+
<PackageProjectUrl>https://github.com/destructurama</PackageProjectUrl>
13+
<PackageLicenseUrl>http://www.apache.org/licenses/LICENSE-2.0</PackageLicenseUrl>
14+
<PackageIconUrl>http://destructurama.github.io/pages/images/destructurama.png</PackageIconUrl>
15+
<Product />
16+
<Company />
17+
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
1818
</PropertyGroup>
19-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
20-
<DebugSymbols>true</DebugSymbols>
21-
<DebugType>full</DebugType>
22-
<Optimize>false</Optimize>
23-
<OutputPath>bin\Debug\</OutputPath>
24-
<DefineConstants>DEBUG;TRACE</DefineConstants>
25-
<ErrorReport>prompt</ErrorReport>
26-
<WarningLevel>4</WarningLevel>
27-
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
19+
20+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
2821
<DocumentationFile>bin\Debug\Destructurama.JsonNet.xml</DocumentationFile>
22+
<OutputPath>bin\Debug\</OutputPath>
2923
</PropertyGroup>
30-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
31-
<DebugType>pdbonly</DebugType>
32-
<Optimize>true</Optimize>
33-
<OutputPath>bin\Release\</OutputPath>
34-
<DefineConstants>TRACE</DefineConstants>
35-
<ErrorReport>prompt</ErrorReport>
36-
<WarningLevel>4</WarningLevel>
37-
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
38-
<DocumentationFile>bin\Release\Destructurama.JsonNet.xml</DocumentationFile>
39-
</PropertyGroup>
40-
<PropertyGroup>
41-
<SignAssembly>true</SignAssembly>
42-
</PropertyGroup>
43-
<PropertyGroup>
44-
<AssemblyOriginatorKeyFile>..\..\assets\Destructurama.snk</AssemblyOriginatorKeyFile>
45-
</PropertyGroup>
46-
<ItemGroup>
47-
<Compile Include="JsonNet\JsonNetDestructuringPolicy.cs" />
48-
<Compile Include="LoggerConfigurationJsonNetExtensions.cs" />
49-
<Compile Include="Properties\AssemblyInfo.cs" />
50-
<Compile Include="..\..\assets\CommonAssemblyInfo.cs">
51-
<Link>Properties\CommonAssemblyInfo.cs</Link>
52-
</Compile>
53-
</ItemGroup>
24+
5425
<ItemGroup>
55-
<None Include="..\..\assets\Destructurama.snk">
56-
<Link>Destructurama.snk</Link>
57-
</None>
58-
<None Include="Destructurama.JsonNet.nuspec" />
59-
<None Include="packages.config" />
26+
<None Include="..\assets\Destructurama.snk" Link="Destructurama.snk" />
6027
</ItemGroup>
28+
6129
<ItemGroup>
62-
<Reference Include="Newtonsoft.Json">
63-
<HintPath>..\..\packages\Newtonsoft.Json.6.0.8\lib\portable-net45+wp80+win8+wpa81+aspnetcore50\Newtonsoft.Json.dll</HintPath>
64-
</Reference>
65-
<Reference Include="Serilog">
66-
<HintPath>..\..\packages\Serilog.1.4.204\lib\portable-net45+win+wpa81+wp80+MonoAndroid10+MonoTouch10\Serilog.dll</HintPath>
67-
</Reference>
30+
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
31+
<PackageReference Include="Serilog" Version="2.5.0" />
6832
</ItemGroup>
69-
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
70-
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
71-
Other similar extension points exist, see Microsoft.Common.targets.
72-
<Target Name="BeforeBuild">
73-
</Target>
74-
<Target Name="AfterBuild">
75-
</Target>
76-
-->
33+
7734
</Project>

src/Destructurama.JsonNet/Destructurama.JsonNet.nuspec

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

src/Destructurama.JsonNet/Properties/AssemblyInfo.cs

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

src/Destructurama.JsonNet/packages.config

Lines changed: 0 additions & 5 deletions
This file was deleted.
Lines changed: 17 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,24 @@
1-
<?xml version="1.0" encoding="utf-8"?>
2-
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3-
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4-
<PropertyGroup>
5-
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6-
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7-
<ProjectGuid>{182ECDA3-A97D-4BB6-BC6F-60A137478B92}</ProjectGuid>
8-
<OutputType>Library</OutputType>
9-
<AppDesignerFolder>Properties</AppDesignerFolder>
10-
<RootNamespace>Destructurama.JsonNet.Tests</RootNamespace>
11-
<AssemblyName>Destructurama.JsonNet.Tests</AssemblyName>
12-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
13-
<FileAlignment>512</FileAlignment>
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFrameworks>net452;netcoreapp1.1</TargetFrameworks>
145
</PropertyGroup>
15-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
16-
<DebugSymbols>true</DebugSymbols>
17-
<DebugType>full</DebugType>
18-
<Optimize>false</Optimize>
19-
<OutputPath>bin\Debug\</OutputPath>
20-
<DefineConstants>DEBUG;TRACE</DefineConstants>
21-
<ErrorReport>prompt</ErrorReport>
22-
<WarningLevel>4</WarningLevel>
23-
</PropertyGroup>
24-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
25-
<DebugType>pdbonly</DebugType>
26-
<Optimize>true</Optimize>
27-
<OutputPath>bin\Release\</OutputPath>
28-
<DefineConstants>TRACE</DefineConstants>
29-
<ErrorReport>prompt</ErrorReport>
30-
<WarningLevel>4</WarningLevel>
31-
</PropertyGroup>
32-
<ItemGroup>
33-
<Reference Include="Newtonsoft.Json">
34-
<HintPath>..\..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll</HintPath>
35-
</Reference>
36-
<Reference Include="nunit.framework">
37-
<HintPath>..\..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
38-
</Reference>
39-
<Reference Include="Serilog">
40-
<HintPath>..\..\packages\Serilog.1.4.204\lib\net45\Serilog.dll</HintPath>
41-
</Reference>
42-
<Reference Include="Serilog.FullNetFx">
43-
<HintPath>..\..\packages\Serilog.1.4.204\lib\net45\Serilog.FullNetFx.dll</HintPath>
44-
</Reference>
45-
<Reference Include="System" />
46-
<Reference Include="System.Core" />
47-
<Reference Include="System.Xml.Linq" />
48-
<Reference Include="System.Data.DataSetExtensions" />
49-
<Reference Include="Microsoft.CSharp" />
50-
<Reference Include="System.Data" />
51-
<Reference Include="System.Xml" />
52-
</ItemGroup>
53-
<ItemGroup>
54-
<Compile Include="JsonNetTypesDestructuringTests.cs" />
55-
<Compile Include="Properties\AssemblyInfo.cs" />
56-
<Compile Include="Support\DelegatingSink.cs" />
57-
<Compile Include="Support\Extensions.cs" />
58-
</ItemGroup>
6+
597
<ItemGroup>
60-
<None Include="packages.config" />
8+
<PackageReference Include="Microsoft.CSharp" Version="4.3.0" />
9+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0" />
10+
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
11+
<PackageReference Include="Serilog" Version="2.5.0" />
12+
<PackageReference Include="xunit" Version="2.2.0" />
13+
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0" />
6114
</ItemGroup>
15+
6216
<ItemGroup>
63-
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
17+
<ProjectReference Include="..\..\src\Destructurama.JsonNet\Destructurama.JsonNet.csproj" />
6418
</ItemGroup>
19+
6520
<ItemGroup>
66-
<ProjectReference Include="..\..\src\Destructurama.JsonNet\Destructurama.JsonNet.csproj">
67-
<Project>{a79f906e-0298-49dc-93ec-ce4f1f5d13e2}</Project>
68-
<Name>Destructurama.JsonNet</Name>
69-
</ProjectReference>
21+
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
7022
</ItemGroup>
71-
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
72-
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
73-
Other similar extension points exist, see Microsoft.Common.targets.
74-
<Target Name="BeforeBuild">
75-
</Target>
76-
<Target Name="AfterBuild">
77-
</Target>
78-
-->
79-
</Project>
23+
24+
</Project>

0 commit comments

Comments
 (0)