Skip to content

.NET Core RC2 Update #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 17, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 10 additions & 98 deletions Build.ps1
Original file line number Diff line number Diff line change
@@ -1,109 +1,21 @@
$root = $(Get-Item $($MyInvocation.MyCommand.Path)).DirectoryName

function Install-Dnvm
{
& where.exe dnvm 2>&1 | Out-Null
if(($LASTEXITCODE -ne 0) -Or ((Test-Path Env:\APPVEYOR) -eq $true))
{
Write-Host "DNVM not found"
&{$Branch='dev';iex ((New-Object net.webclient).DownloadString('https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.ps1'))}

# Normally this happens automatically during install but AppVeyor has
# an issue where you may need to manually re-run setup from within this process.
if($env:DNX_HOME -eq $NULL)
{
Write-Host "Initial DNVM environment setup failed; running manual setup"
$tempDnvmPath = Join-Path $env:TEMP "dnvminstall"
$dnvmSetupCmdPath = Join-Path $tempDnvmPath "dnvm.ps1"
& $dnvmSetupCmdPath setup
}
}
}

function Get-DnxVersion
{
$globalJson = Join-Path $PSScriptRoot "global.json"
$jsonData = Get-Content -Path $globalJson -Raw | ConvertFrom-JSON
return $jsonData.sdk.version
}

