Skip to content
Closed
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
12 changes: 12 additions & 0 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"version": 1,
"isRoot": true,
"tools": {
"cake.tool": {
"version": "2.0.0",
"commands": [
"dotnet-cake"
]
}
}
}
4 changes: 4 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Use file-scoped namespaces
a450cb69b5e4549f5515cdb057a68771f56cefd7
e32730600746b479db0241826b9bdef8eec9bb28
63b151ebc191ef35df9e3f29584ca94ec5d7c792
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ TestResults
*.user
*.sln.docstates
.vs/
.vscode/
.idea/
.ionide/

Expand Down Expand Up @@ -123,4 +122,5 @@ tools

*.lock.json
*.nuget.targets
*.nuget.props
*.nuget.props
coverage.*.json
7 changes: 7 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"recommendations": [
"EditorConfig.EditorConfig",
"k--kato.docomment",
"ms-dotnettools.csharp"
]
}
19 changes: 19 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Run tests",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "dotnet",
"args": [
"test"
],
"cwd": "${workspaceFolder}/src/Polly.Specs",
"console": "internalConsole",
"stopAtEntry": false,
"internalConsoleOptions": "openOnSessionStart"
}
]
}
15 changes: 15 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet build ./src/Polly.sln",
"type": "shell",
"group": "build",
"presentation": {
"reveal": "silent"
},
"problemMatcher": "$msCompile"
}
]
}
2 changes: 1 addition & 1 deletion GitVersionConfig.yaml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
next-version: 7.3.0
next-version: 7.2.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

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

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

//////////////////////////////////////////////////////////////////////
// EXTERNAL NUGET LIBRARIES
//////////////////////////////////////////////////////////////////////

#addin nuget:?package=Cake.FileHelpers&version=3.3.0
#addin nuget:?package=Cake.Yaml&version=3.1.1
#addin nuget:?package=YamlDotNet&version=5.2.1
#addin nuget:?package=Cake.FileHelpers&version=5.0.0
#addin nuget:?package=Cake.Yaml&version=4.0.0
#addin nuget:?package=Newtonsoft.Json&version=13.0.1
#addin nuget:?package=YamlDotNet&version=11.2.1

///////////////////////////////////////////////////////////////////////////////
// GLOBAL VARIABLES
Expand All @@ -31,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 @@ -81,7 +82,8 @@ Teardown(_ =>
Task("__Clean")
.Does(() =>
{
DirectoryPath[] cleanDirectories = new DirectoryPath[] {
DirectoryPath[] cleanDirectories = new DirectoryPath[]
{
testResultsDir,
nupkgDestDir,
artifactsDir
Expand All @@ -94,17 +96,17 @@ Task("__Clean")
foreach(var path in solutionPaths)
{
Information("Cleaning {0}", path);
DotNetCoreClean(path.ToString());
DotNetClean(path.ToString());
}
});

Task("__RestoreNugetPackages")
Task("__RestoreNuGetPackages")
.Does(() =>
{
foreach(var solution in solutions)
{
Information("Restoring NuGet Packages for {0}", solution);
DotNetCoreRestore(solution.ToString());
DotNetRestore(solution.ToString());
}
});

Expand All @@ -114,7 +116,8 @@ Task("__UpdateAssemblyVersionInformation")
var gitVersionSettings = new ProcessSettings()
.SetRedirectStandardOutput(true);

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

Expand All @@ -129,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 @@ -151,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 @@ -174,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 @@ -184,7 +190,6 @@ Task("__UpdateDotNetStandardAssemblyVersionNumber")
throw new Exception($"{attribute} version could not be updated in {csproj}.");
}
}

});

Task("__UpdateAppVeyorBuildNumber")
Expand All @@ -201,42 +206,46 @@ Task("__BuildSolutions")
{
Information("Building {0}", solution);

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

DotNetCoreBuild(solution.ToString(), dotNetCoreBuildSettings);
DotNetBuild(solution.ToString(), dotNetCoreBuildSettings);
}
});

Task("__RunTests")
.Does(() =>
{
foreach(var specsProj in GetFiles("./src/**/*.Specs.csproj")) {
DotNetCoreTest(specsProj.FullPath, new DotNetCoreTestSettings {
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 DotNetCorePackSettings {
var dotNetCorePackSettings = new DotNetPackSettings
{
Configuration = configuration,
NoBuild = true,
OutputDirectory = nupkgDestDir
OutputDirectory = nupkgDestDir,
};

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

//////////////////////////////////////////////////////////////////////
Expand All @@ -245,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 @@ -271,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;
}
Loading