From 5866b66c82526f240510611f8e1555cbbe08f854 Mon Sep 17 00:00:00 2001 From: David Nelson Date: Sun, 15 May 2016 00:07:09 -0500 Subject: [PATCH 1/7] Exclude LibGit2Sharp from ILRepack to allow for the use of LibGit2Sharp.dll.config in NuGet.CommandLine --- src/GitVersionExe/GitVersionExe.csproj | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/GitVersionExe/GitVersionExe.csproj b/src/GitVersionExe/GitVersionExe.csproj index f80047facd..f2c2c1ad33 100644 --- a/src/GitVersionExe/GitVersionExe.csproj +++ b/src/GitVersionExe/GitVersionExe.csproj @@ -142,12 +142,23 @@ - + + + + + + + + + + + + @@ -158,14 +169,6 @@ - - - - - - - - From 5f000bb223e29b055f8277eae8203f109b098532 Mon Sep 17 00:00:00 2001 From: David Nelson Date: Thu, 9 Jun 2016 01:52:48 -0500 Subject: [PATCH 2/7] Build packages and get version numbers via dogfooding on Travis build --- .travis.yml | 2 ++ src/GitVersionCore/packages.config | 2 +- src/GitVersionExe/GitVersionExe.csproj | 4 ++-- src/GitVersionExe/packages.config | 2 +- src/GitVersionTask/packages.config | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index d161a6ab8f..259176f37d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,6 +14,8 @@ install: - mono .nuget/nuget.exe restore src/GitVersion.sln -Verbosity detailed - mono .nuget/nuget.exe install NUnit.Runners -Version 3.2.1 -OutputDirectory ./src/packages script: + - xbuild ./src/GitVersion.sln /property:Configuration="Debug" /verbosity:detailed + - mono ./build/NuGetCommandLineBuild/tools/GitVersion.exe -l -console -output buildserver -updateAssemblyInfo - xbuild ./src/GitVersion.sln /property:Configuration="Debug" /verbosity:detailed - mono ./src/packages/NUnit.ConsoleRunner.3.2.1/tools/nunit3-console.exe ./src/GitVersionTask.Tests/bin/Debug/GitVersionTask.Tests.dll ./src/GitVersionCore.Tests/bin/Debug/GitVersionCore.Tests.dll ./src/GitVersionTask.Tests/bin/Debug/GitVersionTask.Tests.dll ./src/GitVersionExe.Tests/bin/Debug/GitVersionExe.Tests.dll --where "cat != NoMono" --noresult diff --git a/src/GitVersionCore/packages.config b/src/GitVersionCore/packages.config index 8fcd455f6b..ce519f7f9c 100644 --- a/src/GitVersionCore/packages.config +++ b/src/GitVersionCore/packages.config @@ -1,6 +1,6 @@  - + diff --git a/src/GitVersionExe/GitVersionExe.csproj b/src/GitVersionExe/GitVersionExe.csproj index f2c2c1ad33..01f89f3813 100644 --- a/src/GitVersionExe/GitVersionExe.csproj +++ b/src/GitVersionExe/GitVersionExe.csproj @@ -135,7 +135,7 @@ ]]> - + mono @@ -178,7 +178,7 @@ - + diff --git a/src/GitVersionExe/packages.config b/src/GitVersionExe/packages.config index bbe3470e94..3574c719e9 100644 --- a/src/GitVersionExe/packages.config +++ b/src/GitVersionExe/packages.config @@ -1,6 +1,6 @@  - + diff --git a/src/GitVersionTask/packages.config b/src/GitVersionTask/packages.config index 5251d970be..93b6121f7c 100644 --- a/src/GitVersionTask/packages.config +++ b/src/GitVersionTask/packages.config @@ -1,6 +1,6 @@  - + From 31ec96fcc6d0b6805e7f826065b86308e6b0862a Mon Sep 17 00:00:00 2001 From: David Nelson Date: Sun, 19 Jun 2016 22:54:07 -0500 Subject: [PATCH 3/7] Unshallow repo before building on travis --- .travis.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 259176f37d..e196907638 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,7 @@ os: - linux - osx before_install: # We need to download nuget.exe due to: https://github.com/travis-ci/travis-ci/issues/5932 + - git fetch --unshallow - mkdir -p .nuget - wget -O .nuget/nuget.exe https://dist.nuget.org/win-x86-commandline/latest/nuget.exe - mono .nuget/nuget.exe @@ -15,7 +16,7 @@ install: - mono .nuget/nuget.exe install NUnit.Runners -Version 3.2.1 -OutputDirectory ./src/packages script: - xbuild ./src/GitVersion.sln /property:Configuration="Debug" /verbosity:detailed - - mono ./build/NuGetCommandLineBuild/tools/GitVersion.exe -l -console -output buildserver -updateAssemblyInfo + - mono ./build/NuGetCommandLineBuild/tools/GitVersion.exe -l console -output buildserver -updateAssemblyInfo - xbuild ./src/GitVersion.sln /property:Configuration="Debug" /verbosity:detailed - mono ./src/packages/NUnit.ConsoleRunner.3.2.1/tools/nunit3-console.exe ./src/GitVersionTask.Tests/bin/Debug/GitVersionTask.Tests.dll ./src/GitVersionCore.Tests/bin/Debug/GitVersionCore.Tests.dll ./src/GitVersionTask.Tests/bin/Debug/GitVersionTask.Tests.dll ./src/GitVersionExe.Tests/bin/Debug/GitVersionExe.Tests.dll --where "cat != NoMono" --noresult @@ -25,4 +26,4 @@ script: # # To run a clean build with Mono, executing all tests, do: # xbuild ./src/GitVersion.sln /t:Clean /verbosity:quiet && xbuild ./src/GitVersion.sln /property:Configuration="Debug" /verbosity:quiet && mono ./src/packages/NUnit.ConsoleRunner.3.2.1/tools/nunit3-console.exe ./src/GitVersionTask.Tests/bin/Debug/GitVersionTask.Tests.dll ./src/GitVersionCore.Tests/bin/Debug/GitVersionCore.Tests.dll ./src/GitVersionTask.Tests/bin/Debug/GitVersionTask.Tests.dll ./src/GitVersionExe.Tests/bin/Debug/GitVersionExe.Tests.dll --noresult --where "cat != NoMono" --noresult -# \ No newline at end of file +# From e81c4ec3aa700dccf977ecb9ee137be21cc8e9b6 Mon Sep 17 00:00:00 2001 From: David Nelson Date: Wed, 6 Jul 2016 06:28:46 -0500 Subject: [PATCH 4/7] TravisCI build server integration --- .../BuildServers/BuildServerList.cs | 3 +- src/GitVersionCore/BuildServers/TravisCI.cs | 30 +++++++++++++++++++ src/GitVersionCore/GitVersionCore.csproj | 1 + 3 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 src/GitVersionCore/BuildServers/TravisCI.cs diff --git a/src/GitVersionCore/BuildServers/BuildServerList.cs b/src/GitVersionCore/BuildServers/BuildServerList.cs index 45181830e5..5877c3be1a 100644 --- a/src/GitVersionCore/BuildServers/BuildServerList.cs +++ b/src/GitVersionCore/BuildServers/BuildServerList.cs @@ -13,7 +13,8 @@ public static class BuildServerList new MyGet(), new Jenkins(), new GitLabCi(), - new VsoAgent() + new VsoAgent(), + new TravisCI(), }; public static IEnumerable GetApplicableBuildServers() diff --git a/src/GitVersionCore/BuildServers/TravisCI.cs b/src/GitVersionCore/BuildServers/TravisCI.cs new file mode 100644 index 0000000000..1aa3e83332 --- /dev/null +++ b/src/GitVersionCore/BuildServers/TravisCI.cs @@ -0,0 +1,30 @@ +using System; +namespace GitVersion +{ + public class TravisCI : BuildServerBase + { + public override bool CanApplyToCurrentContext () + { + return "true".Equals(Environment.GetEnvironmentVariable ("TRAVIS")) && "true".Equals(Environment.GetEnvironmentVariable("CI")); + } + + public override string GenerateSetVersionMessage(VersionVariables variables) + { + return variables.FullSemVer; + } + + public override string[] GenerateSetParameterMessage(string name, string value) + { + return new[] + { + string.Format("GitVersion_{0}={1}", name, value) + }; + } + + public override bool PreventFetch () + { + return true; + } + } +} + diff --git a/src/GitVersionCore/GitVersionCore.csproj b/src/GitVersionCore/GitVersionCore.csproj index 8cec6326d9..6f77c7fa3b 100644 --- a/src/GitVersionCore/GitVersionCore.csproj +++ b/src/GitVersionCore/GitVersionCore.csproj @@ -165,6 +165,7 @@ + From 289c543521e767d93cdbb2fd509610531e8624d2 Mon Sep 17 00:00:00 2001 From: David Nelson Date: Wed, 6 Jul 2016 13:15:54 -0500 Subject: [PATCH 5/7] Remove TRAVIS environment variable while testing --- src/GitVersionCore.Tests/ExecuteCoreTests.cs | 1 + src/GitVersionExe.Tests/GitVersionHelper.cs | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/GitVersionCore.Tests/ExecuteCoreTests.cs b/src/GitVersionCore.Tests/ExecuteCoreTests.cs index ab4b43d98f..e01e011ed7 100644 --- a/src/GitVersionCore.Tests/ExecuteCoreTests.cs +++ b/src/GitVersionCore.Tests/ExecuteCoreTests.cs @@ -142,6 +142,7 @@ string RepositoryScope(ExecuteCore executeCore = null, Action infoLogger = s => { diff --git a/src/GitVersionExe.Tests/GitVersionHelper.cs b/src/GitVersionExe.Tests/GitVersionHelper.cs index 0230813db5..1a7590a274 100644 --- a/src/GitVersionExe.Tests/GitVersionHelper.cs +++ b/src/GitVersionExe.Tests/GitVersionHelper.cs @@ -37,8 +37,9 @@ static ExecutionResults ExecuteIn(ArgumentBuilder arguments) new[] { new KeyValuePair("TEAMCITY_VERSION", arguments.IsTeamCity ? "8.0.0" : null), - new KeyValuePair("APPVEYOR", null) - }; + new KeyValuePair("APPVEYOR", null), + new KeyValuePair("TRAVIS", null), + }; var exitCode = -1; From b3a8eab90e59780f1ccb1d1e4baaaa9b4bba1ec4 Mon Sep 17 00:00:00 2001 From: David Nelson Date: Thu, 7 Jul 2016 13:38:48 -0500 Subject: [PATCH 6/7] Extract build server environment variable names to constants --- src/GitVersionCore.Tests/ExecuteCoreTests.cs | 4 ++-- src/GitVersionCore/BuildServers/AppVeyor.cs | 6 ++++-- src/GitVersionCore/BuildServers/TeamCity.cs | 6 ++++-- src/GitVersionCore/BuildServers/TravisCI.cs | 4 +++- src/GitVersionExe.Tests/GitVersionHelper.cs | 9 +++++---- 5 files changed, 18 insertions(+), 11 deletions(-) diff --git a/src/GitVersionCore.Tests/ExecuteCoreTests.cs b/src/GitVersionCore.Tests/ExecuteCoreTests.cs index e01e011ed7..85852b6a3c 100644 --- a/src/GitVersionCore.Tests/ExecuteCoreTests.cs +++ b/src/GitVersionCore.Tests/ExecuteCoreTests.cs @@ -141,8 +141,8 @@ public void DynamicRepositoriesShouldNotErrorWithFailedToFindGitDirectory() string RepositoryScope(ExecuteCore executeCore = null, Action fixtureAction = null) { // Make sure GitVersion doesn't trigger build server mode when we are running the tests - Environment.SetEnvironmentVariable("APPVEYOR", null); - Environment.SetEnvironmentVariable("TRAVIS", null); + Environment.SetEnvironmentVariable(AppVeyor.EnvironmentVariableName, null); + Environment.SetEnvironmentVariable(TravisCI.EnvironmentVariableName, null); var infoBuilder = new StringBuilder(); Action infoLogger = s => { diff --git a/src/GitVersionCore/BuildServers/AppVeyor.cs b/src/GitVersionCore/BuildServers/AppVeyor.cs index fb656a909e..63d2a8d456 100644 --- a/src/GitVersionCore/BuildServers/AppVeyor.cs +++ b/src/GitVersionCore/BuildServers/AppVeyor.cs @@ -6,9 +6,11 @@ public class AppVeyor : BuildServerBase { - public override bool CanApplyToCurrentContext() + public const string EnvironmentVariableName = "APPVEYOR"; + + public override bool CanApplyToCurrentContext() { - return !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("APPVEYOR")); + return !string.IsNullOrEmpty(Environment.GetEnvironmentVariable(EnvironmentVariableName)); } public override string GenerateSetVersionMessage(VersionVariables variables) diff --git a/src/GitVersionCore/BuildServers/TeamCity.cs b/src/GitVersionCore/BuildServers/TeamCity.cs index a0515e56f1..3dfd13a1ba 100644 --- a/src/GitVersionCore/BuildServers/TeamCity.cs +++ b/src/GitVersionCore/BuildServers/TeamCity.cs @@ -4,9 +4,11 @@ public class TeamCity : BuildServerBase { - public override bool CanApplyToCurrentContext() + public const string EnvironmentVariableName = "TEAMCITY_VERSION"; + + public override bool CanApplyToCurrentContext() { - return !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("TEAMCITY_VERSION")); + return !string.IsNullOrEmpty(Environment.GetEnvironmentVariable(EnvironmentVariableName)); } public override string GetCurrentBranch(bool usingDynamicRepos) diff --git a/src/GitVersionCore/BuildServers/TravisCI.cs b/src/GitVersionCore/BuildServers/TravisCI.cs index 1aa3e83332..5deed8c6d6 100644 --- a/src/GitVersionCore/BuildServers/TravisCI.cs +++ b/src/GitVersionCore/BuildServers/TravisCI.cs @@ -3,9 +3,11 @@ namespace GitVersion { public class TravisCI : BuildServerBase { + public const string EnvironmentVariableName = "TRAVIS"; + public override bool CanApplyToCurrentContext () { - return "true".Equals(Environment.GetEnvironmentVariable ("TRAVIS")) && "true".Equals(Environment.GetEnvironmentVariable("CI")); + return "true".Equals(Environment.GetEnvironmentVariable(EnvironmentVariableName)) && "true".Equals(Environment.GetEnvironmentVariable("CI")); } public override string GenerateSetVersionMessage(VersionVariables variables) diff --git a/src/GitVersionExe.Tests/GitVersionHelper.cs b/src/GitVersionExe.Tests/GitVersionHelper.cs index 1a7590a274..2ab6652d13 100644 --- a/src/GitVersionExe.Tests/GitVersionHelper.cs +++ b/src/GitVersionExe.Tests/GitVersionHelper.cs @@ -3,6 +3,7 @@ using System.IO; using System.Text; using GitTools; +using GitVersion; public static class GitVersionHelper { @@ -36,10 +37,10 @@ static ExecutionResults ExecuteIn(ArgumentBuilder arguments) var environmentalVariables = new[] { - new KeyValuePair("TEAMCITY_VERSION", arguments.IsTeamCity ? "8.0.0" : null), - new KeyValuePair("APPVEYOR", null), - new KeyValuePair("TRAVIS", null), - }; + new KeyValuePair(TeamCity.EnvironmentVariableName, arguments.IsTeamCity ? "8.0.0" : null), + new KeyValuePair(AppVeyor.EnvironmentVariableName, null), + new KeyValuePair(TravisCI.EnvironmentVariableName, null), + }; var exitCode = -1; From b57b9c76c925598f9d044e6b342a8a98db2f3311 Mon Sep 17 00:00:00 2001 From: David Nelson Date: Fri, 8 Jul 2016 00:25:13 -0500 Subject: [PATCH 7/7] Comments and formatting --- .travis.yml | 2 +- src/GitVersionExe/GitVersionExe.csproj | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index e196907638..7601be96ac 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,7 @@ os: - linux - osx before_install: # We need to download nuget.exe due to: https://github.com/travis-ci/travis-ci/issues/5932 - - git fetch --unshallow + - git fetch --unshallow # Travis always does a shallow clone, but GitVersion needs the full history including branches and tags - mkdir -p .nuget - wget -O .nuget/nuget.exe https://dist.nuget.org/win-x86-commandline/latest/nuget.exe - mono .nuget/nuget.exe diff --git a/src/GitVersionExe/GitVersionExe.csproj b/src/GitVersionExe/GitVersionExe.csproj index 01f89f3813..d013548403 100644 --- a/src/GitVersionExe/GitVersionExe.csproj +++ b/src/GitVersionExe/GitVersionExe.csproj @@ -142,13 +142,15 @@ - + + + @@ -158,6 +160,8 @@ + + @@ -169,6 +173,7 @@ + @@ -185,6 +190,7 @@ + @@ -208,6 +214,7 @@ +