Skip to content

Commit ed3474c

Browse files
committed
Merge branch 'develop'
2 parents 167deba + 8d97e73 commit ed3474c

File tree

11 files changed

+176
-82
lines changed

11 files changed

+176
-82
lines changed

.gitattributes

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
* text=auto
1+
* text=auto
2+
*.sh text eol=lf

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ language: csharp
22
sudo: required
33
dist: trusty
44

5-
dotnet: 2.1.4
5+
dotnet: 2.1.400
66
mono:
77
- 4.6.1
88
- 4.8.1
@@ -16,6 +16,7 @@ before_install:
1616
- curl https://packages.microsoft.com/config/ubuntu/14.04/prod.list | sudo tee /etc/apt/sources.list.d/microsoft.list
1717
- sudo apt-get update
1818
- sudo apt-get install -y powershell
19+
- sudo pwsh ./install-dotnet.ps1
1920

2021
script:
2122
- export FrameworkPathOverride=$(dirname $(which mono))/../lib/mono/4.5/

RELEASE_NOTES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
Release Notes
22
=============
33

4+
## 1.2.0
5+
6+
Upgraded to Giraffe `2.0.0` and the latest ASP.NET Core `2.1.*` NuGet packages.
7+
48
## 1.1.0
59

610
Upgraded Giraffe to `1.1.0`.

appveyor.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ environment:
44
DOTNET_CLI_TELEMETRY_OPTOUT: 1
55
init:
66
- git config --global core.autocrlf true
7+
install:
8+
- ps: .\install-dotnet.ps1
79
build: off
810
build_script:
911
- ps: .\build.ps1 -Release -Pack

build.ps1

Lines changed: 47 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,52 @@ function Write-DotnetVersion
3838
Write-Host ".NET Core runtime version: $dotnetVersion" -ForegroundColor Cyan
3939
}
4040

41-
function dotnet-restore ($project, $argv) { Invoke-Cmd "dotnet restore $project $argv" }
42-
function dotnet-build ($project, $argv) { Invoke-Cmd "dotnet build $project $argv" }
41+
function Get-TargetFrameworks ($projFile)
42+
{
43+
[xml]$proj = Get-Content $projFile
44+
45+
if ($proj.Project.PropertyGroup.TargetFrameworks -ne $null) {
46+
($proj.Project.PropertyGroup.TargetFrameworks).Split(";")
47+
}
48+
else {
49+
@($proj.Project.PropertyGroup.TargetFramework)
50+
}
51+
}
52+
53+
function Get-NetCoreTargetFramework ($projFile)
54+
{
55+
Get-TargetFrameworks $projFile | where { $_ -like "netstandard*" -or $_ -like "netcoreapp*" }
56+
}
57+
4358
function dotnet-run ($project, $argv) { Invoke-Cmd "dotnet run --project $project $argv" }
44-
function dotnet-test ($project, $argv) { Invoke-Cmd "dotnet test $project $argv" }
4559
function dotnet-pack ($project, $argv) { Invoke-Cmd "dotnet pack $project $argv" }
4660

61+
function dotnet-build ($project, $argv)
62+
{
63+
if ($OnlyNetStandard.IsPresent) {
64+
$fw = Get-NetCoreTargetFramework $project
65+
$argv = "-f $fw " + $argv
66+
}
67+
68+
Invoke-Cmd "dotnet build $project $argv"
69+
}
70+
71+
function dotnet-test ($project, $argv)
72+
{
73+
# Currently dotnet test does not work for net461 on Linux/Mac
74+
# See: https://github.com/Microsoft/vstest/issues/1318
75+
#
76+
# Previously dotnet-xunit was a great alternative, however after
77+
# issues with the maintenance dotnet xunit has been discontinued
78+
# after xunit 2.4: https://xunit.github.io/releases/2.4
79+
if(!(Test-IsWindows) -or $OnlyNetStandard.IsPresent) {
80+
$fw = Get-NetCoreTargetFramework $project;
81+
$argv = "-f $fw " + $argv
82+
}
83+
84+
Invoke-Cmd "dotnet test $project $argv"
85+
}
86+
4787
function Test-Version ($project)
4888
{
4989
if ($env:APPVEYOR_REPO_TAG -eq $true)
@@ -88,26 +128,6 @@ function Remove-OldBuildArtifacts
88128
Remove-Item $_ -Recurse -Force }
89129
}
90130