function Restore-Packages
{
param([string] $DirectoryName)
& dnu restore ("""" + $DirectoryName + """")
}

function Build-Projects
{
param($Directory, $pack)

$DirectoryName = $Directory.DirectoryName
$artifactsFolder = join-path $root "artifacts"
$projectsFolder = join-path $artifactsFolder $Directory.Name
$buildFolder = join-path $projectsFolder "testbin"
$packageFolder = join-path $projectsFolder "packages"

& dnu build ("""" + $DirectoryName + """") --configuration Release --out $buildFolder; if($LASTEXITCODE -ne 0) { exit 1 }

if($pack){
& dnu pack ("""" + $DirectoryName + """") --configuration Release --out $packageFolder; if($LASTEXITCODE -ne 0) { exit 1 }
}
}

function Test-Projects
{
param([string] $DirectoryName)
& dnx -p ("""" + $DirectoryName + """") test; if($LASTEXITCODE -ne 0) { exit 2 }
}

function Remove-PathVariable
{
param([string] $VariableToRemove)
$path = [Environment]::GetEnvironmentVariable("PATH", "User")
$newItems = $path.Split(';') | Where-Object { $_.ToString() -inotlike $VariableToRemove }
[Environment]::SetEnvironmentVariable("PATH", [System.String]::Join(';', $newItems), "User")
$path = [Environment]::GetEnvironmentVariable("PATH", "Process")
$newItems = $path.Split(';') | Where-Object { $_.ToString() -inotlike $VariableToRemove }
[Environment]::SetEnvironmentVariable("PATH", [System.String]::Join(';', $newItems), "Process")
}

Push-Location $PSScriptRoot

$dnxVersion = Get-DnxVersion

# Clean
if(Test-Path .\artifacts) { Remove-Item .\artifacts -Force -Recurse }

# Remove the installed DNVM from the path and force use of
# per-user DNVM (which we can upgrade as needed without admin permissions)
Remove-PathVariable "*Program Files\Microsoft DNX\DNVM*"

# Make sure per-user DNVM is installed
Install-Dnvm

# Install DNX
dnvm install $dnxVersion -r CoreCLR -NoNative
dnvm install $dnxVersion -r CLR -NoNative
dnvm use $dnxVersion -r CLR
& dotnet restore

# Package restore
Get-ChildItem -Path . -Filter *.xproj -Recurse | ForEach-Object { Restore-Packages $_.DirectoryName }
$revision = @{ $true = $env:APPVEYOR_BUILD_NUMBER; $false = 1 }[$env:APPVEYOR_BUILD_NUMBER -ne $NULL];

# Set build number
$env:DNX_BUILD_VERSION = @{ $true = $env:APPVEYOR_BUILD_NUMBER; $false = 1 }[$env:APPVEYOR_BUILD_NUMBER -ne $NULL];
Write-Host "Build number: " $env:DNX_BUILD_VERSION
Push-Location src/Serilog.Sinks.File

# Build/package
Get-ChildItem -Path .\src -Filter *.xproj -Recurse | ForEach-Object { Build-Projects $_ $true }
Get-ChildItem -Path .\test -Filter *.xproj -Recurse | ForEach-Object { Build-Projects $_ $false }
& dotnet pack -c Release -o ..\..\.\artifacts --version-suffix=$revision
if($LASTEXITCODE -ne 0) { exit 1 }

# Test
Get-ChildItem -Path .\test -Filter *.xproj -Recurse | ForEach-Object { Test-Projects $_.DirectoryName }

# Switch to Core CLR
dnvm use $dnxVersion -r CoreCLR
Pop-Location
Push-Location test/Serilog.Sinks.File.Tests

# Test again
Get-ChildItem -Path .\test -Filter *.xproj -Recurse | ForEach-Object { Test-Projects $_.DirectoryName }
& dotnet test -c Release
if($LASTEXITCODE -ne 0) { exit 2 }

Pop-Location
Pop-Location
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#The file sink for Serilog
# Serilog.Sinks.File

##NOTE: Work in progress as apart of the [Serilog 2.0 release](https://github.com/serilog/serilog/issues?q=is%3Aissue+is%3Aopen+label%3Av2).
The file sink for Serilog.

[![Build status](https://ci.appveyor.com/api/projects/status/hh9gymy0n6tne46j?svg=true)](https://ci.appveyor.com/project/serilog/serilog-sinks-file) [![NuGet Version](http://img.shields.io/nuget/v/Serilog.Sinks.File.svg?style=flat)](https://www.nuget.org/packages/Serilog.Sinks.File/)

Expand Down
22 changes: 22 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
version: '{build}'
image: Visual Studio 2015
configuration: Release
install:
- ps: mkdir -Force ".\build\" | Out-Null
- ps: Invoke-WebRequest "https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0/scripts/obtain/install.ps1" -OutFile ".\build\installcli.ps1"
- ps: $env:DOTNET_INSTALL_DIR = "$pwd\.dotnetcli"
- ps: '& .\build\installcli.ps1 -InstallDir "$env:DOTNET_INSTALL_DIR" -NoPath'
- ps: $env:Path = "$env:DOTNET_INSTALL_DIR;$env:Path"
build_script:
- ps: ./Build.ps1
test: off
artifacts:
- path: artifacts/Serilog.*.nupkg
deploy:
- provider: NuGet
api_key:
secure: nvZ/z+pMS91b3kG4DgfES5AcmwwGoBYQxr9kp4XiJHj25SAlgdIxFx++1N0lFH2x
skip_symbols: true
on:
branch: /^(dev|master)$/

8 changes: 4 additions & 4 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"projects": [ "src", "test" ],
"sdk": {
"version": "1.0.0-rc1-final"
}
"projects": [ "src", "test" ],
"sdk": {
"version": "1.0.0-preview1-002702"
}
}
5 changes: 3 additions & 2 deletions Serilog.Sinks.File.sln → serilog-sinks-file.sln
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.24720.0
VisualStudioVersion = 14.0.25123.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{037440DE-440B-4129-9F7A-09B42D00397E}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "assets", "assets", "{E9D1B5E1-DEB9-4A04-8BAB-24EC7240ADAF}"
ProjectSection(SolutionItems) = preProject
appveyor.yml = appveyor.yml
Build.ps1 = Build.ps1
global.json = global.json
NuGet.Config = NuGet.Config
Expand All @@ -18,7 +19,7 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Serilog.Sinks.File", "src\S
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{7B927378-9F16-4F6F-B3F6-156395136646}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Serilog.Tests", "test\Serilog.Tests\Serilog.Tests.xproj", "{3C2D8E01-5580-426A-BDD9-EC59CD98E618}"
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Serilog.Sinks.File.Tests", "test\Serilog.Sinks.File.Tests\Serilog.Sinks.File.Tests.xproj", "{3C2D8E01-5580-426A-BDD9-EC59CD98E618}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

namespace Serilog
{
/// <summary>Extends <see cref="LoggerConfiguration"> with methods to add file sinks.</summary>
public static class FileLoggerConfigurationExtensions
{
const long DefaultFileSizeLimitBytes = 1L * 1024 * 1024 * 1024;
Expand Down
6 changes: 3 additions & 3 deletions src/Serilog.Sinks.File/Serilog.Sinks.File.xproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
<PropertyGroup Label="Globals">
<ProjectGuid>57e0ed0e-0f45-48ab-a73d-6a92b7c32095</ProjectGuid>
<RootNamespace>Serilog</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>
30 changes: 16 additions & 14 deletions src/Serilog.Sinks.File/project.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
{
"version": "2.0.0-beta-*",
"version": "2.0.0-rc-*",
"description": "The file sink for Serilog",
"authors": [ "Serilog Contributors" ],
"tags": [ "serilog", "file", "io" ],
"projectUrl": "http://serilog.net",
"licenseUrl": "http://www.apache.org/licenses/LICENSE-2.0",
"iconUrl": "http://serilog.net/images/serilog-sink-nuget.png",
"packOptions": {
"tags": [ "serilog", "file", "io" ],
"projectUrl": "http://serilog.net",
"licenseUrl": "http://www.apache.org/licenses/LICENSE-2.0",
"iconUrl": "http://serilog.net/images/serilog-sink-nuget.png"
},
"dependencies": {
"Serilog": "2.0.0-beta-505"
"Serilog": "2.0.0-rc-556"
},
"compilationOptions": {
"keyFile": "../../assets/Serilog.snk"
"buildOptions": {
"keyFile": "../../assets/Serilog.snk",
"xmlDoc": true
},
"frameworks": {
"net45": {
},
"dotnet5.1": {
"net4.5": {},
"netstandard1.3": {
"dependencies": {
"System.IO": "4.0.11-beta-23516",
"System.IO.FileSystem": "4.0.0",
"System.IO.FileSystem.Primitives": "4.0.0"
"System.IO": "4.1.0-rc2-24027",
"System.IO.FileSystem": "4.0.1-rc2-24027",
"System.IO.FileSystem.Primitives": "4.0.1-rc2-24027"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,11 @@
<PropertyGroup Label="Globals">
<ProjectGuid>3c2d8e01-5580-426a-bdd9-ec59cd98e618</ProjectGuid>
<RootNamespace>Serilog.Tests</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
<TypeScriptCompileBlocked>True</TypeScriptCompileBlocked>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<ProduceOutputsOnBuild>True</ProduceOutputsOnBuild>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<ProduceOutputsOnBuild>True</ProduceOutputsOnBuild>
</PropertyGroup>
<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>
File renamed without changes.
24 changes: 24 additions & 0 deletions test/Serilog.Sinks.File.Tests/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"version": "2.0.0-rc-*",
"testRunner": "xunit",
"dependencies": {
"Serilog.Sinks.File": { "target": "project" },
"xunit": "2.1.0",
"dotnet-test-xunit": "1.0.0-rc2-build10015"
},
"frameworks": {
"net4.5.2": {},
"netcoreapp1.0": {
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.0-rc2-3002702"
}
},
"imports": [
"dnxcore50",
"portable-net45+win8"
]
}
}
}
44 changes: 0 additions & 44 deletions test/Serilog.Tests/project.json

This file was deleted.