Skip to content
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
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
]
}
}
}
}
6 changes: 4 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,7 @@ artifacts:
- path: artifacts\nuget-package\*.snupkg

environment:
# Skip dotnet package caching on build servers
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
DOTNET_GENERATE_ASPNET_CERTIFICATE: false
DOTNET_NOLOGO: true
NUGET_XMLDOC_MODE: skip
1 change: 0 additions & 1 deletion build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ PUSHD %~dp0
PowerShell.exe -NoProfile -ExecutionPolicy Bypass -Command "& './build.ps1'"

IF %errorlevel% neq 0 PAUSE

70 changes: 39 additions & 31 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ var configuration = Argument<string>("configuration", "Release");
// EXTERNAL NUGET TOOLS
//////////////////////////////////////////////////////////////////////

#Tool "xunit.runner.console&version=2.4.1"
#Tool "GitVersion.CommandLine&version=5.8.1"
#Tool "xunit.runner.console&version=2.4.1"

//////////////////////////////////////////////////////////////////////
// EXTERNAL NUGET LIBRARIES
Expand All @@ -32,15 +32,15 @@ var solutionPaths = solutions.Select(solution => solution.GetDirectory());

var srcDir = Directory("./src");
var artifactsDir = Directory("./artifacts");
var testResultsDir = artifactsDir + Directory("test-results");
var testResultsDir = System.IO.Path.Combine(artifactsDir, Directory("test-results"));

// NuGet
var nupkgDestDir = artifactsDir + Directory("nuget-package");
var nupkgDestDir = System.IO.Path.Combine(artifactsDir, Directory("nuget-package"));

// Gitversion
// GitVersion
var gitVersionPath = ToolsExePath("GitVersion.exe");
Dictionary<string, object> gitVersionOutput;
var gitVersionConfigFilePath = "./GitVersionConfig.yaml";
Dictionary<string, object> gitVersionOutput;

