Skip to content

Commit

Permalink
lower to net standard 1.5 (#5)
Browse files Browse the repository at this point in the history
* cake and lower net standard

* gitversion fix

* nuget pack

* script must be ps1
  • Loading branch information
tpluscode committed Dec 8, 2018
1 parent 8b68c2d commit 6411654
Show file tree
Hide file tree
Showing 12 changed files with 1,413 additions and 586 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -108,6 +108,7 @@ _TeamCity*

# DotCover is a Code Coverage Tool
*.dotCover
coverage

# NCrunch
_NCrunch_*
Expand Down Expand Up @@ -250,3 +251,4 @@ paket-files/
# JetBrains Rider
.idea/
*.sln.iml
/Assemblyinfo.cs
150 changes: 124 additions & 26 deletions .paket/Paket.Restore.targets

Large diffs are not rendered by default.

Binary file modified .paket/paket.exe
Binary file not shown.
3 changes: 2 additions & 1 deletion UriTemplateString.sln
Expand Up @@ -9,11 +9,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".paket", ".paket", "{3DEDC8
paket.lock = paket.lock
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UriTemplateString.Tests", "test\UriTemplateString.Tests\UriTemplateString.Tests.csproj", "{ADB35456-3869-4B39-A455-8BEAC2F41342}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UriTemplateString.Tests", "test\UriTemplateString.Tests\UriTemplateString.Tests.csproj", "{ADB35456-3869-4B39-A455-8BEAC2F41342}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".build", ".build", "{B8C6ADCA-C527-4A76-8184-9CEEE72A5B5A}"
ProjectSection(SolutionItems) = preProject
appveyor.yml = appveyor.yml
build.cake = build.cake
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UriTemplateString", "src\UriTemplateString\UriTemplateString.csproj", "{5D3F8088-8110-4126-A373-59AC8A21B6A4}"
Expand Down
30 changes: 7 additions & 23 deletions appveyor.yml
@@ -1,37 +1,21 @@
image: Visual Studio 2017

install:
- choco install gitversion.portable -pre -y
- choco install gitlink

before_build:
- .paket\paket.exe restore
- dotnet restore
- ps: gitversion /l console /output buildserver

build:
project: UriTemplateString.sln
- ps: gitversion /l console /output buildserver /updateassemblyinfo AssemblyInfo.cs /ensureassemblyinfo

configuration: Release

after_build:
- gitlink src/UriTemplateString/bin/Release/netstandard2.0/UriTemplateString.pdb -u https://github.com/tpluscode/UriTemplateString
- gitlink src/UriTemplateString/bin/Release/net45/UriTemplateString.pdb -u https://github.com/tpluscode/UriTemplateString
- msbuild /t:Pack UriTemplateString.sln /p:Configuration=Release
build_script:
- ps: .\build.ps1 -Target CI -verbosity Verbose -configuration Release
- ps: dotnet pack --no-build --configuration Release /p:PackageVersion=$env:GitVersion_NuGetVersion

after_test:
- .\packages\OpenCover\tools\OpenCover.Console.exe -register:user -target:"%xunit20%\xunit.console.x86.exe" -targetargs:"test\UriTemplateString.Tests\bin\Release\net45\UriTemplateString.Tests.dll -noshadow -appveyor" -returntargetcode -filter:"+[UriTemplateString*]* -[UriTemplateString.Tests*]* -[Test*]*" -hideskipped:All -output:.\UriTemplateString_coverage.xml
- "SET PATH=C:\\Python34;C:\\Python34\\Scripts;%PATH%"
- pip install codecov
- codecov -f "UriTemplateString_coverage.xml"
test: off

artifacts:
- path: 'nugets\*.nupkg'
- path: UriTemplateString_coverage.xml
- path: coverage
type: zip

cache:
- packages -> paket.lock

deploy:
- provider: Environment
name: NuGet
Expand Down
61 changes: 61 additions & 0 deletions build.cake
@@ -0,0 +1,61 @@
#tool paket:?package=codecov
#tool paket:?package=gitlink
#addin paket:?package=Cake.Paket
#addin paket:?package=Cake.Codecov
#tool paket:?package=JetBrains.dotCover.CommandLineTools
#tool paket:?package=ReportGenerator&version=4.0.4

var target = Argument("target", "Build");
var configuration = Argument("Configuration", "Debug");

Task("CI")
.IsDependentOn("Build")
.IsDependentOn("Codecov");

Task("Build")
.Does(() => {
DotNetCoreRestore("UriTemplateString.sln");
})
.Does(() => {
DotNetCoreBuild("UriTemplateString.sln", new DotNetCoreBuildSettings {
Configuration = configuration
});
})
.DoesForEach(GetFiles("**/UriTemplateString.pdb"),
pdb => GitLink3(pdb, new GitLink3Settings {
RepositoryUrl = "https://github.com/tpluscode/UriTemplateString",
}));

Task("Codecov")
.IsDependentOn("Test")
.Does(() => {
Codecov("coverage\\cobertura.xml");
});

Task("Test")
.IsDependentOn("Build")
.Does(() => {
if(DirectoryExists("coverage"))
CleanDirectories("coverage");
})
.Does(() => {
var settings = new DotNetCoreTestSettings
{
Configuration = configuration,
NoBuild = true,
};
DotCoverAnalyse(
ctx => ctx.DotNetCoreTest(GetFiles("**\\UriTemplateString.Tests.csproj").Single().FullPath, settings),
"./coverage/dotcover.xml",
new DotCoverAnalyseSettings {
ReportType = DotCoverReportType.DetailedXML,
});
})
.Does(() => {
StartProcess(
@".\packages\tools\ReportGenerator\tools\net47\ReportGenerator.exe",
@"-reports:.\coverage\dotcover.xml -targetdir:.\coverage -reporttypes:Cobertura;html -assemblyfilters:-xunit*;-UriTemplateString.Tests;-Newtonsoft.Json;-FluentAssertions");
});

RunTarget(target);
164 changes: 164 additions & 0 deletions build.ps1
@@ -0,0 +1,164 @@
##########################################################################
# This is the Cake bootstrapper script for PowerShell.
# This version was download from https://github.com/larzw/Cake.Paket
# It was modified to use paket (instead of NuGet) for dependency management.
# Feel free to change this file to fit your needs.
##########################################################################

<#
.SYNOPSIS
This is a Powershell script to bootstrap a Cake build.
.DESCRIPTION
This Powershell script will download paket.exe if missing,
install all your dependencies via paket.exe restore
and execute your Cake build script with the parameters you provide.
.PARAMETER Script
The build script to execute.
.PARAMETER Target
The build script target to run.
.PARAMETER Configuration
The build configuration to use.
.PARAMETER Verbosity
Specifies the amount of information to be displayed.
.PARAMETER Experimental
Tells Cake to use the latest Roslyn release.
.PARAMETER WhatIf
Performs a dry run of the build script.
No tasks will be executed.
.PARAMETER Mono
Tells Cake to use the Mono scripting engine.
.PARAMETER Paket
The relative path to the .paket directory.
.PARAMETER Cake
The relative path to directory containing Cake.exe.
.PARAMETER Tools
The relative path to the Cake tools directory.
.PARAMETER Addins
The relative path to the Cake addins directory.
.PARAMETER Modules
The relative path to the Cake modules directory.
.PARAMETER ScriptArgs
Remaining arguments are added here.
.LINK
http://cakebuild.net
#>

[CmdletBinding()]
Param(
[string]$Script = "build.cake",
[string]$Target = "Default",
[ValidateSet("Release", "Debug")]
[string]$Configuration = "Release",
[ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")]
[string]$Verbosity = "Verbose",
[switch]$Experimental,
[Alias("DryRun","Noop")]
[switch]$WhatIf,
[switch]$Mono,
[ValidatePattern('.paket$')]
[string]$Paket = ".\.paket",
[string]$Cake = ".\packages\tools\Cake",
[string]$Tools = ".\packages\tools",
[string]$Addins = ".\packages\addins",
[string]$Modules = ".\packages\modules",
[Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)]
[string[]]$ScriptArgs
)

Write-Host "Preparing to run build script..."

# Should we use mono?
$UseMono = "";
if($Mono.IsPresent) {
Write-Verbose -Message "Using the Mono based scripting engine."
$UseMono = "-mono"
}

# Should we use the new Roslyn?
$UseExperimental = "";
if($Experimental.IsPresent -and !($Mono.IsPresent)) {
Write-Verbose -Message "Using experimental version of Roslyn."
$UseExperimental = "-experimental"
}

# Is this a dry run?
$UseDryRun = "";
if($WhatIf.IsPresent) {
$UseDryRun = "-dryrun"
}

Write-Verbose -Message "Using paket for dependency management..."

# Make sure the .paket directory exits
$PaketDir = Resolve-Path $Paket
if(!(Test-Path $PaketDir)) {
Throw "Could not find .paket directory at $PaketDir"
}
Write-Verbose -Message "Found .paket in PATH at $PaketDir"

# Set paket directory enviornment variable
$ENV:PAKET = $PaketDir

# If paket.exe does not exits then download it using paket.bootstrapper.exe
$PAKET_EXE = Join-Path $PaketDir "paket.exe"
if (!(Test-Path $PAKET_EXE)) {
# If paket.bootstrapper.exe exits then run it.
$PAKET_BOOTSTRAPPER_EXE = Join-Path $PaketDir "paket.bootstrapper.exe"
if (!(Test-Path $PAKET_BOOTSTRAPPER_EXE)) {
Throw "Could not find paket.bootstrapper.exe at $PAKET_BOOTSTRAPPER_EXE"
}
Write-Verbose -Message "Found paket.bootstrapper.exe in PATH at $PAKET_BOOTSTRAPPER_EXE"

# Download paket.exe
Write-Verbose -Message "Running paket.bootstrapper.exe to download paket.exe"
Invoke-Expression $PAKET_BOOTSTRAPPER_EXE

if (!(Test-Path $PAKET_EXE)) {
Throw "Could not find paket.exe at $PAKET_EXE"
}
}
Write-Verbose -Message "Found paket.exe in PATH at $PAKET_EXE"

# Install the dependencies
Write-Verbose -Message "Running paket.exe restore"
Invoke-Expression "$PAKET_EXE restore"

# tools
if (Test-Path $Tools) {
$ToolsDir = Resolve-Path $Tools
$ENV:CAKE_PATHS_TOOLS = $ToolsDir
}
else {
Write-Verbose -Message "Could not find tools directory at $Tools"
}

# addins
if (Test-Path $Addins) {
$AddinsDir = Resolve-Path $Addins
$ENV:CAKE_PATHS_ADDINS = $AddinsDir
}
else {
Write-Verbose -Message "Could not find addins directory at $Addins"
}

# modules
if (Test-Path $Modules) {
$ModulesDir = Resolve-Path $Modules
$ENV:CAKE_PATHS_MODULES = $ModulesDir
}
else {
Write-Verbose -Message "Could not find modules directory at $Modules"
}

# Make sure that Cake has been installed.
$CakeDir = Resolve-Path $Cake
$CAKE_EXE = Join-Path $CakeDir "Cake.exe"
if (!(Test-Path $CAKE_EXE)) {
Throw "Could not find Cake.exe at $CAKE_EXE"
}
Write-Verbose -Message "Found Cake.exe in PATH at $CAKE_EXE"

# Start Cake
Write-Host "Running build script..."
Invoke-Expression "& `"$CAKE_EXE`" `"$Script`" -target=`"$Target`" -configuration=`"$Configuration`" -verbosity=`"$Verbosity`" $UseMono $UseDryRun $UseExperimental $ScriptArgs"
exit $LASTEXITCODE
21 changes: 19 additions & 2 deletions paket.dependencies
Expand Up @@ -8,9 +8,26 @@ copy_local: true
nuget Fody
nuget NullGuard.Fody
nuget xunit
nuget GitVersionTask prerelease
nuget xunit.runner.visualstudio
nuget FluentAssertions
nuget Stylecop.Analyzers
nuget OpenCover
nuget tpluscode.library.ruleset
nuget tpluscode.UnitTests.Ruleset
nuget tpluscode.UnitTests.Ruleset

group tools
source https://nuget.org/api/v2
nuget Cake
nuget gitlink
nuget codecov
nuget JetBrains.dotCover.CommandLineTools
nuget ReportGenerator 4.0.4

group addins
source https://nuget.org/api/v2
nuget cake.paket
nuget cake.codecov

group modules
source https://nuget.org/api/v2
nuget Cake.Paket.Module

0 comments on commit 6411654

Please sign in to comment.