diff --git a/.gitignore b/.gitignore
index 3b869cb610..96a6f29cb9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -110,8 +110,10 @@ src/GitVersionTfsTask/*.js
####################
# Cake
####################
-/tools
+tools/*
+!tools/packages.config
/*.zip
GitVersion.CommandLine/*/
-releaseArtifacts
\ No newline at end of file
+releaseArtifacts
+/ILMergeTemp
diff --git a/.travis.yml b/.travis.yml
index 2f95b12cf3..5259e80a37 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,15 +1,17 @@
language: csharp
-sudo: false
+sudo: required
+dist: trusty
+dotnet: 2.1.105
mono:
- latest
os:
- linux
- osx
before_install:
- - git fetch --unshallow # Travis always does a shallow clone, but GitVersion needs the full history including branches and tags
+ - git fetch --unshallow # Travis always does a shallow clone, but GitVersion needs the full history including branches and tags
script:
- - ./build.sh
-cache:
- directories:
- - src/packages
- - tools
+ - ./build.sh -v Diagnostic
+env:
+ global:
+ - DOTNET_CLI_TELEMETRY_OPTOUT: 1
+ - DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
\ No newline at end of file
diff --git a/appveyor.yml b/appveyor.yml
index d25bd9bb1f..6df9d5c357 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -1,3 +1,4 @@
+image: Visual Studio 2017
install:
npm i -g tfx-cli
diff --git a/build.cake b/build.cake
index 2c26a2a751..10930a0e24 100644
--- a/build.cake
+++ b/build.cake
@@ -1,5 +1,7 @@
#tool "nuget:https://www.nuget.org/api/v2?package=NUnit.ConsoleRunner&version=3.7.0"
#tool "nuget:https://www.nuget.org/api/v2?package=GitReleaseNotes&version=0.7.0"
+#tool "nuget:https://www.nuget.org/api/v2?package=ILRepack&version=2.0.15"
+#addin "nuget:?package=Cake.Incubator"
var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");
@@ -16,39 +18,45 @@ bool IsMainGitVersionRepo = StringComparer.OrdinalIgnoreCase.Equals("gittools/gi
bool IsPullRequest = BuildSystem.AppVeyor.Environment.PullRequest.IsPullRequest;
bool IsMainGitVersionBranch = StringComparer.OrdinalIgnoreCase.Equals("master", BuildSystem.AppVeyor.Environment.Repository.Branch);
+string buildDir = "./build/";
+
void Build(string configuration, string nugetVersion, string semVersion, string version, string preReleaseTag)
{
- if(IsRunningOnUnix())
- {
- XBuild("./src/GitVersion.sln", new XBuildSettings()
- .SetConfiguration(configuration)
- .WithProperty("POSIX", "True")
- .SetVerbosity(Verbosity.Minimal));
- }
- else
- {
- var msBuildSettings = new MSBuildSettings()
- .SetConfiguration(configuration)
- .SetPlatformTarget(PlatformTarget.MSIL)
- .WithProperty("Windows", "True")
- .UseToolVersion(MSBuildToolVersion.VS2015)
- .SetVerbosity(Verbosity.Minimal)
- .SetNodeReuse(false);
-
- if (BuildSystem.AppVeyor.IsRunningOnAppVeyor)
- {
- msBuildSettings = msBuildSettings
- .WithProperty("GitVersion_NuGetVersion", nugetVersion)
- .WithProperty("GitVersion_SemVer", semVersion)
- .WithProperty("GitVersion_MajorMinorPatch", version)
- .WithProperty("GitVersion_PreReleaseTag", preReleaseTag);
- }
- MSBuild("./src/GitVersion.sln", msBuildSettings);
- }
+
+ MSBuild("./src/GitVersion.sln", settings =>
+ {
+ settings.SetConfiguration(configuration)
+ .SetVerbosity(Verbosity.Minimal)
+ .WithTarget("Build")
+ .WithProperty("POSIX",IsRunningOnUnix().ToString());
+
+ if (BuildSystem.AppVeyor.IsRunningOnAppVeyor)
+ {
+ if (!string.IsNullOrWhiteSpace(nugetVersion))
+ {
+ settings.WithProperty("GitVersion_NuGetVersion", nugetVersion);
+ }
+ if (!string.IsNullOrWhiteSpace(semVersion))
+ {
+ settings.WithProperty("GitVersion_SemVer", semVersion);
+ }
+
+ if (!string.IsNullOrWhiteSpace(version))
+ {
+ settings.WithProperty("GitVersion_MajorMinorPatch", version);
+ }
+
+ if (!string.IsNullOrWhiteSpace(preReleaseTag))
+ {
+ settings.WithProperty("GitVersion_PreReleaseTag", preReleaseTag);
+ }
+ }
+ });
}
// This build task can be run to just build
Task("DogfoodBuild")
+ .IsDependentOn("Clean")
.IsDependentOn("NuGet-Package-Restore")
.Does(() =>
{
@@ -64,12 +72,12 @@ Task("Version")
UpdateAssemblyInfo = true,
LogFilePath = "console",
OutputType = GitVersionOutput.BuildServer,
- ToolPath = @"src\GitVersionExe\bin\Release\GitVersion.exe"
+ ToolPath = @"src\GitVersionExe\bin\Release\net40\GitVersion.exe"
});
GitVersion assertedVersions = GitVersion(new GitVersionSettings
{
OutputType = GitVersionOutput.Json,
- ToolPath = @"src\GitVersionExe\bin\Release\GitVersion.exe"
+ ToolPath = @"src\GitVersionExe\bin\Release\net40\GitVersion.exe"
});
version = assertedVersions.MajorMinorPatch;
@@ -81,10 +89,22 @@ Task("Version")
Task("NuGet-Package-Restore")
.Does(() =>
{
- NuGetRestore("./src/GitVersion.sln");
+ DotNetCoreRestore("./src/GitVersion.sln");
+ //NuGetRestore("./src/GitVersion.sln");
+});
+
+Task("Clean")
+ .Does(() =>
+{
+ CleanDirectories("./build");
+ CleanDirectories("./**/obj");
+
+ var binDirs = GetDirectories("./**/bin") - GetDirectories("**/GemAssets/bin");
+ CleanDirectories(binDirs);
});
Task("Build")
+ .IsDependentOn("Clean")
.IsDependentOn("Version")
.IsDependentOn("NuGet-Package-Restore")
.Does(() =>
@@ -92,19 +112,21 @@ Task("Build")
Build(configuration, nugetVersion, semVersion, version, preReleaseTag);
});
-Task("Run-NUnit-Tests")
+Task("Run-Tests-In-NUnitConsole")
.IsDependentOn("DogfoodBuild")
.Does(() =>
{
var settings = new NUnit3Settings();
+ var targetFramework = "net461";
if(IsRunningOnUnix())
{
settings.Where = "cat != NoMono";
}
+
NUnit3(new [] {
- "src/GitVersionCore.Tests/bin/" + configuration + "/GitVersionCore.Tests.dll",
- "src/GitVersionExe.Tests/bin/" + configuration + "/GitVersionExe.Tests.dll",
- "src/GitVersionTask.Tests/bin/" + configuration + "/GitVersionTask.Tests.dll" },
+ "src/GitVersionCore.Tests/bin/" + configuration + "/" + targetFramework + "/GitVersionCore.Tests.dll",
+ "src/GitVersionExe.Tests/bin/" + configuration + "/" + targetFramework + "/GitVersionExe.Tests.dll",
+ "src/GitVersionTask.Tests/bin/" + configuration + "/" + targetFramework + "/GitVersionTask.Tests.dll" },
settings);
if (AppVeyor.IsRunningOnAppVeyor)
{
@@ -113,14 +135,263 @@ Task("Run-NUnit-Tests")
}
});
+// Note: this task is not used for time being as unable to produce sensible test results output file via dotnet cli.. so using nunit console runner above instead.
+Task("Run-Tests")
+ .IsDependentOn("DogfoodBuild")
+ .Does(() =>
+{
+ var settings = new DotNetCoreTestSettings
+ {
+ Configuration = configuration,
+ NoBuild = true,
+ Filter = "TestCategory!=NoMono"
+ };
+
+ DotNetCoreTest("./src/GitVersionCore.Tests/GitVersionCore.Tests.csproj", settings);
+ DotNetCoreTest("./src/GitVersionExe.Tests/GitVersionExe.Tests.csproj", settings);
+ DotNetCoreTest("./src/GitVersionTask.Tests/GitVersionTask.Tests.csproj", settings);
+
+});
+
+void ILRepackGitVersionExe(bool includeLibGit2Sharp)
+{
+ var tempMergeDir = "ILMergeTemp";
+ var exeName = "GitVersion.exe";
+ var keyFilePath = "./src/key.snk";
+ var targetDir = "./src/GitVersionExe/bin/" + configuration + "/net40/";
+ var targetPath = targetDir + exeName;
+
+ CreateDirectory(tempMergeDir);
+ string outFilePath = "./" + tempMergeDir + "/" + exeName;
+
+ var sourcePattern = targetDir + "*.dll";
+ var sourceFiles = GetFiles(sourcePattern);
+ if(!includeLibGit2Sharp)
+ {
+ var excludePattern = "**/LibGit2Sharp.dll";
+ sourceFiles = sourceFiles - GetFiles(excludePattern);
+ }
+ var settings = new ILRepackSettings { AllowDup = "", Keyfile = keyFilePath, Internalize = true, NDebug = true, TargetKind = TargetKind.Exe, TargetPlatform = TargetPlatformVersion.v4, XmlDocs = false };
+ ILRepack(outFilePath, targetPath, sourceFiles, settings);
+}
+
+
+Task("Commandline-Package")
+ .IsDependentOn("Build")
+ .Does(() =>
+{
+
+ ILRepackGitVersionExe(false);
+
+ var outputDir = buildDir + "NuGetCommandLineBuild";
+ var toolsDir = outputDir + "/tools";
+ var libDir = toolsDir + "/lib";
+
+ CreateDirectory(outputDir);
+ CreateDirectory(toolsDir);
+ CreateDirectory(libDir);
+
+ var targetDir = "./src/GitVersionExe/bin/" + configuration + "/net40/";
+
+ var libGitFiles = GetFiles(targetDir + "LibGit2Sharp.dll*");
+ var nugetAssetsPath = "./src/GitVersionExe/NugetAssets/";
+ Information("Copying files to packaging direcory..");
+
+ CopyFiles(targetDir + "GitVersion.pdb", outputDir + "/tools/");
+ CopyFiles(targetDir + "GitVersion.exe.mdb", outputDir + "/tools/");
+
+ Information("Copying IL Merged exe file..");
+ CopyFiles("./ILMergeTemp/GitVersion.exe", outputDir + "/tools/");
+
+ Information("Copying nuget assets..");
+ CopyFiles(nugetAssetsPath + "GitVersion.CommandLine.nuspec", outputDir);
+
+ Information("Copying libgit2sharp files..");
+ CopyFiles(libGitFiles, outputDir + "/tools/");
+ CopyDirectory(targetDir + "lib/", outputDir + "/tools/lib/");
+
+ Information("Creating Nuget Package..");
+ var nuGetPackSettings = new NuGetPackSettings { Version = nugetVersion, BasePath = outputDir, OutputDirectory = outputDir };
+ NuGetPack(outputDir + "/GitVersion.CommandLine.nuspec", nuGetPackSettings);
+
+})
+.ReportError(exception =>
+{
+ Error(exception.Dump());
+ // Report the error.
+});
+
+
+Task("Portable-Package")
+ .IsDependentOn("Build")
+ .Does(() =>
+{
+
+ ILRepackGitVersionExe(true);
+
+ var outputDir = buildDir + "NuGetExeBuild";
+ var toolsDir = outputDir + "/tools";
+ var libDir = toolsDir + "/lib";
+
+ CreateDirectory(outputDir);
+ CreateDirectory(toolsDir);
+ CreateDirectory(libDir);
+
+ var targetDir = "./src/GitVersionExe/bin/" + configuration + "/net40/";
+
+ var nugetAssetsPath = "./src/GitVersionExe/NugetAssets/";
+ Information("Copying files to packaging direcory..");
+
+ CopyFiles(targetDir + "GitVersion.pdb", outputDir + "/tools/");
+ CopyFiles(targetDir + "GitVersion.exe.mdb", outputDir + "/tools/");
+
+ Information("Copying IL Merged exe file..");
+ CopyFiles("./ILMergeTemp/GitVersion.exe", outputDir + "/tools/");
+
+ Information("Copying nuget assets..");
+ CopyFiles(nugetAssetsPath + "*.ps1", outputDir + "/tools/");
+ CopyFiles(nugetAssetsPath + "GitVersion.Portable.nuspec", outputDir);
+
+ Information("Copying libgit2sharp files..");
+ CopyDirectory(targetDir + "lib/", outputDir + "/tools/lib/");
+
+ var nuGetPackSettings = new NuGetPackSettings { Version = nugetVersion, BasePath = outputDir, OutputDirectory = outputDir };
+ NuGetPack(outputDir + "/GitVersion.Portable.nuspec", nuGetPackSettings);
+
+})
+.ReportError(exception =>
+{
+ Error(exception.Dump());
+});
+
+
+Task("GitVersionCore-Package")
+ .IsDependentOn("Build")
+ .Does(() =>
+{
+ var outputDir = buildDir + "NuGetRefBuild";
+ CreateDirectory(outputDir);
+
+ var msBuildSettings = new DotNetCoreMSBuildSettings();
+ msBuildSettings.SetVersion(nugetVersion);
+ msBuildSettings.Properties["PackageVersion"] = new string[]{ nugetVersion };
+ var settings = new DotNetCorePackSettings
+ {
+ Configuration = configuration,
+ OutputDirectory = outputDir,
+ NoBuild = true,
+ MSBuildSettings = msBuildSettings
+ };
+
+ DotNetCorePack("./src/GitVersionCore", settings);
+})
+.ReportError(exception =>
+{
+ Error(exception.Dump());
+});
+
+Task("GitVersion-DotNet-Package")
+ .IsDependentOn("Build")
+ .Does(() =>
+{
+
+ // var publishDir = buildDir + "Published";
+ // CreateDirectory(outputDir);
+
+ var outputDir = buildDir + "NuGetExeDotNetCoreBuild";
+ var toolsDir = outputDir + "/tools";
+ var libDir = toolsDir + "/lib";
+
+ CreateDirectory(outputDir);
+ CreateDirectory(toolsDir);
+ CreateDirectory(libDir);
+
+
+ var msBuildSettings = new DotNetCoreMSBuildSettings();
+ msBuildSettings.SetVersion(nugetVersion);
+ msBuildSettings.Properties["PackageVersion"] = new string[]{ nugetVersion };
+
+ var framework = "netcoreapp20";
+
+ var settings = new DotNetCorePublishSettings
+ {
+ Framework = framework,
+ Configuration = configuration,
+ OutputDirectory = toolsDir,
+ MSBuildSettings = msBuildSettings
+ };
+
+ DotNetCorePublish("./src/GitVersionExe", settings);
+
+
+
+ // var targetDir = "./src/GitVersionExe/bin/" + configuration + "/" + framework + "/";
+
+ var nugetAssetsPath = "./src/GitVersionExe/NugetAssets/";
+ Information("Copying files to packaging direcory..");
+
+ Information("Copying nuget assets..");
+ CopyFiles(nugetAssetsPath + "GitVersion.CommandLine.DotNetCore.nuspec", outputDir);
+
+ //Information("Copying libgit2sharp files..");
+ //CopyDirectory(targetDir + "lib/", outputDir + "/tools/lib/");
+
+ var nuGetPackSettings = new NuGetPackSettings { Version = nugetVersion, BasePath = outputDir, OutputDirectory = outputDir };
+ NuGetPack(outputDir + "/GitVersion.CommandLine.DotNetCore.nuspec", nuGetPackSettings);
+})
+.ReportError(exception =>
+{
+ Error(exception.Dump());
+});
+
+
+Task("GitVersionTaskPackage")
+ .Description("Produces the nuget package for GitVersionTask")
+ .Does(() =>
+{
+
+ var outputDir = buildDir + "NuGetTaskBuild";
+ CreateDirectory(outputDir);
+
+ var msBuildSettings = new DotNetCoreMSBuildSettings();
+ msBuildSettings.SetVersion(nugetVersion);
+
+ msBuildSettings.Properties["PackageVersion"] = new string[]{ nugetVersion };
+ var settings = new DotNetCorePackSettings
+ {
+ Configuration = configuration,
+ OutputDirectory = outputDir,
+ NoBuild = true,
+ MSBuildSettings = msBuildSettings
+ };
+
+ DotNetCorePack("./src/GitVersionTask", settings);
+
+})
+.ReportError(exception =>
+{
+ Error(exception.Dump());
+});
+
Task("Zip-Files")
.IsDependentOn("Build")
- .IsDependentOn("Run-NUnit-Tests")
+ .IsDependentOn("Commandline-Package")
+ .IsDependentOn("Portable-Package")
+ .IsDependentOn("GitVersionCore-Package")
+ .IsDependentOn("GitVersionTaskPackage")
+ .IsDependentOn("GitVersion-DotNet-Package")
+ .IsDependentOn("Run-Tests-In-NUnitConsole")
.Does(() =>
{
- Zip("./build/NuGetCommandLineBuild/Tools/", "build/GitVersion_" + nugetVersion + ".zip");
+ Zip("./build/NuGetCommandLineBuild/tools/", "build/GitVersion_" + nugetVersion + ".zip");
+ Zip("./build/NuGetExeDotNetCoreBuild/tools/", "build/GitVersionDotNetCore_" + nugetVersion + ".zip");
+})
+.ReportError(exception =>
+{
+ Error(exception.Dump());
});
+
Task("Create-Release-Notes")
.IsDependentOn("Build")
.WithCriteria(() => IsMainGitVersionRepo && IsMainGitVersionBranch && !IsPullRequest)
@@ -148,8 +419,13 @@ Task("Create-Release-Notes")
{
Information("Create-Release-Notes is being skipped, as GitHub Token is not present.");
}
+})
+.ReportError(exception =>
+{
+ Error(exception.Dump());
});
+
Task("Package")
.IsDependentOn("Create-Release-Notes")
.IsDependentOn("Zip-Files");
@@ -166,20 +442,24 @@ Task("Upload-AppVeyor-Artifacts")
System.IO.File.WriteAllLines("build/artifacts", new[]{
"NuGetExeBuild:GitVersion.Portable." + nugetVersion +".nupkg",
"NuGetCommandLineBuild:GitVersion.CommandLine." + nugetVersion +".nupkg",
+ "NuGetExeDotNetCoreBuild:GitVersion.CommandLine.DotNetCore." + nugetVersion +".nupkg",
"NuGetRefBuild:GitVersion." + nugetVersion +".nupkg",
- "NuGetTaskBuild:GitVersionTask." + nugetVersion +".nupkg",
- "GitVersionTfsTaskBuild:gittools.gitversion-" + semVersion +".vsix",
- "GemBuild:" + gem,
- "zip:GitVersion_" + nugetVersion + ".zip"
+ "NuGetTaskBuild:GitVersionTask." + nugetVersion +".nupkg",
+ "zip:GitVersion_" + nugetVersion + ".zip",
+ "zip-dotnetcore:GitVersionDotNetCore_" + nugetVersion + ".zip"
+ // "GitVersionTfsTaskBuild:gittools.gitversion-" + semVersion +".vsix",
+ // "GemBuild:" + gem
});
AppVeyor.UploadArtifact("build/NuGetExeBuild/GitVersion.Portable." + nugetVersion +".nupkg");
AppVeyor.UploadArtifact("build/NuGetCommandLineBuild/GitVersion.CommandLine." + nugetVersion +".nupkg");
- AppVeyor.UploadArtifact("build/NuGetRefBuild/GitVersion." + nugetVersion +".nupkg");
- AppVeyor.UploadArtifact("build/NuGetTaskBuild/GitVersionTask." + nugetVersion +".nupkg");
- AppVeyor.UploadArtifact("build/GitVersionTfsTaskBuild/gittools.gitversion-" + semVersion + ".vsix");
+ AppVeyor.UploadArtifact("build/NuGetExeDotNetCoreBuild/GitVersion.CommandLine.DotNetCore." + nugetVersion +".nupkg");
+ AppVeyor.UploadArtifact("build/NuGetRefBuild/GitVersionCore." + nugetVersion +".nupkg");
+ AppVeyor.UploadArtifact("build/NuGetTaskBuild/GitVersionTask." + nugetVersion +".nupkg");
AppVeyor.UploadArtifact("build/GitVersion_" + nugetVersion + ".zip");
- AppVeyor.UploadArtifact("build/GemBuild/" + gem);
+ AppVeyor.UploadArtifact("build/GitVersionDotNetCore_" + nugetVersion + ".zip");
+ // AppVeyor.UploadArtifact("build/GitVersionTfsTaskBuild/gittools.gitversion-" + semVersion + ".vsix");
+ // AppVeyor.UploadArtifact("build/GemBuild/" + gem);
AppVeyor.UploadArtifact("build/artifacts");
if(IsMainGitVersionRepo && IsMainGitVersionBranch && !IsPullRequest)
@@ -189,11 +469,14 @@ Task("Upload-AppVeyor-Artifacts")
AppVeyor.UploadArtifact("build/releasenotes.md");
}
}
+})
+.ReportError(exception =>
+{
+ Error(exception.Dump());
});
-
Task("Travis")
- .IsDependentOn("Run-NUnit-Tests");
+ .IsDependentOn("Run-Tests");
Task("Default")
.IsDependentOn("Upload-AppVeyor-Artifacts");
diff --git a/deploy.cake b/deploy.cake
index c02b35b545..af1f67543e 100644
--- a/deploy.cake
+++ b/deploy.cake
@@ -80,11 +80,13 @@ Task("DownloadGitHubReleaseArtifacts")
// Have had missing artifacts before, lets fail early in that scenario
if (!artifactLookup.ContainsKey("NuGetRefBuild")) { throw new Exception("NuGetRefBuild artifact missing"); }
if (!artifactLookup.ContainsKey("NuGetCommandLineBuild")) { throw new Exception("NuGetCommandLineBuild artifact missing"); }
+ if (!artifactLookup.ContainsKey("NuGetExeDotNetCoreBuild")) { throw new Exception("NuGetExeDotNetCoreBuild artifact missing"); }
if (!artifactLookup.ContainsKey("NuGetTaskBuild")) { throw new Exception("NuGetTaskBuild artifact missing"); }
if (!artifactLookup.ContainsKey("NuGetExeBuild")) { throw new Exception("NuGetExeBuild artifact missing"); }
if (!artifactLookup.ContainsKey("GemBuild")) { throw new Exception("GemBuild artifact missing"); }
if (!artifactLookup.ContainsKey("GitVersionTfsTaskBuild")) { throw new Exception("GitVersionTfsTaskBuild artifact missing"); }
if (!artifactLookup.ContainsKey("zip")) { throw new Exception("zip artifact missing"); }
+ if (!artifactLookup.ContainsKey("zip-dotnetcore")) { throw new Exception("zip-dotnetcore artifact missing"); }
});
Task("Publish-NuGetPackage")
@@ -121,6 +123,23 @@ Task("Publish-NuGetCommandLine")
publishingError = true;
});
+Task("Publish-NuGetExeDotNetCore")
+ .IsDependentOn("DownloadGitHubReleaseArtifacts")
+ .Does(() =>
+{
+ NuGetPush(
+ "./releaseArtifacts/" + artifactLookup["NuGetExeDotNetCoreBuild"],
+ new NuGetPushSettings {
+ ApiKey = EnvironmentVariable("NuGetApiKey"),
+ Source = "https://www.nuget.org/api/v2/package"
+ });
+})
+.OnError(exception =>
+{
+ Information("Publish-NuGet Task failed, but continuing with next Task...");
+ publishingError = true;
+});
+
Task("Publish-MsBuildTask")
.IsDependentOn("DownloadGitHubReleaseArtifacts")
@@ -187,37 +206,61 @@ Task("Publish-VstsTask")
}
});
-
-Task("Publish-DockerImage")
- .IsDependentOn("DownloadGitHubReleaseArtifacts")
- .Does(() =>
+// PublishDocker("gittools/gitversion", tag, "content.zip", "/some/path/DockerFile");
+bool PublishDocker(string name, tagName, contentZip, dockerFilePath, containerVolume)
{
+ Information("Starting Docker Build for Image: " + name);
+
var username = EnvironmentVariable("DOCKER_USERNAME");
var password = EnvironmentVariable("DOCKER_PASSWORD");
- if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password))
+
+ if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password))
{
Warning("Skipping docker publish due to missing credentials");
- return;
+ return false;
}
- var returnCode = StartProcess("docker", new ProcessSettings
+ // copy the docker file to a build directory, along with the contents of the specified content.zip.
+ // This directory should then contain all we need for the docker build.
+ var dockerBuildFolder = "./build/Docker/";
+ CreateDirectory(dockerBuildFolder);
+
+ //var folderName = name.Replace("/", "-");
+ var dockerFileBuildFolder = dockerBuildFolder + name;
+ CreateDirectory(dockerFileBuildFolder);
+
+ Information("Copying docker file to " + dockerFileBuildFolder);
+ CopyFiles(dockerFilePath, dockerFileBuildFolder);
+
+ var contentPath = "/content";
+ var contentFolder = dockerFileBuildFolder + contentPath;
+
+ Information("Extracting docker image content to " + contentFolder);
+ Unzip(contentZip, contentFolder);
+
+ var dockerFilePathForBuild = dockerFileBuildFolder + "/DockerFile";
+ Information("Beginning Docker Build command for " + dockerFilePathForBuild);
+
+ var returnCode = StartProcess("docker", new ProcessSettings
{
- Arguments = "build . --build-arg GitVersionZip=" + artifactLookup["zip"] + " --tag gittools/gitversion:" + tag
+ Arguments = "build -f " + dockerFilePathForBuild + " " + dockerFileBuildFolder + " --build-arg contentFolder=" + contentPath + " --tag " + name + ":" + tagName
});
+
if (returnCode != 0) {
Information("Publish-DockerImage Task failed to build image, but continuing with next Task...");
publishingError = true;
- return;
+ return false;
}
returnCode = StartProcess("docker", new ProcessSettings
{
- Arguments = "run -v " + System.IO.Directory.GetCurrentDirectory() + ":/repo gittools/gitversion:" + tag
+ Arguments = "run -v " + System.IO.Directory.GetCurrentDirectory() + ":" + containerVolume + " " + name + ":" + tag
});
+
if (returnCode != 0) {
Information("Publish-DockerImage Task failed to run built image, but continuing with next Task...");
publishingError = true;
- return;
+ return false;
}
// Login to dockerhub
@@ -228,39 +271,51 @@ Task("Publish-DockerImage")
if (returnCode != 0) {
Information("Publish-DockerImage Task failed to login, but continuing with next Task...");
publishingError = true;
- return;
+ return false;
}
// Publish Tag
returnCode = StartProcess("docker", new ProcessSettings
{
- Arguments = "push gittools/gitversion:" + tag
+ Arguments = "push " + name + ":" + tag
});
if (returnCode != 0) {
Information("Publish-DockerImage Task failed push version tag, but continuing with next Task...");
publishingError = true;
- return;
+ return false;
}
// Publish latest
returnCode = StartProcess("docker", new ProcessSettings
{
- Arguments = "tag gittools/gitversion:" + tag + " gittools/gitversion:latest"
+ Arguments = "tag " + name + ":" + tag + " " + name + ":latest"
});
if (returnCode != 0) {
Information("Publish-DockerImage Task failed latest tag, but continuing with next Task...");
- publishingError = true;
+ publishingError = true;
}
+
returnCode = StartProcess("docker", new ProcessSettings
{
- Arguments = "push gittools/gitversion:latest"
+ Arguments = "push " + name + ":latest"
});
if (returnCode != 0) {
Information("Publish-DockerImage Task failed latest tag, but continuing with next Task...");
publishingError = true;
+ return false;
}
+
+}
+
+Task("Publish-DockerImage")
+ .IsDependentOn("DownloadGitHubReleaseArtifacts")
+ .Does(() =>
+{
+ PublishDocker("gittools/gitversion", tag, artifactLookup["zip"], "src/Docker/Mono/DockerFile", "/repo");
+ PublishDocker("gittools/gitversion-dotnetcore", tag, artifactLookup["zip-dotnetcore"], "src/Docker/DotNetCore/DockerFile", "c:/repo");
});
+
Task("Deploy")
.IsDependentOn("Publish-NuGetPackage")
.IsDependentOn("Publish-NuGetCommandLine")
diff --git a/src/Directory.Build.props b/src/Directory.Build.props
new file mode 100644
index 0000000000..6e345ab46f
--- /dev/null
+++ b/src/Directory.Build.props
@@ -0,0 +1,7 @@
+
+
+ 1.3.1
+ 4.2.3
+ [1.0.185]
+
+
\ No newline at end of file
diff --git a/src/Docker/DotNetCore/Dockerfile b/src/Docker/DotNetCore/Dockerfile
new file mode 100644
index 0000000000..62ae308c35
--- /dev/null
+++ b/src/Docker/DotNetCore/Dockerfile
@@ -0,0 +1,8 @@
+FROM microsoft/dotnet:2.0-runtime
+LABEL maintainers="GitTools Maintainers"
+ARG contentFolder
+
+WORKDIR /app
+COPY $contentFolder/**/* ./
+
+ENTRYPOINT ["dotnet", "GitVersion.dll"]
\ No newline at end of file
diff --git a/src/DockerBase/Dockerfile b/src/Docker/Mono/DockerBase/Dockerfile
similarity index 100%
rename from src/DockerBase/Dockerfile
rename to src/Docker/Mono/DockerBase/Dockerfile
diff --git a/src/DockerBase/readme b/src/Docker/Mono/DockerBase/readme
similarity index 100%
rename from src/DockerBase/readme
rename to src/Docker/Mono/DockerBase/readme
diff --git a/Dockerfile b/src/Docker/Mono/Dockerfile
similarity index 71%
rename from Dockerfile
rename to src/Docker/Mono/Dockerfile
index 35fa9a1b39..e765eb0be8 100644
--- a/Dockerfile
+++ b/src/Docker/Mono/Dockerfile
@@ -1,12 +1,10 @@
FROM gittools/libgit2sharp-mono
MAINTAINER GitTools Maintainers
-ARG GitVersionZip
+ARG contentFolder
-# Add GitVersion
-
-ADD ./releaseArtifacts/$GitVersionZip .
-RUN unzip -d /usr/lib/GitVersion/ $GitVersionZip && rm $GitVersionZip
+# Copy GitVersion
+COPY $contentFolder /usr/lib/GitVersion/
WORKDIR /usr/lib/GitVersion/
# Libgit2 can't resolve relative paths, patch to absolute path
diff --git a/src/GitVersion.sln b/src/GitVersion.sln
index 6af6252047..c018de2420 100644
--- a/src/GitVersion.sln
+++ b/src/GitVersion.sln
@@ -1,21 +1,20 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 14
-VisualStudioVersion = 14.0.25420.1
+# Visual Studio 15
+VisualStudioVersion = 15.0.27130.2024
MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitVersionExe", "GitVersionExe\GitVersionExe.csproj", "{C3578A7B-09A6-4444-9383-0DEAFA4958BD}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GitVersionExe", "GitVersionExe\GitVersionExe.csproj", "{C3578A7B-09A6-4444-9383-0DEAFA4958BD}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitVersionTask.Tests", "GitVersionTask.Tests\GitVersionTask.Tests.csproj", "{5A86453B-96FB-4B6E-A283-225BB9F753D3}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GitVersionTask.Tests", "GitVersionTask.Tests\GitVersionTask.Tests.csproj", "{5A86453B-96FB-4B6E-A283-225BB9F753D3}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitVersionTask", "GitVersionTask\GitVersionTask.csproj", "{F7AC0E71-3E9A-4F6D-B986-E004825A48E1}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitVersionCore.Tests", "GitVersionCore.Tests\GitVersionCore.Tests.csproj", "{BF905F84-382C-440D-92F5-C61108626D8D}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GitVersionCore.Tests", "GitVersionCore.Tests\GitVersionCore.Tests.csproj", "{BF905F84-382C-440D-92F5-C61108626D8D}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{3EFFC5D6-88D0-49D9-BB53-E1B7EB49DD45}"
ProjectSection(SolutionItems) = preProject
..\.gitattributes = ..\.gitattributes
..\.gitignore = ..\.gitignore
..\.travis.yml = ..\.travis.yml
+ ..\appveyor.deploy.yml = ..\appveyor.deploy.yml
..\appveyor.yml = ..\appveyor.yml
..\BREAKING CHANGES.md = ..\BREAKING CHANGES.md
..\build.cake = ..\build.cake
@@ -23,18 +22,22 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
..\build.sh = ..\build.sh
..\CONTRIBUTING.md = ..\CONTRIBUTING.md
..\deploy.cake = ..\deploy.cake
+ ..\deploy.ps1 = ..\deploy.ps1
+ Directory.Build.props = Directory.Build.props
..\GitVersion.yml = ..\GitVersion.yml
..\LICENSE = ..\LICENSE
..\mkdocs.yml = ..\mkdocs.yml
+ NuGet.config = NuGet.config
..\README.md = ..\README.md
EndProjectSection
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitVersionCore", "GitVersionCore\GitVersionCore.csproj", "{F9741A0D-B9D7-4557-9A1C-A7252C1071F5}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GitVersionCore", "GitVersionCore\GitVersionCore.csproj", "{F9741A0D-B9D7-4557-9A1C-A7252C1071F5}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitVersionExe.Tests", "GitVersionExe.Tests\GitVersionExe.Tests.csproj", "{75C2BE85-1DAF-4E34-8305-B17AFAA982A6}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GitVersionExe.Tests", "GitVersionExe.Tests\GitVersionExe.Tests.csproj", "{75C2BE85-1DAF-4E34-8305-B17AFAA982A6}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "TfsTask", "TfsTask", "{A0ED1410-E970-45E8-A357-05605E2B7BFF}"
ProjectSection(SolutionItems) = preProject
+ GitVersionTfsTask\BuildTs.ps1 = GitVersionTfsTask\BuildTs.ps1
GitVersionTfsTask\Create-Vsix.ps1 = GitVersionTfsTask\Create-Vsix.ps1
GitVersionTfsTask\extension-icon.png = GitVersionTfsTask\extension-icon.png
GitVersionTfsTask\GitVersion.ts = GitVersionTfsTask\GitVersion.ts
@@ -45,6 +48,26 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "TfsTask", "TfsTask", "{A0ED
GitVersionTfsTask\Update-GitVersionTfsTaskVersion.ps1 = GitVersionTfsTask\Update-GitVersionTfsTaskVersion.ps1
EndProjectSection
EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GitVersionTask", "GitVersionTask\GitVersionTask.csproj", "{F7AC0E71-3E9A-4F6D-B986-E004825A48E1}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Docker", "Docker", "{98C7108A-09FD-436D-8CA5-DF19E0FC5F8D}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Mono", "Mono", "{6A6E0584-5392-4F03-8C14-799D400941AC}"
+ ProjectSection(SolutionItems) = preProject
+ Docker\Mono\Dockerfile = Docker\Mono\Dockerfile
+ EndProjectSection
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "DotnetCore", "DotnetCore", "{E78ADE9E-5573-48E2-890C-EF59CB1BA7ED}"
+ ProjectSection(SolutionItems) = preProject
+ Docker\DotNetCore\Dockerfile = Docker\DotNetCore\Dockerfile
+ EndProjectSection
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "DockerBase", "DockerBase", "{C4479215-01B1-4EC0-A33D-C90D1579BD13}"
+ ProjectSection(SolutionItems) = preProject
+ Docker\Mono\DockerBase\Dockerfile = Docker\Mono\DockerBase\Dockerfile
+ Docker\Mono\DockerBase\readme = Docker\Mono\DockerBase\readme
+ EndProjectSection
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -59,10 +82,6 @@ Global
{5A86453B-96FB-4B6E-A283-225BB9F753D3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5A86453B-96FB-4B6E-A283-225BB9F753D3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5A86453B-96FB-4B6E-A283-225BB9F753D3}.Release|Any CPU.Build.0 = Release|Any CPU
- {F7AC0E71-3E9A-4F6D-B986-E004825A48E1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {F7AC0E71-3E9A-4F6D-B986-E004825A48E1}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {F7AC0E71-3E9A-4F6D-B986-E004825A48E1}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {F7AC0E71-3E9A-4F6D-B986-E004825A48E1}.Release|Any CPU.Build.0 = Release|Any CPU
{BF905F84-382C-440D-92F5-C61108626D8D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BF905F84-382C-440D-92F5-C61108626D8D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BF905F84-382C-440D-92F5-C61108626D8D}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -75,8 +94,20 @@ Global
{75C2BE85-1DAF-4E34-8305-B17AFAA982A6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{75C2BE85-1DAF-4E34-8305-B17AFAA982A6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{75C2BE85-1DAF-4E34-8305-B17AFAA982A6}.Release|Any CPU.Build.0 = Release|Any CPU
+ {F7AC0E71-3E9A-4F6D-B986-E004825A48E1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {F7AC0E71-3E9A-4F6D-B986-E004825A48E1}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {F7AC0E71-3E9A-4F6D-B986-E004825A48E1}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {F7AC0E71-3E9A-4F6D-B986-E004825A48E1}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
+ GlobalSection(NestedProjects) = preSolution
+ {6A6E0584-5392-4F03-8C14-799D400941AC} = {98C7108A-09FD-436D-8CA5-DF19E0FC5F8D}
+ {E78ADE9E-5573-48E2-890C-EF59CB1BA7ED} = {98C7108A-09FD-436D-8CA5-DF19E0FC5F8D}
+ {C4479215-01B1-4EC0-A33D-C90D1579BD13} = {6A6E0584-5392-4F03-8C14-799D400941AC}
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {0C1C310E-7A4D-4032-878B-6DC375894C49}
+ EndGlobalSection
EndGlobal
diff --git a/src/GitVersionCore.Tests/Approved/fs/AssemblyInfoFileUpdateTests.ShouldAddAssemblyInformationalVersionWhenUpdatingAssemblyVersionFile.approved.txt b/src/GitVersionCore.Tests/Approved/fs/AssemblyInfoFileUpdateTests.ShouldAddAssemblyInformationalVersionWhenUpdatingAssemblyVersionFile.approved.txt
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/src/GitVersionCore.Tests/Approved/fs/AssemblyInfoFileUpdateTests.ShouldCreateAssemblyInfoFileAtPathWhenNotExistsAndEnsureAssemblyInfo.approved.txt b/src/GitVersionCore.Tests/Approved/fs/AssemblyInfoFileUpdateTests.ShouldCreateAssemblyInfoFileAtPathWhenNotExistsAndEnsureAssemblyInfo.approved.txt
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/src/GitVersionCore.Tests/Approved/fs/AssemblyInfoFileUpdateTests.ShouldCreateAssemblyInfoFileWhenNotExistsAndEnsureAssemblyInfo.approved.txt b/src/GitVersionCore.Tests/Approved/fs/AssemblyInfoFileUpdateTests.ShouldCreateAssemblyInfoFileWhenNotExistsAndEnsureAssemblyInfo.approved.txt
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/src/GitVersionCore.Tests/Approved/fs/AssemblyInfoFileUpdateTests.ShouldCreateAssemblyInfoFilesAtPathWhenNotExistsAndEnsureAssemblyInfo.approved.txt b/src/GitVersionCore.Tests/Approved/fs/AssemblyInfoFileUpdateTests.ShouldCreateAssemblyInfoFilesAtPathWhenNotExistsAndEnsureAssemblyInfo.approved.txt
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/src/GitVersionCore.Tests/Approved/fs/AssemblyInfoFileUpdateTests.ShouldNotAddAssemblyInformationalVersionWhenUpdatingAssemblyVersionFileWhenVersionSchemeIsNone.approved.txt b/src/GitVersionCore.Tests/Approved/fs/AssemblyInfoFileUpdateTests.ShouldNotAddAssemblyInformationalVersionWhenUpdatingAssemblyVersionFileWhenVersionSchemeIsNone.approved.txt
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/src/GitVersionCore.Tests/Approved/fs/AssemblyInfoFileUpdateTests.ShouldNotReplaceAssemblyVersionWhenVersionSchemeIsNone.approved.txt b/src/GitVersionCore.Tests/Approved/fs/AssemblyInfoFileUpdateTests.ShouldNotReplaceAssemblyVersionWhenVersionSchemeIsNone.approved.txt
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/src/GitVersionCore.Tests/Approved/vb/AssemblyInfoFileUpdateTests.ShouldAddAssemblyInformationalVersionWhenUpdatingAssemblyVersionFile.approved.txt b/src/GitVersionCore.Tests/Approved/vb/AssemblyInfoFileUpdateTests.ShouldAddAssemblyInformationalVersionWhenUpdatingAssemblyVersionFile.approved.txt
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/src/GitVersionCore.Tests/Approved/vb/AssemblyInfoFileUpdateTests.ShouldCreateAssemblyInfoFileAtPathWhenNotExistsAndEnsureAssemblyInfo.approved.txt b/src/GitVersionCore.Tests/Approved/vb/AssemblyInfoFileUpdateTests.ShouldCreateAssemblyInfoFileAtPathWhenNotExistsAndEnsureAssemblyInfo.approved.txt
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/src/GitVersionCore.Tests/Approved/vb/AssemblyInfoFileUpdateTests.ShouldCreateAssemblyInfoFileWhenNotExistsAndEnsureAssemblyInfo.approved.txt b/src/GitVersionCore.Tests/Approved/vb/AssemblyInfoFileUpdateTests.ShouldCreateAssemblyInfoFileWhenNotExistsAndEnsureAssemblyInfo.approved.txt
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/src/GitVersionCore.Tests/Approved/vb/AssemblyInfoFileUpdateTests.ShouldCreateAssemblyInfoFilesAtPathWhenNotExistsAndEnsureAssemblyInfo.approved.txt b/src/GitVersionCore.Tests/Approved/vb/AssemblyInfoFileUpdateTests.ShouldCreateAssemblyInfoFilesAtPathWhenNotExistsAndEnsureAssemblyInfo.approved.txt
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/src/GitVersionCore.Tests/Approved/vb/AssemblyInfoFileUpdateTests.ShouldNotAddAssemblyInformationalVersionWhenUpdatingAssemblyVersionFileWhenVersionSchemeIsNone.approved.txt b/src/GitVersionCore.Tests/Approved/vb/AssemblyInfoFileUpdateTests.ShouldNotAddAssemblyInformationalVersionWhenUpdatingAssemblyVersionFileWhenVersionSchemeIsNone.approved.txt
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/src/GitVersionCore.Tests/Approved/vb/AssemblyInfoFileUpdateTests.ShouldNotReplaceAssemblyVersionWhenVersionSchemeIsNone.approved.txt b/src/GitVersionCore.Tests/Approved/vb/AssemblyInfoFileUpdateTests.ShouldNotReplaceAssemblyVersionWhenVersionSchemeIsNone.approved.txt
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/src/GitVersionCore.Tests/AssemblyFileVersionTests.cs b/src/GitVersionCore.Tests/AssemblyFileVersionTests.cs
index e09f186191..db65691e48 100644
--- a/src/GitVersionCore.Tests/AssemblyFileVersionTests.cs
+++ b/src/GitVersionCore.Tests/AssemblyFileVersionTests.cs
@@ -6,7 +6,7 @@ namespace GitVersionCore.Tests
using Shouldly;
[TestFixture]
- public class AssemblyFileVersionTests
+ public class AssemblyFileVersionTests : TestBase
{
[TestCase(AssemblyFileVersioningScheme.None, 1, 2, 3, 4, null)]
[TestCase(AssemblyFileVersioningScheme.Major, 1, 2, 3, 4, "1.0.0.0")]
diff --git a/src/GitVersionCore.Tests/AssemblyInfoFileUpdaterTests.cs b/src/GitVersionCore.Tests/AssemblyInfoFileUpdaterTests.cs
index dadc0c4bad..38593e255c 100644
--- a/src/GitVersionCore.Tests/AssemblyInfoFileUpdaterTests.cs
+++ b/src/GitVersionCore.Tests/AssemblyInfoFileUpdaterTests.cs
@@ -10,7 +10,7 @@
using Shouldly;
[TestFixture]
-public class AssemblyInfoFileUpdaterTests
+public class AssemblyInfoFileUpdaterTests : TestBase
{
[SetUp]
public void Setup()
@@ -424,7 +424,7 @@ public void ShouldAddAssemblyInformationalVersionWhenUpdatingAssemblyVersionFile
using (var assemblyInfoFileUpdater = new AssemblyInfoFileUpdater(assemblyInfoFile, workingDir, variables, fileSystem, false))
{
assemblyInfoFileUpdater.Update();
-
+
assemblyFileContent = fileSystem.ReadAllText(fileName);
assemblyFileContent.ShouldMatchApproved(c => c.SubFolder(Path.Combine("Approved", fileExtension)));
}
diff --git a/src/GitVersionCore.Tests/BuildServers/BuildServerBaseTests.cs b/src/GitVersionCore.Tests/BuildServers/BuildServerBaseTests.cs
index 2e7fc23413..c224fdc611 100644
--- a/src/GitVersionCore.Tests/BuildServers/BuildServerBaseTests.cs
+++ b/src/GitVersionCore.Tests/BuildServers/BuildServerBaseTests.cs
@@ -6,7 +6,7 @@
using Shouldly;
[TestFixture]
-public class BuildServerBaseTests
+public class BuildServerBaseTests : TestBase
{
[Test]
public void BuildNumberIsFullSemVer()
diff --git a/src/GitVersionCore.Tests/BuildServers/ContinuaCiTests.cs b/src/GitVersionCore.Tests/BuildServers/ContinuaCiTests.cs
index f039f7f546..38edab1c24 100644
--- a/src/GitVersionCore.Tests/BuildServers/ContinuaCiTests.cs
+++ b/src/GitVersionCore.Tests/BuildServers/ContinuaCiTests.cs
@@ -3,7 +3,7 @@
using NUnit.Framework;
[TestFixture]
-public class ContinuaCiTests
+public class ContinuaCiTests : TestBase
{
[Test]
diff --git a/src/GitVersionCore.Tests/BuildServers/EnvironmentVariableJenkinsTests.cs b/src/GitVersionCore.Tests/BuildServers/EnvironmentVariableJenkinsTests.cs
index 511822d2c4..8a651fd4e7 100644
--- a/src/GitVersionCore.Tests/BuildServers/EnvironmentVariableJenkinsTests.cs
+++ b/src/GitVersionCore.Tests/BuildServers/EnvironmentVariableJenkinsTests.cs
@@ -1,10 +1,11 @@
using System;
using GitVersion;
+using GitVersionCore.Tests;
using NUnit.Framework;
using Shouldly;
[TestFixture]
-public class EnvironmentVariableJenkinsTests
+public class EnvironmentVariableJenkinsTests : TestBase
{
string key = "JENKINS_URL";
string branch = "GIT_BRANCH";
diff --git a/src/GitVersionCore.Tests/BuildServers/GitLabCiMessageGenerationTest.cs b/src/GitVersionCore.Tests/BuildServers/GitLabCiMessageGenerationTest.cs
index 2c6ea5e39d..12d6c2e60e 100755
--- a/src/GitVersionCore.Tests/BuildServers/GitLabCiMessageGenerationTest.cs
+++ b/src/GitVersionCore.Tests/BuildServers/GitLabCiMessageGenerationTest.cs
@@ -8,7 +8,7 @@
using System.Reflection;
[TestFixture]
-public class GitLabCiMessageGenerationTests
+public class GitLabCiMessageGenerationTests : TestBase
{
[Test]
public void GenerateSetVersionMessageReturnsVersionAsIs_AlthoughThisIsNotUsedByJenkins()
diff --git a/src/GitVersionCore.Tests/BuildServers/JenkinsMessageGenerationTests.cs b/src/GitVersionCore.Tests/BuildServers/JenkinsMessageGenerationTests.cs
index 418463dbc9..ed2d13a948 100644
--- a/src/GitVersionCore.Tests/BuildServers/JenkinsMessageGenerationTests.cs
+++ b/src/GitVersionCore.Tests/BuildServers/JenkinsMessageGenerationTests.cs
@@ -8,7 +8,7 @@
using System.Reflection;
[TestFixture]
-public class JenkinsMessageGenerationTests
+public class JenkinsMessageGenerationTests : TestBase
{
[Test]
public void GenerateSetVersionMessageReturnsVersionAsIs_AlthoughThisIsNotUsedByJenkins()
diff --git a/src/GitVersionCore.Tests/BuildServers/MyGetTests.cs b/src/GitVersionCore.Tests/BuildServers/MyGetTests.cs
index 82a420b7bb..440ca933a9 100644
--- a/src/GitVersionCore.Tests/BuildServers/MyGetTests.cs
+++ b/src/GitVersionCore.Tests/BuildServers/MyGetTests.cs
@@ -3,7 +3,7 @@
using NUnit.Framework;
[TestFixture]
-public class MyGetTests
+public class MyGetTests : TestBase
{
[Test]
public void Develop_branch()
diff --git a/src/GitVersionCore.Tests/BuildServers/TeamCityTests.cs b/src/GitVersionCore.Tests/BuildServers/TeamCityTests.cs
index c391aca037..3731abfadf 100644
--- a/src/GitVersionCore.Tests/BuildServers/TeamCityTests.cs
+++ b/src/GitVersionCore.Tests/BuildServers/TeamCityTests.cs
@@ -3,7 +3,7 @@
using NUnit.Framework;
[TestFixture]
-public class TeamCityTests
+public class TeamCityTests : TestBase
{
[Test]
public void Develop_branch()
diff --git a/src/GitVersionCore.Tests/BuildServers/VsoAgentBuildNumberTests.cs b/src/GitVersionCore.Tests/BuildServers/VsoAgentBuildNumberTests.cs
index c3aecb813a..16552b821d 100644
--- a/src/GitVersionCore.Tests/BuildServers/VsoAgentBuildNumberTests.cs
+++ b/src/GitVersionCore.Tests/BuildServers/VsoAgentBuildNumberTests.cs
@@ -5,7 +5,7 @@
using Shouldly;
[TestFixture]
-public class VsoAgentBuildNumberTests
+public class VsoAgentBuildNumberTests : TestBase
{
string key = "BUILD_BUILDNUMBER";
string logPrefix = "##vso[build.updatebuildnumber]";
diff --git a/src/GitVersionCore.Tests/BuildServers/VsoAgentTests.cs b/src/GitVersionCore.Tests/BuildServers/VsoAgentTests.cs
index e9e629e632..f78abd3476 100644
--- a/src/GitVersionCore.Tests/BuildServers/VsoAgentTests.cs
+++ b/src/GitVersionCore.Tests/BuildServers/VsoAgentTests.cs
@@ -5,7 +5,7 @@
using Shouldly;
[TestFixture]
-public class VsoAgentTests
+public class VsoAgentTests : TestBase
{
string key = "BUILD_BUILDNUMBER";
diff --git a/src/GitVersionCore.Tests/CommitDateTests.cs b/src/GitVersionCore.Tests/CommitDateTests.cs
index 8520786baf..73235a0184 100644
--- a/src/GitVersionCore.Tests/CommitDateTests.cs
+++ b/src/GitVersionCore.Tests/CommitDateTests.cs
@@ -9,7 +9,7 @@
namespace GitVersionCore.Tests
{
[TestFixture]
- public class CommitDateTests
+ public class CommitDateTests : TestBase
{
[Test]
[TestCase("yyyy-MM-dd", "2017-10-06")]
diff --git a/src/GitVersionCore.Tests/ConfigProviderTests.cs b/src/GitVersionCore.Tests/ConfigProviderTests.cs
index 090561e920..035d4d15b6 100644
--- a/src/GitVersionCore.Tests/ConfigProviderTests.cs
+++ b/src/GitVersionCore.Tests/ConfigProviderTests.cs
@@ -1,9 +1,10 @@
+using GitTools;
using GitVersion;
using GitVersion.Helpers;
+using GitVersionCore.Tests;
using NUnit.Framework;
using Shouldly;
using System;
-using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Reflection;
@@ -11,7 +12,7 @@
using YamlDotNet.Serialization;
[TestFixture]
-public class ConfigProviderTests
+public class ConfigProviderTests : TestBase
{
private const string DefaultRepoPath = "c:\\MyGitRepo";
private const string DefaultWorkingPath = "c:\\MyGitRepo\\Working";
diff --git a/src/GitVersionCore.Tests/Configuration/IgnoreConfigTests.cs b/src/GitVersionCore.Tests/Configuration/IgnoreConfigTests.cs
index aae3807a23..513e1327a6 100644
--- a/src/GitVersionCore.Tests/Configuration/IgnoreConfigTests.cs
+++ b/src/GitVersionCore.Tests/Configuration/IgnoreConfigTests.cs
@@ -8,7 +8,7 @@
namespace GitVersionCore.Tests.Configuration
{
[TestFixture]
- public class IgnoreConfigTests
+ public class IgnoreConfigTests : TestBase
{
[Test]
public void CanDeserialize()
diff --git a/src/GitVersionCore.Tests/DocumentationTests.cs b/src/GitVersionCore.Tests/DocumentationTests.cs
index b2aed4ab2f..660ea9f356 100644
--- a/src/GitVersionCore.Tests/DocumentationTests.cs
+++ b/src/GitVersionCore.Tests/DocumentationTests.cs
@@ -4,7 +4,7 @@
using System.Reflection;
using GitVersion;
-
+using GitVersionCore.Tests;
using NUnit.Framework;
using Shouldly;
@@ -12,7 +12,7 @@
using YamlDotNet.Serialization;
[TestFixture]
-public class DocumentationTests
+public class DocumentationTests : TestBase
{
private DirectoryInfo docsDirectory;
diff --git a/src/GitVersionCore.Tests/DynamicRepositoryTests.cs b/src/GitVersionCore.Tests/DynamicRepositoryTests.cs
index 968f691ae0..a8a2782ca8 100644
--- a/src/GitVersionCore.Tests/DynamicRepositoryTests.cs
+++ b/src/GitVersionCore.Tests/DynamicRepositoryTests.cs
@@ -1,9 +1,10 @@
using System.IO;
using GitVersion;
+using GitVersionCore.Tests;
using NUnit.Framework;
[TestFixture]
-public class DynamicRepositoryTests
+public class DynamicRepositoryTests : TestBase
{
string workDirectory;
diff --git a/src/GitVersionCore.Tests/ExecuteCoreTests.cs b/src/GitVersionCore.Tests/ExecuteCoreTests.cs
index d167b60a52..bb6be7a756 100644
--- a/src/GitVersionCore.Tests/ExecuteCoreTests.cs
+++ b/src/GitVersionCore.Tests/ExecuteCoreTests.cs
@@ -1,6 +1,7 @@
using GitTools.Testing;
using GitVersion;
using GitVersion.Helpers;
+using GitVersionCore.Tests;
using NUnit.Framework;
using Shouldly;
using System;
@@ -8,7 +9,7 @@
using System.Text;
[TestFixture]
-public class ExecuteCoreTests
+public class ExecuteCoreTests : TestBase
{
IFileSystem fileSystem;
diff --git a/src/GitVersionCore.Tests/FodyWeavers.xml b/src/GitVersionCore.Tests/FodyWeavers.xml
deleted file mode 100644
index aeb3452852..0000000000
--- a/src/GitVersionCore.Tests/FodyWeavers.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
diff --git a/src/GitVersionCore.Tests/GitRepoMetadataProviderTests.cs b/src/GitVersionCore.Tests/GitRepoMetadataProviderTests.cs
index ec7d50c345..aa247383f0 100644
--- a/src/GitVersionCore.Tests/GitRepoMetadataProviderTests.cs
+++ b/src/GitVersionCore.Tests/GitRepoMetadataProviderTests.cs
@@ -8,7 +8,7 @@
using Shouldly;
[TestFixture]
- public class GitRepoMetadataProviderTests
+ public class GitRepoMetadataProviderTests : TestBase
{
[Test]
public void FindsCorrectMergeBaseForForwardMerge()
diff --git a/src/GitVersionCore.Tests/GitVersionContextTests.cs b/src/GitVersionCore.Tests/GitVersionContextTests.cs
index 21dcbd4d22..96440bf28a 100644
--- a/src/GitVersionCore.Tests/GitVersionContextTests.cs
+++ b/src/GitVersionCore.Tests/GitVersionContextTests.cs
@@ -7,7 +7,7 @@
using Shouldly;
using System.Collections.Generic;
- public class GitVersionContextTests
+ public class GitVersionContextTests : TestBase
{
[Test]
[Theory]
diff --git a/src/GitVersionCore.Tests/GitVersionCore.Tests.csproj b/src/GitVersionCore.Tests/GitVersionCore.Tests.csproj
index 6c7f1ad723..83cde8af1c 100644
--- a/src/GitVersionCore.Tests/GitVersionCore.Tests.csproj
+++ b/src/GitVersionCore.Tests/GitVersionCore.Tests.csproj
@@ -1,221 +1,74 @@
-
-
-
-
+
+
- Debug
- AnyCPU
- {BF905F84-382C-440D-92F5-C61108626D8D}
+ net461
+
Library
- Properties
GitVersionCore.Tests
GitVersionCore.Tests
- v4.5
- 6
- 512
-
-
-
+
+ false
+ false
+ false
+ false
+ false
+ true
+
true
full
false
- bin\Debug\
DEBUG;TRACE
- prompt
- 4
- false
full
false
bin\Release\
TRACE
- prompt
- 4
- false
true
-
+
+
-
- ..\packages\FluentDateTime.1.13.0\lib\NET35\FluentDateTime.dll
- True
-
-
- ..\packages\GitTools.Core.1.2.1-beta0001\lib\net45\GitTools.Core.dll
- True
-
-
- ..\packages\GitTools.Testing.1.1.1-beta0001\lib\net4\GitTools.Testing.dll
- True
-
-
- ..\packages\LibGit2Sharp.0.23.0-pre20160922233542\lib\net40\LibGit2Sharp.dll
- True
-
-
- ..\packages\NSubstitute.1.10.0.0\lib\net45\NSubstitute.dll
- True
-
-
- ..\packages\NUnit.3.6.0\lib\net45\nunit.framework.dll
- True
-
-
- ..\packages\Shouldly.2.7.0\lib\net40\Shouldly.dll
- True
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
- ..\packages\TestStack.ConventionTests.3.0.0\lib\net40\TestStack.ConventionTests.dll
- True
-
-
- ..\packages\YamlDotNet.3.8.0\lib\net35\YamlDotNet.dll
- True
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
+
+ Designer
+
-
- {f9741a0d-b9d7-4557-9a1c-a7252c1071f5}
- GitVersionCore
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
- This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
-
-
-
-
+
\ No newline at end of file
diff --git a/src/GitVersionCore.Tests/GitVersionInformationGeneratorTests.cs b/src/GitVersionCore.Tests/GitVersionInformationGeneratorTests.cs
index a22a8bca1d..49416daadd 100644
--- a/src/GitVersionCore.Tests/GitVersionInformationGeneratorTests.cs
+++ b/src/GitVersionCore.Tests/GitVersionInformationGeneratorTests.cs
@@ -11,7 +11,7 @@
namespace GitVersionCore.Tests
{
[TestFixture]
- public class GitVersionInformationGeneratorTests
+ public class GitVersionInformationGeneratorTests : TestBase
{
[SetUp]
public void Setup()
diff --git a/src/GitVersionCore.Tests/InformationalVersionBuilderTests.cs b/src/GitVersionCore.Tests/InformationalVersionBuilderTests.cs
index cc23f81f69..dc2416f1df 100644
--- a/src/GitVersionCore.Tests/InformationalVersionBuilderTests.cs
+++ b/src/GitVersionCore.Tests/InformationalVersionBuilderTests.cs
@@ -1,9 +1,10 @@
using System;
using GitVersion;
+using GitVersionCore.Tests;
using NUnit.Framework;
[TestFixture]
-public class InformationalVersionBuilderTests
+public class InformationalVersionBuilderTests : TestBase
{
[TestCase("feature1", "a682956dc1a2752aa24597a0f5cd939f93614509", 1, 2, 3, "unstable", 1, "1.2.3-unstable+1.Branch.feature1.Sha.a682956dc1a2752aa24597a0f5cd939f93614509")]
[TestCase("develop", "a682956dc1a2752aa24597a0f5cd939f93614509", 1, 2, 3, "alpha645", null, "1.2.3-alpha.645+Branch.develop.Sha.a682956dc1a2752aa24597a0f5cd939f93614509")]
diff --git a/src/GitVersionCore.Tests/Init/InitScenarios.cs b/src/GitVersionCore.Tests/Init/InitScenarios.cs
index 57748cc488..4978a81425 100644
--- a/src/GitVersionCore.Tests/Init/InitScenarios.cs
+++ b/src/GitVersionCore.Tests/Init/InitScenarios.cs
@@ -9,7 +9,7 @@
using TestStack.ConventionTests.ConventionData;
[TestFixture]
- public class InitScenarios
+ public class InitScenarios : TestBase
{
[SetUp]
public void Setup()
diff --git a/src/GitVersionCore.Tests/IntegrationTests/BranchWithoutCommitScenario.cs b/src/GitVersionCore.Tests/IntegrationTests/BranchWithoutCommitScenario.cs
index e7b3793ca9..aec7d8d465 100644
--- a/src/GitVersionCore.Tests/IntegrationTests/BranchWithoutCommitScenario.cs
+++ b/src/GitVersionCore.Tests/IntegrationTests/BranchWithoutCommitScenario.cs
@@ -4,7 +4,7 @@
using NUnit.Framework;
[TestFixture]
-public class BranchWithoutCommitScenario
+public class BranchWithoutCommitScenario : TestBase
{
[Test]
public void CanTakeVersionFromReleaseBranch()
diff --git a/src/GitVersionCore.Tests/IntegrationTests/DevelopScenarios.cs b/src/GitVersionCore.Tests/IntegrationTests/DevelopScenarios.cs
index e95d420615..72d9029b9e 100644
--- a/src/GitVersionCore.Tests/IntegrationTests/DevelopScenarios.cs
+++ b/src/GitVersionCore.Tests/IntegrationTests/DevelopScenarios.cs
@@ -6,7 +6,7 @@
using System.Collections.Generic;
[TestFixture]
-public class DevelopScenarios
+public class DevelopScenarios : TestBase
{
[Test]
public void WhenDevelopHasMultipleCommits_SpecifyExistingCommitId()
diff --git a/src/GitVersionCore.Tests/IntegrationTests/DocumentationSamples.cs b/src/GitVersionCore.Tests/IntegrationTests/DocumentationSamples.cs
index d61baa7d12..ed834cbd8d 100644
--- a/src/GitVersionCore.Tests/IntegrationTests/DocumentationSamples.cs
+++ b/src/GitVersionCore.Tests/IntegrationTests/DocumentationSamples.cs
@@ -6,7 +6,7 @@
using Shouldly;
[TestFixture]
-public class DocumentationSamples
+public class DocumentationSamples : TestBase
{
[Test]
public void GitFlowFeatureBranch()
diff --git a/src/GitVersionCore.Tests/IntegrationTests/FeatureBranchScenarios.cs b/src/GitVersionCore.Tests/IntegrationTests/FeatureBranchScenarios.cs
index 7d5bf8c5ae..7bd7506d1a 100644
--- a/src/GitVersionCore.Tests/IntegrationTests/FeatureBranchScenarios.cs
+++ b/src/GitVersionCore.Tests/IntegrationTests/FeatureBranchScenarios.cs
@@ -6,7 +6,7 @@
using NUnit.Framework;
[TestFixture]
-public class FeatureBranchScenarios
+public class FeatureBranchScenarios : TestBase
{
[Test]
public void ShouldInheritIncrementCorrectlyWithMultiplePossibleParentsAndWeirdlyNamedDevelopBranch()
diff --git a/src/GitVersionCore.Tests/IntegrationTests/FileSystemTests.cs b/src/GitVersionCore.Tests/IntegrationTests/FileSystemTests.cs
index b047022b24..378c30e123 100644
--- a/src/GitVersionCore.Tests/IntegrationTests/FileSystemTests.cs
+++ b/src/GitVersionCore.Tests/IntegrationTests/FileSystemTests.cs
@@ -2,13 +2,13 @@
using System.Text;
using GitVersion.Helpers;
-
+using GitVersionCore.Tests;
using NUnit.Framework;
using Shouldly;
[TestFixture]
-public class FileSystemTests
+public class FileSystemTests : TestBase
{
public string TempFilePath { get; set; }
diff --git a/src/GitVersionCore.Tests/IntegrationTests/HotfixBranchScenarios.cs b/src/GitVersionCore.Tests/IntegrationTests/HotfixBranchScenarios.cs
index 285a542958..8481cd3295 100644
--- a/src/GitVersionCore.Tests/IntegrationTests/HotfixBranchScenarios.cs
+++ b/src/GitVersionCore.Tests/IntegrationTests/HotfixBranchScenarios.cs
@@ -5,7 +5,7 @@
using NUnit.Framework;
[TestFixture]
-public class HotfixBranchScenarios
+public class HotfixBranchScenarios : TestBase
{
[Test]
// This test actually validates #465 as well
diff --git a/src/GitVersionCore.Tests/IntegrationTests/MainlineDevelopmentMode.cs b/src/GitVersionCore.Tests/IntegrationTests/MainlineDevelopmentMode.cs
index f062d66a9c..e5836e87e3 100644
--- a/src/GitVersionCore.Tests/IntegrationTests/MainlineDevelopmentMode.cs
+++ b/src/GitVersionCore.Tests/IntegrationTests/MainlineDevelopmentMode.cs
@@ -8,7 +8,7 @@
using NUnit.Framework;
using System.Collections.Generic;
-public class MainlineDevelopmentMode
+public class MainlineDevelopmentMode : TestBase
{
private Config config = new Config
{
diff --git a/src/GitVersionCore.Tests/IntegrationTests/MasterScenarios.cs b/src/GitVersionCore.Tests/IntegrationTests/MasterScenarios.cs
index 93f9fc3832..bc5f4dded1 100644
--- a/src/GitVersionCore.Tests/IntegrationTests/MasterScenarios.cs
+++ b/src/GitVersionCore.Tests/IntegrationTests/MasterScenarios.cs
@@ -5,7 +5,7 @@
using NUnit.Framework;
[TestFixture]
-public class MasterScenarios
+public class MasterScenarios : TestBase
{
[Test]
public void CanHandleContinuousDelivery()
diff --git a/src/GitVersionCore.Tests/IntegrationTests/OtherBranchScenarios.cs b/src/GitVersionCore.Tests/IntegrationTests/OtherBranchScenarios.cs
index c1c03b5243..0efcc15121 100644
--- a/src/GitVersionCore.Tests/IntegrationTests/OtherBranchScenarios.cs
+++ b/src/GitVersionCore.Tests/IntegrationTests/OtherBranchScenarios.cs
@@ -5,7 +5,7 @@
using Shouldly;
[TestFixture]
-public class OtherBranchScenarios
+public class OtherBranchScenarios : TestBase
{
[Test]
public void CanTakeVersionFromReleaseBranch()
diff --git a/src/GitVersionCore.Tests/IntegrationTests/OtherScenarios.cs b/src/GitVersionCore.Tests/IntegrationTests/OtherScenarios.cs
index 5fef1447c6..e4bda5e637 100644
--- a/src/GitVersionCore.Tests/IntegrationTests/OtherScenarios.cs
+++ b/src/GitVersionCore.Tests/IntegrationTests/OtherScenarios.cs
@@ -8,7 +8,7 @@
using System.Collections.Generic;
[TestFixture]
- public class OtherScenarios
+ public class OtherScenarios : TestBase
{
// This is an attempt to automatically resolve the issue where you cannot build
// when multiple branches point at the same commit
diff --git a/src/GitVersionCore.Tests/IntegrationTests/PullRequestScenarios.cs b/src/GitVersionCore.Tests/IntegrationTests/PullRequestScenarios.cs
index 73951c9068..558233eed3 100644
--- a/src/GitVersionCore.Tests/IntegrationTests/PullRequestScenarios.cs
+++ b/src/GitVersionCore.Tests/IntegrationTests/PullRequestScenarios.cs
@@ -5,7 +5,7 @@
using NUnit.Framework;
[TestFixture]
-public class PullRequestScenarios
+public class PullRequestScenarios : TestBase
{
[Test]
public void CanCalculatePullRequestChanges()
diff --git a/src/GitVersionCore.Tests/IntegrationTests/ReleaseBranchScenarios.cs b/src/GitVersionCore.Tests/IntegrationTests/ReleaseBranchScenarios.cs
index 0dacc90c58..06f96b35e1 100644
--- a/src/GitVersionCore.Tests/IntegrationTests/ReleaseBranchScenarios.cs
+++ b/src/GitVersionCore.Tests/IntegrationTests/ReleaseBranchScenarios.cs
@@ -5,7 +5,7 @@
using NUnit.Framework;
[TestFixture]
-public class ReleaseBranchScenarios
+public class ReleaseBranchScenarios : TestBase
{
[Test]
public void NoMergeBacksToDevelopInCaseThereAreNoChangesInReleaseBranch()
diff --git a/src/GitVersionCore.Tests/IntegrationTests/RemoteRepositoryScenarios.cs b/src/GitVersionCore.Tests/IntegrationTests/RemoteRepositoryScenarios.cs
index d6debdcc42..1812a8a475 100644
--- a/src/GitVersionCore.Tests/IntegrationTests/RemoteRepositoryScenarios.cs
+++ b/src/GitVersionCore.Tests/IntegrationTests/RemoteRepositoryScenarios.cs
@@ -1,14 +1,14 @@
using System;
-using System.ComponentModel;
using GitTools.Git;
using GitTools.Testing;
using GitVersionCore.Tests;
using LibGit2Sharp;
using NUnit.Framework;
using Shouldly;
+using GitTools;
[TestFixture]
-public class RemoteRepositoryScenarios
+public class RemoteRepositoryScenarios : TestBase
{
[Test]
public void GivenARemoteGitRepositoryWithCommits_ThenClonedLocalShouldMatchRemoteVersion()
diff --git a/src/GitVersionCore.Tests/IntegrationTests/SupportBranchScenarios.cs b/src/GitVersionCore.Tests/IntegrationTests/SupportBranchScenarios.cs
index 47f4037dee..2684e9b9b6 100644
--- a/src/GitVersionCore.Tests/IntegrationTests/SupportBranchScenarios.cs
+++ b/src/GitVersionCore.Tests/IntegrationTests/SupportBranchScenarios.cs
@@ -4,7 +4,7 @@
using NUnit.Framework;
[TestFixture]
-public class SupportBranchScenarios
+public class SupportBranchScenarios : TestBase
{
[Test]
public void SupportIsCalculatedCorrectly()
diff --git a/src/GitVersionCore.Tests/IntegrationTests/SwitchingToGitFlowScenarios.cs b/src/GitVersionCore.Tests/IntegrationTests/SwitchingToGitFlowScenarios.cs
index b26e05ca79..61da2ebfab 100644
--- a/src/GitVersionCore.Tests/IntegrationTests/SwitchingToGitFlowScenarios.cs
+++ b/src/GitVersionCore.Tests/IntegrationTests/SwitchingToGitFlowScenarios.cs
@@ -4,7 +4,7 @@
using NUnit.Framework;
[TestFixture]
-public class SwitchingToGitFlowScenarios
+public class SwitchingToGitFlowScenarios : TestBase
{
[Test]
public void WhenDevelopBranchedFromMasterWithLegacyVersionTags_DevelopCanUseReachableTag()
diff --git a/src/GitVersionCore.Tests/IntegrationTests/VersionBumpingScenarios.cs b/src/GitVersionCore.Tests/IntegrationTests/VersionBumpingScenarios.cs
index bc583af524..aad1a5c164 100644
--- a/src/GitVersionCore.Tests/IntegrationTests/VersionBumpingScenarios.cs
+++ b/src/GitVersionCore.Tests/IntegrationTests/VersionBumpingScenarios.cs
@@ -5,7 +5,7 @@
using System.Collections.Generic;
[TestFixture]
-public class VersionBumpingScenarios
+public class VersionBumpingScenarios : TestBase
{
[Test]
public void AppliedPrereleaseTagCausesBump()
diff --git a/src/GitVersionCore.Tests/JsonVersionBuilderTests.cs b/src/GitVersionCore.Tests/JsonVersionBuilderTests.cs
index 72989d8a99..cfcc45684d 100644
--- a/src/GitVersionCore.Tests/JsonVersionBuilderTests.cs
+++ b/src/GitVersionCore.Tests/JsonVersionBuilderTests.cs
@@ -5,7 +5,7 @@
using Shouldly;
[TestFixture]
-public class JsonVersionBuilderTests
+public class JsonVersionBuilderTests : TestBase
{
[SetUp]
public void Setup()
diff --git a/src/GitVersionCore.Tests/LoggerTest.cs b/src/GitVersionCore.Tests/LoggerTest.cs
index e4f43f33a1..e6d0a77278 100644
--- a/src/GitVersionCore.Tests/LoggerTest.cs
+++ b/src/GitVersionCore.Tests/LoggerTest.cs
@@ -6,7 +6,7 @@
namespace GitVersionCore.Tests
{
[TestFixture]
- public class LoggerTest
+ public class LoggerTest : TestBase
{
[Test]
[TestCase("http")]
diff --git a/src/GitVersionCore.Tests/Mocks/MockQueryableCommitLog.cs b/src/GitVersionCore.Tests/Mocks/MockQueryableCommitLog.cs
index d9241619b7..b8a57127ba 100644
--- a/src/GitVersionCore.Tests/Mocks/MockQueryableCommitLog.cs
+++ b/src/GitVersionCore.Tests/Mocks/MockQueryableCommitLog.cs
@@ -36,14 +36,7 @@ public IEnumerable QueryBy(string path)
{
throw new NotImplementedException();
}
-
-#pragma warning disable CS0618 // Type or member is obsolete
- public IEnumerable QueryBy(string path, FollowFilter filter)
-#pragma warning restore CS0618 // Type or member is obsolete
- {
- throw new NotImplementedException();
- }
-
+
public Commit FindMergeBase(Commit first, Commit second)
{
return null;
diff --git a/src/GitVersionCore.Tests/Mocks/MockThreadSleep.cs b/src/GitVersionCore.Tests/Mocks/MockThreadSleep.cs
index e32b4f5e04..fa04ecf06e 100644
--- a/src/GitVersionCore.Tests/Mocks/MockThreadSleep.cs
+++ b/src/GitVersionCore.Tests/Mocks/MockThreadSleep.cs
@@ -1,20 +1,21 @@
using System;
using GitVersion.Helpers;
+using System.Threading.Tasks;
public class MockThreadSleep : IThreadSleep
{
- private Action Validator;
-
- public MockThreadSleep(Action validator = null)
+ private Func Validator;
+
+ public MockThreadSleep(Func validator = null)
{
this.Validator = validator;
}
- public void Sleep(int milliseconds)
+ public async Task SleepAsync(int milliseconds)
{
if (Validator != null)
{
- Validator(milliseconds);
+ await Validator(milliseconds);
}
}
}
diff --git a/src/GitVersionCore.Tests/OperationWithExponentialBackoffTests.cs b/src/GitVersionCore.Tests/OperationWithExponentialBackoffTests.cs
index 0e8ad200fd..9f1b84634f 100644
--- a/src/GitVersionCore.Tests/OperationWithExponentialBackoffTests.cs
+++ b/src/GitVersionCore.Tests/OperationWithExponentialBackoffTests.cs
@@ -3,9 +3,11 @@
using GitVersion.Helpers;
using NUnit.Framework;
using Shouldly;
+using System.Threading.Tasks;
+using GitVersionCore.Tests;
[TestFixture]
-public class OperationWithExponentialBackoffTests
+public class OperationWithExponentialBackoffTests : TestBase
{
[Test]
public void RetryOperationThrowsWhenNegativeMaxRetries()
@@ -22,7 +24,7 @@ public void RetryOperationThrowsWhenThreadSleepIsNull()
}
[Test]
- public void OperationIsNotRetriedOnInvalidException()
+ public async Task OperationIsNotRetriedOnInvalidException()
{
Action operation = () =>
{
@@ -30,12 +32,12 @@ public void OperationIsNotRetriedOnInvalidException()
};
var retryOperation = new OperationWithExponentialBackoff(new MockThreadSleep(), operation);
- Action action = () => retryOperation.Execute();
- action.ShouldThrow();
+ Task action = retryOperation.ExecuteAsync();
+ await action.ShouldThrowAsync();
}
[Test]
- public void OperationIsRetriedOnIOException()
+ public async Task OperationIsRetriedOnIOException()
{
var operationCount = 0;
@@ -49,13 +51,13 @@ public void OperationIsRetriedOnIOException()
};
var retryOperation = new OperationWithExponentialBackoff(new MockThreadSleep(), operation);
- retryOperation.Execute();
+ await retryOperation.ExecuteAsync();
operationCount.ShouldBe(2);
}
[Test]
- public void OperationIsRetriedAMaximumNumberOfTimes()
+ public async Task OperationIsRetriedAMaximumNumberOfTimesAsync()
{
const int numberOfRetries = 3;
var operationCount = 0;
@@ -67,14 +69,14 @@ public void OperationIsRetriedAMaximumNumberOfTimes()
};
var retryOperation = new OperationWithExponentialBackoff(new MockThreadSleep(), operation, numberOfRetries);
- Action action = () => retryOperation.Execute();
- action.ShouldThrow();
+ Task action = retryOperation.ExecuteAsync();
+ await action.ShouldThrowAsync();
operationCount.ShouldBe(numberOfRetries + 1);
}
[Test]
- public void OperationDelayDoublesBetweenRetries()
+ public async Task OperationDelayDoublesBetweenRetries()
{
const int numberOfRetries = 3;
var expectedSleepMSec = 500;
@@ -85,22 +87,28 @@ public void OperationDelayDoublesBetweenRetries()
throw new IOException();
};
- Action validator = u =>
+ Func validator = (u) =>
{
- sleepCount++;
- u.ShouldBe(expectedSleepMSec);
- expectedSleepMSec *= 2;
+ return Task.Run(() =>
+ {
+ sleepCount++;
+ u.ShouldBe(expectedSleepMSec);
+ expectedSleepMSec *= 2;
+ });
+
};
var retryOperation = new OperationWithExponentialBackoff(new MockThreadSleep(validator), operation, numberOfRetries);
- Action action = () => retryOperation.Execute();
- action.ShouldThrow();
+ Task action = retryOperation.ExecuteAsync();
+ await action.ShouldThrowAsync();
+
+ // action.ShouldThrow();
sleepCount.ShouldBe(numberOfRetries);
}
[Test]
- public void TotalSleepTimeForSixRetriesIsAboutThirtySeconds()
+ public async Task TotalSleepTimeForSixRetriesIsAboutThirtySecondsAsync()
{
const int numberOfRetries = 6;
int totalSleep = 0;
@@ -110,14 +118,21 @@ public void TotalSleepTimeForSixRetriesIsAboutThirtySeconds()
throw new IOException();
};
- Action validator = u =>
+ Func validator = (u) =>
{
- totalSleep += u;
+ return Task.Run(() =>
+ {
+ totalSleep += u;
+ });
+
};
var retryOperation = new OperationWithExponentialBackoff(new MockThreadSleep(validator), operation, numberOfRetries);
- Action action = () => retryOperation.Execute();
- action.ShouldThrow();
+
+ Task action = retryOperation.ExecuteAsync();
+ await action.ShouldThrowAsync();
+ // Action action = () => retryOperation.ExecuteAsync();
+ // action.ShouldThrow();
// Exact number is 31,5 seconds
totalSleep.ShouldBe(31500);
diff --git a/src/GitVersionCore.Tests/SemanticVersionTests.cs b/src/GitVersionCore.Tests/SemanticVersionTests.cs
index 498d91c998..a44cb3e04c 100644
--- a/src/GitVersionCore.Tests/SemanticVersionTests.cs
+++ b/src/GitVersionCore.Tests/SemanticVersionTests.cs
@@ -1,9 +1,10 @@
using GitVersion;
+using GitVersionCore.Tests;
using NUnit.Framework;
using Shouldly;
[TestFixture]
-public class SemanticVersionTests
+public class SemanticVersionTests : TestBase
{
[TestCase("1.2.3", 1, 2, 3, null, null, null, null, null, null, null, null)]
diff --git a/src/GitVersionCore.Tests/TestBase.cs b/src/GitVersionCore.Tests/TestBase.cs
new file mode 100644
index 0000000000..53381cf9cc
--- /dev/null
+++ b/src/GitVersionCore.Tests/TestBase.cs
@@ -0,0 +1,11 @@
+namespace GitVersionCore.Tests
+{
+ public class TestBase
+ {
+ static TestBase()
+ {
+ ModuleInitializer.Initialize();
+ }
+
+ }
+}
diff --git a/src/GitVersionCore.Tests/VariableProviderTests.cs b/src/GitVersionCore.Tests/VariableProviderTests.cs
index cebf0d6862..f8bdf1f895 100644
--- a/src/GitVersionCore.Tests/VariableProviderTests.cs
+++ b/src/GitVersionCore.Tests/VariableProviderTests.cs
@@ -5,8 +5,9 @@
using Shouldly;
[TestFixture]
-public class VariableProviderTests
-{
+public class VariableProviderTests : TestBase
+{
+
[SetUp]
public void Setup()
{
diff --git a/src/GitVersionCore.Tests/VersionCalculation/BaseVersionCalculatorTests.cs b/src/GitVersionCore.Tests/VersionCalculation/BaseVersionCalculatorTests.cs
index 7a7057b058..dd53f77941 100644
--- a/src/GitVersionCore.Tests/VersionCalculation/BaseVersionCalculatorTests.cs
+++ b/src/GitVersionCore.Tests/VersionCalculation/BaseVersionCalculatorTests.cs
@@ -12,7 +12,7 @@
using Shouldly;
[TestFixture]
- public class BaseVersionCalculatorTests
+ public class BaseVersionCalculatorTests : TestBase
{
[Test]
public void ChoosesHighestVersionReturnedFromStrategies()
diff --git a/src/GitVersionCore.Tests/VersionCalculation/NextVersionCalculatorTests.cs b/src/GitVersionCore.Tests/VersionCalculation/NextVersionCalculatorTests.cs
index b3b947b796..aade87827e 100644
--- a/src/GitVersionCore.Tests/VersionCalculation/NextVersionCalculatorTests.cs
+++ b/src/GitVersionCore.Tests/VersionCalculation/NextVersionCalculatorTests.cs
@@ -10,7 +10,7 @@
using NUnit.Framework;
using Shouldly;
- public class NextVersionCalculatorTests
+ public class NextVersionCalculatorTests : TestBase
{
[Test]
public void ShouldIncrementVersionBasedOnConfig()
diff --git a/src/GitVersionCore.Tests/VersionCalculation/Strategies/ConfigNextVersionBaseVersionStrategyTests.cs b/src/GitVersionCore.Tests/VersionCalculation/Strategies/ConfigNextVersionBaseVersionStrategyTests.cs
index 1938c10d3d..e0a6f8e6cd 100644
--- a/src/GitVersionCore.Tests/VersionCalculation/Strategies/ConfigNextVersionBaseVersionStrategyTests.cs
+++ b/src/GitVersionCore.Tests/VersionCalculation/Strategies/ConfigNextVersionBaseVersionStrategyTests.cs
@@ -7,7 +7,7 @@
using Shouldly;
[TestFixture]
- public class ConfigNextVersionBaseVersionStrategyTests
+ public class ConfigNextVersionBaseVersionStrategyTests : TestBase
{
[Test]
public void ShouldNotBeIncremented()
diff --git a/src/GitVersionCore.Tests/VersionCalculation/Strategies/MergeMessageBaseVersionStrategyTests.cs b/src/GitVersionCore.Tests/VersionCalculation/Strategies/MergeMessageBaseVersionStrategyTests.cs
index 18d0892aaa..407940265a 100644
--- a/src/GitVersionCore.Tests/VersionCalculation/Strategies/MergeMessageBaseVersionStrategyTests.cs
+++ b/src/GitVersionCore.Tests/VersionCalculation/Strategies/MergeMessageBaseVersionStrategyTests.cs
@@ -8,7 +8,7 @@
using Shouldly;
[TestFixture]
- public class MergeMessageBaseVersionStrategyTests
+ public class MergeMessageBaseVersionStrategyTests : TestBase
{
[Test]
public void ShouldNotAllowIncrementOfVersion()
diff --git a/src/GitVersionCore.Tests/VersionCalculation/Strategies/VersionInBranchNameBaseVersionStrategyTests.cs b/src/GitVersionCore.Tests/VersionCalculation/Strategies/VersionInBranchNameBaseVersionStrategyTests.cs
index 01afaa0ea8..106d729260 100644
--- a/src/GitVersionCore.Tests/VersionCalculation/Strategies/VersionInBranchNameBaseVersionStrategyTests.cs
+++ b/src/GitVersionCore.Tests/VersionCalculation/Strategies/VersionInBranchNameBaseVersionStrategyTests.cs
@@ -9,7 +9,7 @@
using Shouldly;
[TestFixture]
- public class VersionInBranchNameBaseVersionStrategyTests
+ public class VersionInBranchNameBaseVersionStrategyTests : TestBase
{
[Test]
[TestCase("release-2.0.0", "2.0.0")]
diff --git a/src/GitVersionCore.Tests/VersionFilters/MinDateVersionFilterTests.cs b/src/GitVersionCore.Tests/VersionFilters/MinDateVersionFilterTests.cs
index 6733c8ad28..a10dda8adf 100644
--- a/src/GitVersionCore.Tests/VersionFilters/MinDateVersionFilterTests.cs
+++ b/src/GitVersionCore.Tests/VersionFilters/MinDateVersionFilterTests.cs
@@ -8,7 +8,7 @@
namespace GitVersionCore.Tests.VersionFilters
{
[TestFixture]
- public class MinDateVersionFilterTests
+ public class MinDateVersionFilterTests : TestBase
{
[Test]
public void VerifyNullGuard()
diff --git a/src/GitVersionCore.Tests/VersionFilters/ShaVersionFilterTests.cs b/src/GitVersionCore.Tests/VersionFilters/ShaVersionFilterTests.cs
index 9374fa7b0b..ce36271a4f 100644
--- a/src/GitVersionCore.Tests/VersionFilters/ShaVersionFilterTests.cs
+++ b/src/GitVersionCore.Tests/VersionFilters/ShaVersionFilterTests.cs
@@ -8,7 +8,7 @@
namespace GitVersionCore.Tests.VersionFilters
{
[TestFixture]
- public class ShaVersionFilterTests
+ public class ShaVersionFilterTests : TestBase
{
[Test]
public void VerifyNullGuard()
diff --git a/src/GitVersionCore.Tests/app.config b/src/GitVersionCore.Tests/app.config
index c24557fb8a..97f26416bc 100644
--- a/src/GitVersionCore.Tests/app.config
+++ b/src/GitVersionCore.Tests/app.config
@@ -1,15 +1,13 @@
-
+
-
-
-
-
-
-
-
+
+
+
-
\ No newline at end of file
+
+
+
diff --git a/src/GitVersionCore.Tests/packages.config b/src/GitVersionCore.Tests/packages.config
deleted file mode 100644
index 0797568c38..0000000000
--- a/src/GitVersionCore.Tests/packages.config
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/GitVersionCore/AssemblyInfo.cs b/src/GitVersionCore/AssemblyInfo.cs
index e99b097fdb..b4a21bb9ee 100644
--- a/src/GitVersionCore/AssemblyInfo.cs
+++ b/src/GitVersionCore/AssemblyInfo.cs
@@ -10,4 +10,4 @@
[assembly: InternalsVisibleTo("GitVersionCore.Tests")]
[assembly: InternalsVisibleTo("GitVersionExe.Tests")]
-[assembly: AssemblyInformationalVersion("4.0.0-beta.12+1291.Branch.master.Sha.bc74ac2247d8a58053a33316334ada6b771a8455")]
+[assembly: AssemblyInformationalVersion("4.0.0-netstandard.1+1538.Branch.feature/netstandard.Sha.91536c107ba91f755f14904fc69965a9ad70fcb0")]
diff --git a/src/GitVersionCore/BuildServers/AppVeyor.cs b/src/GitVersionCore/BuildServers/AppVeyor.cs
index 619f6d81e2..c430d6ab27 100644
--- a/src/GitVersionCore/BuildServers/AppVeyor.cs
+++ b/src/GitVersionCore/BuildServers/AppVeyor.cs
@@ -3,6 +3,13 @@
using System;
using System.Net;
using System.Text;
+#if !NETDESKTOP
+ using System.Net.Http;
+ using System.Threading.Tasks;
+ using System.Net.Http.Headers;
+ using Newtonsoft.Json;
+ using System.IO;
+#endif
public class AppVeyor : BuildServerBase
{
@@ -13,6 +20,97 @@ public override bool CanApplyToCurrentContext()
return !string.IsNullOrEmpty(Environment.GetEnvironmentVariable(EnvironmentVariableName));
}
+#if !NETDESKTOP
+
+
+ public override string GenerateSetVersionMessage(VersionVariables variables)
+ {
+
+ var buildNumber = Environment.GetEnvironmentVariable("APPVEYOR_BUILD_NUMBER");
+ var restBase = Environment.GetEnvironmentVariable("APPVEYOR_API_URL");
+
+ var request = (HttpWebRequest)WebRequest.Create(restBase + "api/build");
+ request.Method = "PUT";
+
+
+ var data = string.Format("{{ \"version\": \"{0}.build.{1}\" }}", variables.FullSemVer, buildNumber);
+ var bytes = Encoding.UTF8.GetBytes(data);
+ if (request.Headers == null)
+ {
+ request.Headers = new WebHeaderCollection();
+ }
+
+ var bytesLength = bytes.Length;
+ //request.Headers["Content-Length"] = bytesLength.ToString();
+ // request.ContentLength = bytes.Length;
+ request.ContentType = "application/json";
+
+ using (var writeStream = request.GetRequestStreamAsync().Result)
+ {
+ writeStream.Write(bytes, 0, bytes.Length);
+ }
+
+ //var result = request.BeginGetRequestStream((asyncResult) =>
+ // {
+ // using (var writeStream = request.EndGetRequestStream(asyncResult))
+ // {
+ // writeStream.Write(bytes, 0, bytes.Length);
+ // }
+
+ // }, null);
+
+ // result.AsyncWaitHandle.WaitOne(new TimeSpan(0, 3, 0));
+
+ using (var response = (HttpWebResponse)request.GetResponseAsync().Result)
+ {
+ if (response.StatusCode != HttpStatusCode.OK && response.StatusCode != HttpStatusCode.NoContent)
+ {
+ var message = string.Format("Request failed. Received HTTP {0}", response.StatusCode);
+ return message;
+ }
+ }
+
+ return string.Format("Set AppVeyor build number to '{0}'.", variables.FullSemVer);
+
+ }
+
+
+ public override string[] GenerateSetParameterMessage(string name, string value)
+ {
+
+ // var buildNumber = Environment.GetEnvironmentVariable("APPVEYOR_BUILD_NUMBER");
+ var restBase = Environment.GetEnvironmentVariable("APPVEYOR_API_URL");
+
+ var request = (HttpWebRequest)WebRequest.Create(restBase + "api/build/variables");
+ request.Method = "POST";
+ request.ContentType = "application/json";
+ request.Accept = "application/json";
+
+ var data = string.Format("{{ \"name\": \"GitVersion_{0}\", \"value\": \"{1}\" }}", name, value);
+ var bytes = Encoding.UTF8.GetBytes(data);
+ if (request.Headers == null)
+ {
+ request.Headers = new WebHeaderCollection();
+ }
+ var bytesLength = bytes.Length;
+ // No property for content-length - and no Add() method on header collection? WHAAAAT
+ // request.ContentLength = bytes.Length;
+ //request.Headers["Content-Length"] = bytesLength.ToString();
+
+ using (var writeStream = request.GetRequestStreamAsync().Result)
+ {
+ writeStream.Write(bytes, 0, bytes.Length);
+ }
+
+ return new[]
+ {
+ string.Format("Adding Environment Variable. name='GitVersion_{0}' value='{1}']", name, value)
+ };
+ }
+
+
+#else
+
public override string GenerateSetVersionMessage(VersionVariables variables)
{
var buildNumber = Environment.GetEnvironmentVariable("APPVEYOR_BUILD_NUMBER");
@@ -23,7 +121,14 @@ public override string GenerateSetVersionMessage(VersionVariables variables)
var data = string.Format("{{ \"version\": \"{0}.build.{1}\" }}", variables.FullSemVer, buildNumber);
var bytes = Encoding.UTF8.GetBytes(data);
- request.ContentLength = bytes.Length;
+ if (request.Headers == null)
+ {
+ request.Headers = new WebHeaderCollection();
+ }
+ var bytesLength = bytes.Length;
+ // request.Headers["Content-Length"] = bytesLength.ToString();
+
+ // request.ContentLength = bytes.Length;
request.ContentType = "application/json";
using (var writeStream = request.GetRequestStream())
@@ -60,5 +165,9 @@ public override string[] GenerateSetParameterMessage(string name, string value)
string.Format("Adding Environment Variable. name='GitVersion_{0}' value='{1}']", name, value)
};
}
+
+
+#endif
+
}
}
\ No newline at end of file
diff --git a/src/GitVersionCore/BuildServers/BuildServerList.cs b/src/GitVersionCore/BuildServers/BuildServerList.cs
index dcd4f6f5a8..87751cbbf4 100644
--- a/src/GitVersionCore/BuildServers/BuildServerList.cs
+++ b/src/GitVersionCore/BuildServers/BuildServerList.cs
@@ -7,7 +7,9 @@ public static class BuildServerList
{
static List BuildServers = new List
{
+#if NETDESKTOP
new ContinuaCi(),
+#endif
new TeamCity(),
new AppVeyor(),
new MyGet(),
diff --git a/src/GitVersionCore/BuildServers/MyGet.cs b/src/GitVersionCore/BuildServers/MyGet.cs
index 7f652ebc9e..fe7a6b9453 100644
--- a/src/GitVersionCore/BuildServers/MyGet.cs
+++ b/src/GitVersionCore/BuildServers/MyGet.cs
@@ -10,7 +10,7 @@ public override bool CanApplyToCurrentContext()
var buildRunner = Environment.GetEnvironmentVariable("BuildRunner");
return !string.IsNullOrEmpty(buildRunner)
- && buildRunner.Equals("MyGet", StringComparison.InvariantCultureIgnoreCase);
+ && buildRunner.Equals("MyGet", StringComparerUtils.IngoreCaseComparison);
}
public override string[] GenerateSetParameterMessage(string name, string value)
@@ -20,7 +20,7 @@ public override string[] GenerateSetParameterMessage(string name, string value)
string.Format("##myget[setParameter name='GitVersion.{0}' value='{1}']", name, ServiceMessageEscapeHelper.EscapeValue(value))
};
- if (string.Equals(name, "LegacySemVerPadded", StringComparison.InvariantCultureIgnoreCase))
+ if (string.Equals(name, "LegacySemVerPadded", StringComparerUtils.IngoreCaseComparison))
{
messages.Add(string.Format("##myget[buildNumber '{0}']", ServiceMessageEscapeHelper.EscapeValue(value)));
}
diff --git a/src/GitVersionCore/Configuration/Config.cs b/src/GitVersionCore/Configuration/Config.cs
index 733b294292..8225df969f 100644
--- a/src/GitVersionCore/Configuration/Config.cs
+++ b/src/GitVersionCore/Configuration/Config.cs
@@ -4,6 +4,7 @@
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
+ using System.Reflection;
using System.Text.RegularExpressions;
using YamlDotNet.Serialization;
diff --git a/src/GitVersionCore/Configuration/ConfigurationProvider.cs b/src/GitVersionCore/Configuration/ConfigurationProvider.cs
index 6c78f4b037..d0fc3b8d96 100644
--- a/src/GitVersionCore/Configuration/ConfigurationProvider.cs
+++ b/src/GitVersionCore/Configuration/ConfigurationProvider.cs
@@ -6,7 +6,7 @@ namespace GitVersion
using System.IO;
using System.Linq;
using System.Text;
- using WarningException = System.ComponentModel.WarningException;
+ using WarningException = GitTools.WarningException;
public class ConfigurationProvider
{
diff --git a/src/GitVersionCore/Configuration/LegacyConfig.cs b/src/GitVersionCore/Configuration/LegacyConfig.cs
index 69d83a7a8f..abc46debd3 100644
--- a/src/GitVersionCore/Configuration/LegacyConfig.cs
+++ b/src/GitVersionCore/Configuration/LegacyConfig.cs
@@ -3,6 +3,7 @@ namespace GitVersion
using System.Collections.Generic;
using System.Linq;
using YamlDotNet.Serialization;
+ using System.Reflection;
///
/// Obsolete properties are added to this, so we can check to see if they are used and provide good error messages for migration
@@ -42,7 +43,9 @@ public Dictionary Branches
private T MergeObjects(T target, T source)
{
- typeof(T).GetProperties()
+
+ var typeInfo = typeof(T);
+ typeInfo.GetProperties()
.Where(prop => prop.CanRead && prop.CanWrite)
.Select(_ => new
{
diff --git a/src/GitVersionCore/Configuration/TypeHelper.cs b/src/GitVersionCore/Configuration/TypeHelper.cs
new file mode 100644
index 0000000000..b94e68f8b0
--- /dev/null
+++ b/src/GitVersionCore/Configuration/TypeHelper.cs
@@ -0,0 +1,30 @@
+using System;
+using System.Collections.Generic;
+using System.Reflection;
+
+//public static class TypeHelper
+//{
+//#if NETDESKTOP
+// public static Type GetType()
+// {
+// return GetType();
+// }
+//#else
+// public static TypeInfo GetType()
+// {
+// return GetType();
+// }
+//#endif
+
+//#if NETDESKTOP
+// public static IEnumerable GetConstructorsForType()
+// {
+// return GetType().GetConstructors();
+// }
+//#else
+// public static IEnumerable GetConstructorsForType()
+// {
+// return GetType().DeclaredConstructors;
+// }
+//#endif
+//}
diff --git a/src/GitVersionCore/ExecuteCore.cs b/src/GitVersionCore/ExecuteCore.cs
index edb5de640f..1080721420 100644
--- a/src/GitVersionCore/ExecuteCore.cs
+++ b/src/GitVersionCore/ExecuteCore.cs
@@ -1,10 +1,12 @@
namespace GitVersion
{
+ using GitTools;
using GitVersion.Helpers;
using LibGit2Sharp;
using System;
using System.ComponentModel;
using System.Linq;
+ using System.Threading.Tasks;
public class ExecuteCore
{
@@ -61,7 +63,7 @@ public VersionVariables ExecuteGitVersion(string targetUrl, string dynamicReposi
{
try
{
- gitVersionCache.WriteVariablesToDiskCache(gitPreparer, cacheKey, versionVariables);
+ gitVersionCache.WriteVariablesToDiskCache(gitPreparer, cacheKey, versionVariables);
}
catch (AggregateException e)
{
@@ -124,7 +126,7 @@ IRepository GetRepository(string gitDirectory)
var branch = repository.Head;
if (branch.Tip == null)
{
- throw new WarningException("No Tip found. Has repo been initialized?");
+ throw new GitTools.WarningException("No Tip found. Has repo been initialized?");
}
return repository;
}
@@ -132,7 +134,7 @@ IRepository GetRepository(string gitDirectory)
{
if (exception.Message.Contains("LibGit2Sharp.Core.NativeMethods") || exception.Message.Contains("FilePathMarshaler"))
{
- throw new WarningException("Restart of the process may be required to load an updated version of LibGit2Sharp.");
+ throw new GitTools.WarningException("Restart of the process may be required to load an updated version of LibGit2Sharp.");
}
throw;
}
diff --git a/src/GitVersionCore/Extensions/ReadEmbeddedResourceExtensions.cs b/src/GitVersionCore/Extensions/ReadEmbeddedResourceExtensions.cs
index a57e7ef720..4f5ff14587 100644
--- a/src/GitVersionCore/Extensions/ReadEmbeddedResourceExtensions.cs
+++ b/src/GitVersionCore/Extensions/ReadEmbeddedResourceExtensions.cs
@@ -1,6 +1,7 @@
namespace GitVersionCore.Extensions
{
using System.IO;
+ using System.Reflection;
public static class ReadEmbeddedResourceExtensions
{
@@ -23,7 +24,11 @@ public static string ReadAsStringFromEmbeddedResource(this string resourceNam
public static Stream ReadFromEmbeddedResource(this string resourceName)
{
+#if NETDESKTOP
var assembly = typeof(T).Assembly;
+#else
+ var assembly = typeof(T).GetTypeInfo().Assembly;
+#endif
return assembly.GetManifestResourceStream(resourceName);
}
}
diff --git a/src/GitVersionCore/Extensions/TaskHelper.cs b/src/GitVersionCore/Extensions/TaskHelper.cs
new file mode 100644
index 0000000000..92cffec0b7
--- /dev/null
+++ b/src/GitVersionCore/Extensions/TaskHelper.cs
@@ -0,0 +1,29 @@
+namespace System.Threading.Tasks
+{
+ public static class TaskHelper
+ {
+
+#if NETDESKTOP
+ public static Task Delay(int milliseconds)
+ {
+ var tcs = new TaskCompletionSource();
+ System.Timers.Timer timer = new System.Timers.Timer();
+ timer.Elapsed += (obj, args) =>
+ {
+ tcs.TrySetResult(true);
+ };
+ timer.Interval = (double)milliseconds;
+ timer.AutoReset = false;
+ timer.Start();
+ return tcs.Task;
+ }
+#else
+ public static Task Delay(int milliseconds)
+ {
+ return Task.Delay(milliseconds);
+ }
+#endif
+ }
+
+
+}
diff --git a/src/GitVersionCore/FodyWeavers.xml b/src/GitVersionCore/FodyWeavers.xml
deleted file mode 100644
index 2ca034c764..0000000000
--- a/src/GitVersionCore/FodyWeavers.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/src/GitVersionCore/GitPreparer.cs b/src/GitVersionCore/GitPreparer.cs
index 50f0e48de3..919340889f 100644
--- a/src/GitVersionCore/GitPreparer.cs
+++ b/src/GitVersionCore/GitPreparer.cs
@@ -83,14 +83,14 @@ private void CleanupDuplicateOrigin()
var repo = new Repository(GetDotGitDirectory());
// check that we have a remote that matches defaultRemoteName if not take the first remote
- if (!repo.Network.Remotes.Any(remote => remote.Name.Equals(defaultRemoteName, StringComparison.InvariantCultureIgnoreCase)))
+ if (!repo.Network.Remotes.Any(remote => remote.Name.Equals(defaultRemoteName, StringComparerUtils.IngoreCaseComparison)))
{
remoteToKeep = repo.Network.Remotes.First().Name;
}
var duplicateRepos = repo.Network
.Remotes
- .Where(remote => !remote.Name.Equals(remoteToKeep, StringComparison.InvariantCultureIgnoreCase))
+ .Where(remote => !remote.Name.Equals(remoteToKeep, StringComparerUtils.IngoreCaseComparison))
.Select(remote => remote.Name);
// remove all remotes that are considered duplicates
diff --git a/src/GitVersionCore/GitVersionCache.cs b/src/GitVersionCore/GitVersionCache.cs
index 99307c2ab6..d7d1783a37 100644
--- a/src/GitVersionCore/GitVersionCache.cs
+++ b/src/GitVersionCore/GitVersionCache.cs
@@ -5,6 +5,7 @@ namespace GitVersion
using System.Collections.Generic;
using System.IO;
using System.Linq;
+ using System.Threading.Tasks;
using YamlDotNet.Serialization;
public class GitVersionCache
@@ -45,7 +46,7 @@ public void WriteVariablesToDiskCache(GitPreparer gitPreparer, GitVersionCacheKe
};
var retryOperation = new OperationWithExponentialBackoff(new ThreadSleep(), writeCacheOperation, maxRetries: 6);
- retryOperation.Execute();
+ retryOperation.ExecuteAsync().Wait();
}
public static string GetCacheDirectory(GitPreparer gitPreparer)
diff --git a/src/GitVersionCore/GitVersionCore.csproj b/src/GitVersionCore/GitVersionCore.csproj
index d95644ffd2..ebb4e6db9a 100644
--- a/src/GitVersionCore/GitVersionCore.csproj
+++ b/src/GitVersionCore/GitVersionCore.csproj
@@ -1,52 +1,65 @@
-
-
-
-
+
+
- Debug
- AnyCPU
- {F9741A0D-B9D7-4557-9A1C-A7252C1071F5}
+ netstandard1.3;net40
Library
- Properties
GitVersion
GitVersionCore
- v4.0
- 6
- 512
$(SolutionDir)..\build\
-
-
+
+ GitVersionCore
+ GitVersion
+ GitTools and Contributors
+ https://github.com/GitTools/GitVersion
+ false
+ Git;Versioning;GitVersion;GitFlowVersion;GitFlow;GitHubFlow;SemVer
+ Derives SemVer information from a repository following GitFlow or GitHubFlow.
+ Copyright GitTools 2015.
+ http://www.opensource.org/licenses/mit-license.php
+ https://raw.githubusercontent.com/GitTools/GitVersion/master/docs/img/package_icon.png
+ https://github.com/GitTools/GitVersion/releases
+
+ $(Authors)
+ $(AssemblyName)
+ false
+ false
+ false
+ false
+ false
+ true
-
- true
+
+
+ TRACE;NET40;NETDESKTOP
+
+
+
+ TRACE;NETSTANDARD1_3;
+
+
+
full
false
bin\Debug\
DEBUG;TRACE
- prompt
- 4
bin\Debug\GitVersionCore.xml
- 1591
-
+
+
pdbonly
true
bin\Release\
TRACE
- prompt
- 4
bin\Release\GitVersionCore.xml
- 1591
-
-
-
- ..\packages\GitTools.Core.1.2.1-beta0001\lib\net4\GitTools.Core.dll
- True
-
-
- ..\packages\LibGit2Sharp.0.23.0-pre20160922233542\lib\net40\LibGit2Sharp.dll
- True
-
+
+
+
+
+
+
+
+
+
@@ -54,183 +67,43 @@
-
- ..\packages\YamlDotNet.3.8.0\lib\net35\YamlDotNet.dll
- True
-
+
+
+
+ All
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
-
- Designer
-
Designer
-
-
-
-
- This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
\ No newline at end of file
diff --git a/src/GitVersionCore/GitVersionFinder.cs b/src/GitVersionCore/GitVersionFinder.cs
index 77addc07c1..4cf9d37170 100644
--- a/src/GitVersionCore/GitVersionFinder.cs
+++ b/src/GitVersionCore/GitVersionFinder.cs
@@ -1,8 +1,8 @@
namespace GitVersion
{
- using System.ComponentModel;
using System.IO;
using GitVersion.VersionCalculation;
+ using GitTools;
public class GitVersionFinder
{
@@ -21,8 +21,8 @@ public SemanticVersion FindVersion(GitVersionContext context)
var filePath = Path.Combine(context.Repository.GetRepositoryDirectory(), "NextVersion.txt");
if (File.Exists(filePath))
- {
- throw new WarningException("NextVersion.txt has been deprecated. See http://gitversion.readthedocs.org/en/latest/configuration/ for replacement");
+ {
+ throw new GitTools.WarningException("NextVersion.txt has been deprecated. See http://gitversion.readthedocs.org/en/latest/configuration/ for replacement");
}
return new NextVersionCalculator().FindVersion(context);
diff --git a/src/GitVersionCore/Helpers/EncodingHelper.cs b/src/GitVersionCore/Helpers/EncodingHelper.cs
index 392f86e2ac..8337246f67 100644
--- a/src/GitVersionCore/Helpers/EncodingHelper.cs
+++ b/src/GitVersionCore/Helpers/EncodingHelper.cs
@@ -73,13 +73,30 @@ public static Encoding DetectEncoding(IList bytes)
/// An ordered list of encodings and corresponding preambles.
private static void ScanEncodings()
{
- EncodingsWithPreambles = (from info in Encoding.GetEncodings()
- let encoding = info.GetEncoding()
- let preamble = encoding.GetPreamble()
- where preamble.Length > 0
- orderby preamble.Length descending
- select encoding).ToList();
-
+ // Might be out of luck finding a replacement for GetEncodings for netcore 1: https://stackoverflow.com/questions/44351507/what-is-net-core-equivalent-of-encoding-getencodings
+#if NETDESKTOP
+ var encodings = (Encoding.GetEncodings());
+ EncodingsWithPreambles = (from info in encodings
+ let encoding = info.GetEncoding()
+ let preamble = encoding.GetPreamble()
+ where preamble.Length > 0
+ orderby preamble.Length descending
+ select encoding).ToList();
+
+#else
+ // GetEncodings not available on netstandard, so just manually adding some common ones.
+ var encodings = new List() { Encoding.ASCII, Encoding.Unicode, Encoding.UTF32, Encoding.UTF7, Encoding.UTF8 };
+ EncodingsWithPreambles = (from info in encodings
+ let preamble = info.GetPreamble()
+ where preamble.Length > 0
+ orderby preamble.Length descending
+ select info).ToList();
+#endif
+
+
+
+
+
var encodingWithLongestPreamble = EncodingsWithPreambles.FirstOrDefault();
MaxPreambleLength = encodingWithLongestPreamble == null ? 0 : encodingWithLongestPreamble.GetPreamble().Length;
}
diff --git a/src/GitVersionCore/Helpers/EnvironmentHelper.cs b/src/GitVersionCore/Helpers/EnvironmentHelper.cs
index 84d35afe0d..9c955dae23 100644
--- a/src/GitVersionCore/Helpers/EnvironmentHelper.cs
+++ b/src/GitVersionCore/Helpers/EnvironmentHelper.cs
@@ -6,7 +6,11 @@ public class EnvironmentHelper
{
public static string GetEnvironmentVariableForProcess(string envVar)
{
+#if NETDESKTOP
return Environment.GetEnvironmentVariable(envVar, EnvironmentVariableTarget.Process);
+#else
+ return Environment.GetEnvironmentVariable(envVar);
+#endif
}
}
}
diff --git a/src/GitVersionCore/Helpers/FileSystem.cs b/src/GitVersionCore/Helpers/FileSystem.cs
index f3022e816c..551ba0c0f8 100644
--- a/src/GitVersionCore/Helpers/FileSystem.cs
+++ b/src/GitVersionCore/Helpers/FileSystem.cs
@@ -86,8 +86,8 @@ public long GetLastDirectoryWrite(string path)
public bool PathsEqual(string path, string otherPath)
{
var comparison = runningOnMono
- ? StringComparison.InvariantCulture
- : StringComparison.InvariantCultureIgnoreCase;
+ ? StringComparerUtils.CaseSensitiveComparison
+ : StringComparerUtils.IngoreCaseComparison;
return string.Equals(
Path.GetFullPath(path).TrimEnd('\\').TrimEnd('/'),
diff --git a/src/GitVersionCore/Helpers/IThreadSleep.cs b/src/GitVersionCore/Helpers/IThreadSleep.cs
index 86484d3580..ca6f90f302 100644
--- a/src/GitVersionCore/Helpers/IThreadSleep.cs
+++ b/src/GitVersionCore/Helpers/IThreadSleep.cs
@@ -1,7 +1,9 @@
-namespace GitVersion.Helpers
+using System.Threading.Tasks;
+
+namespace GitVersion.Helpers
{
public interface IThreadSleep
{
- void Sleep(int milliseconds);
+ Task SleepAsync(int milliseconds);
}
}
diff --git a/src/GitVersionCore/Helpers/OperationWithExponentialBackoff.cs b/src/GitVersionCore/Helpers/OperationWithExponentialBackoff.cs
index 61e6e6fd73..56e48cc5a3 100644
--- a/src/GitVersionCore/Helpers/OperationWithExponentialBackoff.cs
+++ b/src/GitVersionCore/Helpers/OperationWithExponentialBackoff.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.Threading.Tasks;
namespace GitVersion.Helpers
{
@@ -21,7 +22,7 @@ public OperationWithExponentialBackoff(IThreadSleep threadSleep, Action operatio
this.MaxRetries = maxRetries;
}
- public void Execute()
+ public async Task ExecuteAsync()
{
var exceptions = new List();
@@ -47,7 +48,8 @@ public void Execute()
}
Logger.WriteInfo(string.Format("Operation failed, retrying in {0} milliseconds.", sleepMSec));
- ThreadSleep.Sleep(sleepMSec);
+ await ThreadSleep.SleepAsync(sleepMSec);
+
sleepMSec *= 2;
}
}
diff --git a/src/GitVersionCore/Helpers/ThreadSleep.cs b/src/GitVersionCore/Helpers/ThreadSleep.cs
index b20989814e..f293358199 100644
--- a/src/GitVersionCore/Helpers/ThreadSleep.cs
+++ b/src/GitVersionCore/Helpers/ThreadSleep.cs
@@ -1,12 +1,12 @@
namespace GitVersion.Helpers
{
- using System.Threading;
+ using System.Threading.Tasks;
internal class ThreadSleep : IThreadSleep
{
- public void Sleep(int milliseconds)
+ public async Task SleepAsync(int milliseconds)
{
- Thread.Sleep(milliseconds);
+ await TaskHelper.Delay(milliseconds);
}
}
}
diff --git a/src/GitVersionCore/OutputVariables/VariableProvider.cs b/src/GitVersionCore/OutputVariables/VariableProvider.cs
index 5781041b9e..007bfc670c 100644
--- a/src/GitVersionCore/OutputVariables/VariableProvider.cs
+++ b/src/GitVersionCore/OutputVariables/VariableProvider.cs
@@ -1,9 +1,9 @@
namespace GitVersion
{
using System;
- using System.ComponentModel;
using System.Text.RegularExpressions;
using GitVersion.VersionCalculation;
+ using WarningException = GitTools.WarningException;
public static class VariableProvider
{
diff --git a/src/GitVersionCore/OutputVariables/VersionVariables.cs b/src/GitVersionCore/OutputVariables/VersionVariables.cs
index 430736187a..d5c4ec0d2e 100644
--- a/src/GitVersionCore/OutputVariables/VersionVariables.cs
+++ b/src/GitVersionCore/OutputVariables/VersionVariables.cs
@@ -6,6 +6,8 @@
using System.IO;
using System.Linq;
using GitVersion.Helpers;
+ using System.Reflection;
+
using YamlDotNet.Serialization;
@@ -116,7 +118,20 @@ public static IEnumerable AvailableVariables
[ReflectionIgnore]
public string this[string variable]
{
- get { return (string)typeof(VersionVariables).GetProperty(variable).GetValue(this, null); }
+
+
+ get
+ {
+#if NETDESKTOP
+ return typeof(VersionVariables).GetProperty(variable).GetValue(this, null) as string;
+#else
+ throw new NotImplementedException();
+ // return typeof(VersionVariables).GetTypeInfo().GetProperty(variable).GetValue(this, null) as string;
+#endif
+
+
+
+ }
}
public IEnumerator> GetEnumerator()
@@ -137,7 +152,9 @@ IEnumerator IEnumerable.GetEnumerator()
public static VersionVariables FromDictionary(IEnumerable> properties)
{
var type = typeof(VersionVariables);
- var ctor = type.GetConstructors().Single();
+ var constructors = type.GetConstructors();
+
+ var ctor = constructors.Single();
var ctorArgs = ctor.GetParameters()
.Select(p => properties.Single(v => string.Equals(v.Key, p.Name, StringComparison.CurrentCultureIgnoreCase)).Value)
.Cast