91-
function Get-TargetFrameworks ($projFile)
92-
{
93-
[xml]$proj = Get-Content $projFile
94-
($proj.Project.PropertyGroup.TargetFrameworks).Split(";")
95-
}
96-
97-
function Get-NetCoreTargetFramework ($projFile)
98-
{
99-
Get-TargetFrameworks $projFile | where { $_ -like "netstandard*" -or $_ -like "netcoreapp*" }
100-
}
101-
102-
function Get-FrameworkArg ($projFile)
103-
{
104-
if ($OnlyNetStandard.IsPresent) {
105-
$fw = Get-NetCoreTargetFramework $projFile
106-
"-f $fw"
107-
}
108-
else { "" }
109-
}
110-
111131
# ----------------------------------------------
112132
# Main
113133
# ----------------------------------------------
@@ -130,42 +150,28 @@ Remove-OldBuildArtifacts
130150
$configuration = if ($Release.IsPresent) { "Release" } else { "Debug" }
131151

132152
Write-Host "Building Giraffe.DotLiquid..." -ForegroundColor Magenta
133-
$framework = Get-FrameworkArg $giraffeDotLiquid
134-
dotnet-restore $giraffeDotLiquid
135-
dotnet-build $giraffeDotLiquid "-c $configuration $framework"
153+
dotnet-build $giraffeDotLiquid "-c $configuration"
136154

137155
if (!$ExcludeTests.IsPresent -and !$Run.IsPresent)
138156
{
139157
Write-Host "Building and running tests..." -ForegroundColor Magenta
140-
$framework = Get-FrameworkArg $giraffeDotLiquidTests
141-
# Currently dotnet test does not work for net461 on Linux/Mac
142-
# See: https://github.com/Microsoft/vstest/issues/1318
143-
if (!(Test-IsWindows)) {
144-
Write-Warning "Running tests only for .NET Core build, because dotnet test does not support net4x tests on Linux/Mac at the moment (see: https://github.com/Microsoft/vstest/issues/1318)."
145-
$fw = Get-NetCoreTargetFramework $giraffeDotLiquidTests
146-
$framework = "-f $fw"
147-
}
148-
dotnet-restore $giraffeDotLiquidTests
149-
dotnet-build $giraffeDotLiquidTests $framework
150-
dotnet-test $giraffeDotLiquidTests $framework
158+
159+
dotnet-build $giraffeDotLiquidTests
160+
dotnet-test $giraffeDotLiquidTests
151161
}
152162

153163
if (!$ExcludeSamples.IsPresent -and !$Run.IsPresent)
154164
{
155165
Write-Host "Building and testing samples..." -ForegroundColor Magenta
156-
157-
dotnet-restore $sampleApp
158166
dotnet-build $sampleApp
159167

160-
dotnet-restore $sampleAppTests
161168
dotnet-build $sampleAppTests
162169
dotnet-test $sampleAppTests
163170
}
164171

165172
if ($Run.IsPresent)
166173
{
167174
Write-Host "Launching sample application..." -ForegroundColor Magenta
168-
dotnet-restore $sampleApp
169175
dotnet-build $sampleApp
170176
dotnet-run $sampleApp
171177
}

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"projects": [ "src", "tests" ],
33
"sdk": {
4-
"version": "2.1.4"
4+
"version": "2.1.400"
55
}
66
}