// Versioning
string nugetVersion;
Expand Down Expand Up @@ -82,7 +82,8 @@ Teardown(_ =>
Task("__Clean")
.Does(() =>
{
DirectoryPath[] cleanDirectories = new DirectoryPath[] {
DirectoryPath[] cleanDirectories = new DirectoryPath[]
{
testResultsDir,
nupkgDestDir,
artifactsDir
Expand All @@ -99,7 +100,7 @@ Task("__Clean")
}
});

Task("__RestoreNugetPackages")
Task("__RestoreNuGetPackages")
.Does(() =>
{
foreach(var solution in solutions)
Expand All @@ -115,7 +116,8 @@ Task("__UpdateAssemblyVersionInformation")
var gitVersionSettings = new ProcessSettings()
.SetRedirectStandardOutput(true);

try {
try
{
IEnumerable<string> outputLines;
StartProcess(gitVersionPath, gitVersionSettings, out outputLines);

Expand All @@ -130,13 +132,13 @@ Task("__UpdateAssemblyVersionInformation")
GitVersionConfigYaml deserialized = DeserializeYaml<GitVersionConfigYaml>(gitVersionYamlString.Replace("next-version", "NextVersion"));
string gitVersionConfig = deserialized.NextVersion;

gitVersionOutput = new Dictionary<string, object>{
gitVersionOutput = new Dictionary<string, object>
{
{ "NuGetVersion", gitVersionConfig + "-NotFromGitRepo" },
{ "FullSemVer", gitVersionConfig },
{ "AssemblySemVer", gitVersionConfig },
{ "Major", gitVersionConfig.Split('.')[0] },
};

}

Information("");
Expand All @@ -152,19 +154,21 @@ Task("__UpdateAssemblyVersionInformation")

Information("");
Information("Mapping versioning information to:");
Information("Appveyor build number -> {0}", appveyorBuildNumber);
Information("Nuget package version -> {0}", nugetVersion);
Information("AppVeyor build number -> {0}", appveyorBuildNumber);
Information("NuGet package version -> {0}", nugetVersion);
Information("AssemblyVersion -> {0}", assemblyVersion);
Information("AssemblyFileVersion -> {0}", assemblySemver);
Information("AssemblyInformationalVersion -> {0}", assemblySemver);
});

Task("__UpdateDotNetStandardAssemblyVersionNumber")
.WithCriteria(() => AppVeyor.IsRunningOnAppVeyor)
.Does(() =>
{
Information("Updating Assembly Version Information");

var attributeToValueMap = new Dictionary<string, string>() {
var attributeToValueMap = new Dictionary<string, string>()
{
{ "AssemblyVersion", assemblyVersion },
{ "FileVersion", assemblySemver },
{ "InformationalVersion", assemblySemver },
Expand All @@ -175,7 +179,8 @@ Task("__UpdateDotNetStandardAssemblyVersionNumber")

var csproj = File("./src/" + projectName + "/" + projectName + ".csproj");

foreach(var attributeMap in attributeToValueMap) {
foreach(var attributeMap in attributeToValueMap)
{
var attribute = attributeMap.Key;
var value = attributeMap.Value;

Expand All @@ -185,7 +190,6 @@ Task("__UpdateDotNetStandardAssemblyVersionNumber")
throw new Exception($"{attribute} version could not be updated in {csproj}.");
}
}

});

Task("__UpdateAppVeyorBuildNumber")
Expand All @@ -202,11 +206,12 @@ Task("__BuildSolutions")
{
Information("Building {0}", solution);

var dotNetCoreBuildSettings = new DotNetBuildSettings {
Configuration = configuration,
Verbosity = DotNetCoreVerbosity.Minimal,
NoRestore = true,
MSBuildSettings = new DotNetMSBuildSettings { TreatAllWarningsAs = MSBuildTreatAllWarningsAs.Error }
var dotNetCoreBuildSettings = new DotNetBuildSettings
{
Configuration = configuration,
Verbosity = DotNetCoreVerbosity.Minimal,
NoRestore = true,
MSBuildSettings = new DotNetMSBuildSettings { TreatAllWarningsAs = MSBuildTreatAllWarningsAs.Error },
};

DotNetBuild(solution.ToString(), dotNetCoreBuildSettings);
Expand All @@ -216,28 +221,31 @@ Task("__BuildSolutions")
Task("__RunTests")
.Does(() =>
{
foreach(var specsProj in GetFiles("./src/**/*.Specs.csproj")) {
DotNetTest(specsProj.FullPath, new DotNetTestSettings {
foreach(var specsProj in GetFiles("./src/**/*.Specs.csproj"))
{
DotNetTest(specsProj.FullPath, new DotNetTestSettings
{
Configuration = configuration,
NoBuild = true
NoBuild = true,
});
}
});

Task("__CreateSignedNugetPackage")
Task("__CreateSignedNuGetPackage")
.Does(() =>
{
var packageName = projectName;

Information("Building {0}.{1}.nupkg", packageName, nugetVersion);

var dotNetCorePackSettings = new DotNetPackSettings {
var dotNetCorePackSettings = new DotNetPackSettings
{
Configuration = configuration,
NoBuild = true,
OutputDirectory = nupkgDestDir
OutputDirectory = nupkgDestDir,
};

DotNetPack($@"{srcDir}\{projectName}.sln", dotNetCorePackSettings);
DotNetPack(System.IO.Path.Combine(srcDir, projectName + ".sln"), dotNetCorePackSettings);
});

//////////////////////////////////////////////////////////////////////
Expand All @@ -246,13 +254,13 @@ Task("__CreateSignedNugetPackage")

Task("Build")
.IsDependentOn("__Clean")
.IsDependentOn("__RestoreNugetPackages")
.IsDependentOn("__RestoreNuGetPackages")
.IsDependentOn("__UpdateAssemblyVersionInformation")
.IsDependentOn("__UpdateDotNetStandardAssemblyVersionNumber")
.IsDependentOn("__UpdateAppVeyorBuildNumber")
.IsDependentOn("__BuildSolutions")
.IsDependentOn("__RunTests")
.IsDependentOn("__CreateSignedNugetPackage");
.IsDependentOn("__CreateSignedNuGetPackage");

///////////////////////////////////////////////////////////////////////////////
// PRIMARY TARGETS
Expand All @@ -272,6 +280,6 @@ RunTarget(target);
//////////////////////////////////////////////////////////////////////

string ToolsExePath(string exeFileName) {
var exePath = System.IO.Directory.GetFiles(@"./tools", exeFileName, SearchOption.AllDirectories).FirstOrDefault();
var exePath = System.IO.Directory.GetFiles("./tools", exeFileName, SearchOption.AllDirectories).FirstOrDefault();
return exePath;
}
}
20 changes: 11 additions & 9 deletions build.ps1
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#! /usr/bin/env pwsh
<#

.SYNOPSIS
Expand Down Expand Up @@ -41,37 +42,39 @@ Param(
[switch]$Verbose
)

$ErrorActionPreference = "Stop"
$ProgressPreference = "SilentlyContinue"

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

# Should we show verbose messages?
if($Verbose.IsPresent)
if ($Verbose.IsPresent)
{
$VerbosePreference = "continue"
}

$TOOLS_DIR = Join-Path $PSScriptRoot "tools"
$NUGET_EXE = Join-Path $TOOLS_DIR "nuget.exe"
$CAKE_EXE = "dotnet dotnet-cake"
$PACKAGES_CONFIG = Join-Path $TOOLS_DIR "packages.config"
$DOTNET = "dotnet.exe"

# Should we use mono?
$UseMono = "";
if($Mono.IsPresent) {
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)) {
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) {
if ($WhatIf.IsPresent) {
$UseDryRun = "-dryrun"
}

Expand All @@ -95,7 +98,7 @@ if (!(Test-Path $NUGET_EXE)) {
$ENV:NUGET_EXE = $NUGET_EXE

# Restore tools from NuGet?
if(-Not $SkipToolPackageRestore.IsPresent)
if (-Not $SkipToolPackageRestore.IsPresent)
{
# Restore tools from NuGet.
Push-Location
Expand All @@ -122,8 +125,7 @@ if(-Not $SkipToolPackageRestore.IsPresent)
}
}


# Start Cake
Write-Host "Running build script..."
Invoke-Expression "$CAKE_EXE `"$Script`" --target=`"$Target`" --configuration=`"$Configuration`" --verbosity=`"$Verbosity`" $UseMono $UseDryRun $UseExperimental"
exit $LASTEXITCODE
Invoke-Expression "dotnet dotnet-cake `"$Script`" --target=`"$Target`" --configuration=`"$Configuration`" --verbosity=`"$Verbosity`" $UseMono $UseDryRun $UseExperimental"
exit $LASTEXITCODE
5 changes: 2 additions & 3 deletions src/Polly.Specs/Polly.Specs.csproj
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp2.1;netcoreapp3.1;net6.0;net461;net472</TargetFrameworks>
<!-- Disable warning about End-of-Life .NET versions -->
<CheckEolTargetFramework>false</CheckEolTargetFramework>
<TargetFrameworks>netcoreapp3.1;net6.0</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('Windows'))">$(TargetFrameworks);net461;net472</TargetFrameworks>
<DisableImplicitNuGetFallbackFolder>true</DisableImplicitNuGetFallbackFolder>
</PropertyGroup>

Expand Down