install-dotnet.ps1

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# ----------------------------------------------------------
2+
# Install script to check and download the correct .NET SDK
3+
# ----------------------------------------------------------
4+
5+
function Test-IsWindows
6+
{
7+
[environment]::OSVersion.Platform -ne "Unix"
8+
}
9+
10+
function Invoke-Cmd ($cmd)
11+
{
12+
Write-Host $cmd -ForegroundColor DarkCyan
13+
if (Test-IsWindows) { $cmd = "cmd.exe /C $cmd" }
14+
Invoke-Expression -Command $cmd
15+
if ($LastExitCode -ne 0) { Write-Error "An error occured when executing '$cmd'."; return }
16+
}
17+
18+
function dotnet-version { Invoke-Cmd "dotnet --version" }
19+
20+
function Get-DesiredSdk
21+
{
22+
Get-Content "global.json" | ConvertFrom-Json | % { $_.sdk.version.ToString() }
23+
}
24+
25+
function Get-NetCoreSdk ($version)
26+
{
27+
$os = if (Test-IsWindows) { "windows" } else { "linux" }
28+
29+
$response = Invoke-WebRequest `
30+
-Uri "https://www.microsoft.com/net/download/thank-you/dotnet-sdk-$version-$os-x64-binaries" `
31+
-Method Get `
32+
-MaximumRedirection 0 `
33+
34+
$downloadLink =
35+
$response.Links `
36+
| Where-Object { $_.onclick -eq "recordManualDownload()" } `
37+
| Select-Object -Expand href
38+
39+
$tempFile = [System.IO.Path]::GetTempFileName()
40+
$webClient = New-Object System.Net.WebClient
41+
$webClient.DownloadFile($downloadLink, $tempFile)
42+
return $tempFile
43+
}
44+
45+
function Install-NetCoreSdk ($sdkZipPath)
46+
{
47+
$env:DOTNET_INSTALL_DIR = "$pwd\.dotnetsdk"
48+
New-Item $env:DOTNET_INSTALL_DIR -ItemType Directory -Force
49+
50+
Add-Type -AssemblyName System.IO.Compression.FileSystem;
51+
[System.IO.Compression.ZipFile]::ExtractToDirectory($sdkZipPath, $env:DOTNET_INSTALL_DIR)
52+
$env:Path = "$env:DOTNET_INSTALL_DIR;$env:Path"
53+
}
54+
55+
# ----------------------------------------------
56+
# Install .NET Core SDK
57+
# ----------------------------------------------
58+
59+
$ErrorActionPreference = "Stop"
60+
61+
# Rename the global.json before making the dotnet --version call
62+
# This will prevent AppVeyor to fail because it might not find
63+
# the desired SDK specified in the global.json
64+
$globalJson = Get-Item "global.json"
65+
Rename-Item -Path $globalJson.FullName -NewName "global.json.bak" -Force
66+
67+
# Get the current .NET Core SDK version
68+
$currentSdk = dotnet-version
69+
70+
# After we established the current installed .NET SDK we can put the global.json back
71+
Rename-Item -Path ($globalJson.FullName + ".bak") -NewName "global.json" -Force
72+
73+
$desiredSdk = Get-DesiredSdk
74+
75+
if ($desiredSdk -eq $currentSdk)
76+
{
77+
Write-Host "The current .NET SDK matches the project's desired .NET SDK: $desiredSDK" -ForegroundColor Green
78+
return
79+
}
80+
81+
Write-Host "The current .NET SDK ($currentSdk) doesn't match the project's desired .NET SDK ($desiredSdk)." -ForegroundColor Yellow
82+
Write-Host "Attempting to download and install the correct .NET SDK..."
83+
84+
$sdkZipPath = Get-NetCoreSdk $desiredSdk
85+
Install-NetCoreSdk $sdkZipPath
86+
87+
Write-Host ".NET SDK installation complete." -ForegroundColor Green
88+
dotnet-version

samples/GiraffeDotLiquidSample.Tests/GiraffeDotLiquidSample.Tests.fsproj

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,18 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp2.0</TargetFramework>
4+
<TargetFramework>netcoreapp2.1</TargetFramework>
55
<AssemblyName>GiraffeDotLiquidSample.Tests</AssemblyName>
66
<DebugType>portable</DebugType>
77
<PreserveCompilationContext>true</PreserveCompilationContext>
88
</PropertyGroup>
99

1010
<ItemGroup>
11-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.*" />
12-
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="2.0.*" />
11+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.*" />
12+
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.*" />
1313
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="2.0.*" />
14-
<PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="2.0.*" />
15-
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="2.0.*" />
16-
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="2.0.*" />
17-
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="2.0.*" />
18-
<PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="2.0.*" />
19-
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.0.*" />
20-
<PackageReference Include="xunit" Version="2.3.*" />
21-
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.*" />
14+
<PackageReference Include="xunit" Version="2.4.*" />
15+
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.*" />
2216
</ItemGroup>
2317

2418
<ItemGroup>

samples/GiraffeDotLiquidSample/GiraffeDotLiquidSample.fsproj

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,22 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp2.0</TargetFramework>
4+
<TargetFramework>netcoreapp2.1</TargetFramework>
55
<DebugType>portable</DebugType>
66
<AssemblyName>GiraffeDotLiquidSample</AssemblyName>
77
<OutputType>Exe</OutputType>
8-
<PackageId>GiraffeDotLiquidSample</PackageId>
9-
<RuntimeFrameworkVersion>2.0</RuntimeFrameworkVersion>
108
<EnableDefaultContentItems>false</EnableDefaultContentItems>
119
<RunWorkingDirectory>$(MSBuildThisFileDirectory)</RunWorkingDirectory>
1210
</PropertyGroup>
1311

1412
<ItemGroup>
15-
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.*" />
13+
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.*" />
1614
</ItemGroup>
1715

1816
<ItemGroup>
1917
<ProjectReference Include="..\..\src\Giraffe.DotLiquid\Giraffe.DotLiquid.fsproj" />
2018
</ItemGroup>
2119

22-
<ItemGroup>
23-
<DotNetCliToolReference Include="Microsoft.DotNet.Watcher.Tools" Version="2.0.*" />
24-
</ItemGroup>
25-
2620
<ItemGroup>
2721
<Watch Include="**\*.liquid" Exclude="bin\**\*" />
2822
</ItemGroup>

src/Giraffe.DotLiquid/Giraffe.DotLiquid.fsproj

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,25 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<AssemblyName>Giraffe.DotLiquid</AssemblyName>
4-
<Version>1.1.0</Version>
4+
<Version>1.2.0</Version>
5+
<TargetFrameworks>net461;netstandard2.0</TargetFrameworks>
6+
7+
<!-- General info -->
58
<Description>DotLiquid templating engine http handlers for the Giraffe web framework.</Description>
69
<Copyright>Copyright 2018 Dustin Moris Gorski</Copyright>
7-
<NeutralLanguage>en-GB</NeutralLanguage>
810
<Authors>Dustin Moris Gorski and contributors</Authors>
9-
<TargetFrameworks>net461;netstandard2.0</TargetFrameworks>
11+
<NeutralLanguage>en-GB</NeutralLanguage>
12+
13+
<!-- Build config -->
1014
<DebugType>portable</DebugType>
11-
<WarningsAsErrors>1</WarningsAsErrors>
1215
<Optimize>True</Optimize>
1316
<OutputType>Library</OutputType>
17+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
18+
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
19+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
20+
<IsWindows Condition="'$(OS)' == 'Windows_NT'">true</IsWindows>
21+
22+
<!-- NuGet config -->
1423
<PackageId>Giraffe.DotLiquid</PackageId>
1524
<PackageTags>Giraffe;DotLiquid;ASP.NET Core;Lambda;FSharp;Functional;Http;Web;Framework;Micro;Service</PackageTags>
1625
<PackageReleaseNotes>https://raw.githubusercontent.com/giraffe-fsharp/Giraffe.DotLiquid/master/RELEASE_NOTES.md</PackageReleaseNotes>
@@ -21,17 +30,12 @@
2130
<RepositoryType>git</RepositoryType>
2231
<RepositoryUrl>https://github.com/giraffe-fsharp/Giraffe.DotLiquid</RepositoryUrl>
2332
<IncludeSymbols>true</IncludeSymbols>
24-
<NetStandardImplicitPackageVersion>2.0</NetStandardImplicitPackageVersion>
25-
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
26-
<IsWindows Condition="'$(OS)' == 'Windows_NT'">true</IsWindows>
2733
</PropertyGroup>
2834

2935
<ItemGroup>
30-
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="2.0.*" />
31-
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.0.*" />
32-
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.0.*" />
33-
<PackageReference Include="Microsoft.Extensions.Primitives" Version="2.0.*" />
34-
<PackageReference Include="Giraffe" Version="1.1.*" />
36+
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="2.1.*" />
37+
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.1.*" />
38+
<PackageReference Include="Giraffe" Version="2.0.*" />
3539
<PackageReference Include="DotLiquid" Version="2.0.*" />
3640
</ItemGroup>
3741

0 commit comments

Comments
 (0)