diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 410b3d69aa..0000000000 --- a/.editorconfig +++ /dev/null @@ -1,18 +0,0 @@ -# http://editorconfig.org -root = true - -[*] -indent_style = space -indent_size = 4 -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -[.yml] -indent_style = space -indent_size = 2 -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true diff --git a/.gitignore b/.gitignore index 215d633d53..3b869cb610 100644 --- a/.gitignore +++ b/.gitignore @@ -110,23 +110,8 @@ src/GitVersionTfsTask/*.js #################### # Cake #################### -tools/* -!tools/packages.config +/tools /*.zip GitVersion.CommandLine/*/ -releaseArtifacts -/ILMergeTemp -.dotnet -.cake -artifacts -/src/Docker/**/content -/src/GitVersionTfsTask/GitVersionTask -!src/GitVersionTfsTask/GitVersionTask/task.json -/src/GitVersionTfsTask/GitVersionNetCoreTask -!src/GitVersionTfsTask/GitVersionNetCoreTask/task.json -/src/GitVersionTfsTask/*.vsix -/src/GitVersionRubyGem/*.gem -/src/GitVersionRubyGem/bin/lib -/src/GitVersionRubyGem/bin/GitVersion.exe -/src/GitVersionRubyGem/bin/LibGit2Sharp.dll.config +releaseArtifacts \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 452e1c10c2..2f95b12cf3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,5 @@ language: csharp -sudo: required -dist: trusty -dotnet: 2.1.503 +sudo: false mono: - latest os: @@ -9,12 +7,9 @@ os: - osx before_install: - git fetch --unshallow # Travis always does a shallow clone, but GitVersion needs the full history including branches and tags - - git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" - - git fetch origin - - bash <(wget -O - https://raw.githubusercontent.com/PowerShell/PowerShell/master/tools/install-powershell.sh) script: - - pwsh ./build.ps1 -script build.cake -target Default -env: - global: - - DOTNET_CLI_TELEMETRY_OPTOUT: 1 - - DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true + - ./build.sh +cache: + directories: + - src/packages + - tools diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a3da50d050..c7a9e099c2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -68,29 +68,3 @@ The last line is the most important. `AssertFullSemver` will run GitVersion and ## 6. Submit a pull request with the failing test Even better include the fix, but a failing test is a great start - - -# Build / Release Process -We use Cake for our build and deployment process. The way the build / release process is setup is: - -1) We build releasable artifacts on AppVeyor -1) Login to AppVeyor -1) Deploy the latest master build -![docs/img/release-1-deploy.png](docs/img/release-1-deploy.png) -1) Choose GitVersion release, when you press deploy it will create a *non-released* GitHub release, this *will not* create a Git tag. This step is so we can validate the release and release notes before pushing the button. -![docs/img/release-2-deploy.png](docs/img/release-2-deploy.png) -1) All the artifacts should upload nicely -![docs/img/release-3-deploy.png](docs/img/release-3-deploy.png) -1) Head over to GitHub releases, you should have a draft release, download a copy of the release notes -![docs/img/release-4-deploy.png](docs/img/release-4-deploy.png) -1) Edit the release and do the following: - 1. Remove the build metadata from the tag and title (the + and everything after it) - 2. Paste the downloaded release notes in, you can clean them up if you want otherwise there may be closed issues which were questions etc. - 3. Tick the pre-release box if it's pre-release - 4. Press Publish -1) Publishing tags (a git tag) the release commit, this will trigger another appveyor build which only builds tags, this build uses deploy.cake. It downloads the artifacts from that GitHub release, then performs the release - -## Docker -It is a manual release step after the release now, first download the appropriate ZIP and put into a `releaseArtifacts` folder in the GitVersion repository, then run: - -`docker build . --build-arg GitVersionZip=GitVersion_.zip --tag gittools/gitversion` \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000..35fa9a1b39 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,18 @@ +FROM gittools/libgit2sharp-mono + +MAINTAINER GitTools Maintainers +ARG GitVersionZip + +# Add GitVersion + +ADD ./releaseArtifacts/$GitVersionZip . +RUN unzip -d /usr/lib/GitVersion/ $GitVersionZip && rm $GitVersionZip +WORKDIR /usr/lib/GitVersion/ + +# Libgit2 can't resolve relative paths, patch to absolute path +RUN sed -i 's|lib/linux/x86_64|/usr/lib/GitVersion/lib/linux/x86_64|g' /usr/lib/GitVersion/LibGit2Sharp.dll.config + +RUN mkdir /repo +VOLUME /repo + +ENTRYPOINT ["mono", "./GitVersion.exe", "/repo"] diff --git a/GitVersion.yml b/GitVersion.yml index 430e94ec27..11ca8fe20d 100644 --- a/GitVersion.yml +++ b/GitVersion.yml @@ -3,6 +3,4 @@ branches: master: tag: beta ignore: - sha: - - 0e77e2e16a136a1cd0f0474fe5710f617d508d81 - - af73f6a349456f146a8d0a413de1331eddf61bc2 + sha: [] diff --git a/README.md b/README.md index e4e190f79b..930de3dbe2 100644 --- a/README.md +++ b/README.md @@ -1,33 +1,26 @@ ![Icon][icon] # GitVersion - Versioning when using git, solved. GitVersion looks at your git history and works out the [semantic version][semver] of the commit being built. [![Gitter][gitter-badge]][gitter] [![Build status][appveyor-badge]][appveyor] [![Build Status][travis-badge]][travis] -[![Build Status][azure-pipeline-badge]][azure-pipeline] -[![codecov][codecov-badge]][codecov] -| | Stable | Pre-release | -| ------------------------------------: | :---------------------------------------: | :---------------------------------------: | -| **Docs** | [![Docs][docs-badge]][docs] | [![Docs][docs-pre-badge]][docs-pre] | -| **GitHub Release** | [![GitHub release][gh-rel-badge]][gh-rel] | - | -| **GitVersion.Portable** | [![Chocolatey][choco-badge]][choco] | [![Chocolatey][choco-pre-badge]][choco] | -| **GitVersionCore** | [![NuGet][gvc-badge]][gvc] | [![NuGet][gvc-pre-badge]][gvc] | -| **GitVersionTask** | [![NuGet][gvt-badge]][gvt] | [![NuGet][gvt-pre-badge]][gvt] | -| **GitVersion.CommandLine** | [![NuGet][gvcl-badge]][gvcl] | [![NuGet][gvcl-pre-badge]][gvcl] | -| **GitVersion.CommandLine.DotNetCore** | [![NuGet][gvcd-badge]][gvcd] | [![NuGet][gvcd-pre-badge]][gvcd] | -| **GitVersion.Tool** | [![NuGet][gvgt-badge]][gvgt] | [![NuGet][gvgt-pre-badge]][gvgt] | -| **Gem** | [![Gem][gem-badge]][gem] | - | -| **Homebrew** | [![homebrew][brew-badge]][brew] | - | -| **Docker DotnetCore** | [Dotnetcore][dockerhub-dotnetcore] | - | -| **Docker FullFX** | [FullFX][dockerhub-fullfx] | - | +| | Stable | Pre-release | +| -------------------------: | :---------------------------------------: | :---------------------------------------: | +| **Docs** | [![Docs][docs-badge]][docs] | [![Docs][docs-pre-badge]][docs-pre] | +| **GitHub Release** | [![GitHub release][gh-rel-badge]][gh-rel] | - | +| **GitVersion.Portable** | [![Chocolatey][choco-badge]][choco] | [![Chocolatey][choco-pre-badge]][choco] | +| **GitVersionTask** | [![NuGet][gvt-badge]][gvt] | [![NuGet][gvt-pre-badge]][gvt] | +| **GitVersion.CommandLine** | [![NuGet][gvc-badge]][gvc] | [![NuGet][gvc-pre-badge]][gvc] | +| **Gem** | [![Gem][gem-badge]][gem] | - | +| **Homebrew** | [![homebrew][brew-badge]][brew] | - | +| **Docker** | [gittools/gitversion][dockerhub] | - | ## Compatibility -GitVersion works Windows, Linux, and Mac. +GitVersion works on Mac, Linux with Mono and Windows. Tip: If you get `System.TypeInitializationException: The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception. ---> @@ -36,77 +29,60 @@ System.DllNotFoundException: lib/linux/x86_64/libgit2-baa87df.so` You likely need to install `libcurl3`. Run `sudo apt-get install libcurl3` ## Quick Links - -- [Documentation][docs] -- [Contributing][contribute] -- [Why GitVersion][why] -- [Usage][usage] -- [How it works][how] -- [FAQ][faq] -- [Who is using GitVersion][who] + - [Documentation][docs] + - [Contributing][contribute] + - [Why GitVersion][why] + - [Usage][usage] + - [How it works][how] + - [FAQ][faq] + - [Who is using GitVersion][who] ## GitVersion in action! - ![README][gv-in-action] You are seeing: -- Pull requests being built as pre-release builds -- A branch called `release-1.0.0` producing beta v1 packages + - Pull requests being built as pre-release builds + - A branch called `release-1.0.0` producing beta v1 packages ## Icon - Tree designed by David Chapman from The Noun Project -[icon]: https://raw.github.com/GitTools/GitVersion/master/docs/img/package_icon.png -[semver]: http://semver.org -[gitter]: https://gitter.im/GitTools/GitVersion?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge -[gitter-badge]: https://badges.gitter.im/Join+Chat.svg -[appveyor]: https://ci.appveyor.com/project/GitTools/gitversion/branch/master -[appveyor-badge]: https://ci.appveyor.com/api/projects/status/sxje0wht0cscmn7w/branch/master?svg=true -[azure-pipeline]: https://dev.azure.com/GitTools/GitVersion/_build/latest?definitionId=1 -[azure-pipeline-badge]: https://dev.azure.com/GitTools/GitVersion/_apis/build/status/GitTools.GitVersion -[travis]: https://travis-ci.org/GitTools/GitVersion -[travis-badge]: https://travis-ci.org/GitTools/GitVersion.svg?branch=master -[codecov]: https://codecov.io/gh/GitTools/GitVersion -[codecov-badge]: https://codecov.io/gh/GitTools/GitVersion/branch/master/graph/badge.svg -[docs]: http://gitversion.readthedocs.org/en/stable/ -[docs-badge]: https://readthedocs.org/projects/gitversion/badge/?version=stable -[docs-pre]: http://gitversion.readthedocs.org/en/latest/ -[docs-pre-badge]: https://readthedocs.org/projects/gitversion/badge/?version=latest -[gh-rel]: https://github.com/GitTools/GitVersion/releases/latest -[gh-rel-badge]: https://img.shields.io/github/release/gittools/gitversion.svg -[choco]: https://chocolatey.org/packages/GitVersion.Portable -[choco-badge]: https://img.shields.io/chocolatey/v/gitversion.portable.svg -[choco-pre-badge]: https://img.shields.io/chocolatey/vpre/gitversion.portable.svg -[gvc]: https://www.nuget.org/packages/GitVersionCore -[gvc-badge]: https://img.shields.io/nuget/v/GitVersionCore.svg -[gvc-pre-badge]: https://img.shields.io/nuget/vpre/GitVersionCore.svg -[gvt]: https://www.nuget.org/packages/GitVersionTask -[gvt-badge]: https://img.shields.io/nuget/v/GitVersionTask.svg -[gvt-pre-badge]: https://img.shields.io/nuget/vpre/GitVersionTask.svg -[gvcl]: https://www.nuget.org/packages/GitVersion.CommandLine -[gvcl-badge]: https://img.shields.io/nuget/v/GitVersion.CommandLine.svg -[gvcl-pre-badge]: https://img.shields.io/nuget/vpre/GitVersion.CommandLine.svg -[gvcd]: https://www.nuget.org/packages/GitVersion.CommandLine.DotNetCore -[gvcd-badge]: https://img.shields.io/nuget/v/GitVersion.CommandLine.DotNetCore.svg -[gvcd-pre-badge]: https://img.shields.io/nuget/vpre/GitVersion.CommandLine.DotNetCore.svg -[gvgt]: https://www.nuget.org/packages/GitVersion.Tool -[gvgt-badge]: https://img.shields.io/nuget/v/GitVersion.Tool.svg -[gvgt-pre-badge]: https://img.shields.io/nuget/vpre/GitVersion.Tool.svg -[gem-badge]: https://img.shields.io/gem/v/gitversion.svg -[gem]: https://rubygems.org/gems/gitversion -[brew]: http://brew.sh/ -[brew-badge]: https://img.shields.io/homebrew/v/gitversion.svg -[contribute]: https://github.com/GitTools/GitVersion/blob/master/CONTRIBUTING.md -[why]: http://gitversion.readthedocs.org/en/latest/why -[usage]: http://gitversion.readthedocs.org/en/latest/usage/usage/ -[how]: http://gitversion.readthedocs.org/en/latest/more-info/how-it-works/ -[faq]: http://gitversion.readthedocs.org/en/latest/faq/ -[who]: http://gitversion.readthedocs.org/en/latest/who/ -[gv-in-action]: https://raw.github.com/GitTools/GitVersion/master/docs/img/README.png -[dockerhub-fullfx]: https://hub.docker.com/r/gittools/gitversion-fullfx/ -[dockerhub-dotnetcore]: https://hub.docker.com/r/gittools/gitversion-dotnetcore/ +[icon]: https://raw.github.com/GitTools/GitVersion/master/docs/img/package_icon.png +[semver]: http://semver.org +[gitter]: https://gitter.im/GitTools/GitVersion?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge +[gitter-badge]: https://badges.gitter.im/Join+Chat.svg +[appveyor]: https://ci.appveyor.com/project/GitTools/gitversion/branch/master +[appveyor-badge]: https://ci.appveyor.com/api/projects/status/sxje0wht0cscmn7w/branch/master?svg=true +[travis]: https://travis-ci.org/GitTools/GitVersion +[travis-badge]: https://travis-ci.org/GitTools/GitVersion.svg?branch=master +[docs]: http://gitversion.readthedocs.org/en/stable/ +[docs-badge]: https://readthedocs.org/projects/gitversion/badge/?version=stable +[docs-pre]: http://gitversion.readthedocs.org/en/latest/ +[docs-pre-badge]: https://readthedocs.org/projects/gitversion/badge/?version=latest +[gh-rel]: https://github.com/GitTools/GitVersion/releases/latest +[gh-rel-badge]: https://img.shields.io/github/release/gittools/gitversion.svg +[choco]: https://chocolatey.org/packages/GitVersion.Portable +[choco-badge]: https://img.shields.io/chocolatey/v/gitversion.portable.svg +[choco-pre-badge]: https://img.shields.io/chocolatey/vpre/gitversion.portable.svg +[gvt]: https://www.nuget.org/packages/GitVersionTask +[gvt-badge]: https://img.shields.io/nuget/v/GitVersionTask.svg +[gvt-pre-badge]: https://img.shields.io/nuget/vpre/GitVersionTask.svg +[gvc]: https://www.nuget.org/packages/GitVersion.CommandLine +[gvc-badge]: https://img.shields.io/nuget/v/GitVersion.CommandLine.svg +[gvc-pre-badge]: https://img.shields.io/nuget/vpre/GitVersion.CommandLine.svg +[gem-badge]: https://img.shields.io/gem/v/gitversion.svg +[gem]: https://rubygems.org/gems/gitversion +[brew]: http://brew.sh/ +[brew-badge]: https://img.shields.io/homebrew/v/gitversion.svg +[contribute]: https://github.com/GitTools/GitVersion/blob/master/CONTRIBUTING.md +[why]: http://gitversion.readthedocs.org/en/latest/why +[usage]: http://gitversion.readthedocs.org/en/latest/usage/usage/ +[how]: http://gitversion.readthedocs.org/en/latest/more-info/how-it-works/ +[faq]: http://gitversion.readthedocs.org/en/latest/faq/ +[who]: http://gitversion.readthedocs.org/en/latest/who/ +[gv-in-action]: https://raw.github.com/GitTools/GitVersion/master/docs/img/README.png +[dockerhub]: https://hub.docker.com/r/gittools/gitversion/ diff --git a/appveyor.deploy.yml b/appveyor.deploy.yml new file mode 100644 index 0000000000..4363b30bcd --- /dev/null +++ b/appveyor.deploy.yml @@ -0,0 +1,20 @@ +image: Visual Studio 2017 + +environment: + DOCKER_USERNAME: + secure: EbFuNVc5k/p9AiaBmS839D4GqsNaMlJ3djyRR5b2fjM= + DOCKER_PASSWORD: + secure: kweTIFTVyAVyKlvcIvgffpNa6qK8wyWAekVgue8WFqI= + +install: + - npm i -g tfx-cli + - docker version + +assembly_info: + patch: false + +build_script: + - ps: .\deploy.ps1 + +test: off +skip_non_tags: true diff --git a/appveyor.yml b/appveyor.yml index 2572a9aec1..d25bd9bb1f 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,15 +1,17 @@ -image: Visual Studio 2017 +install: + npm i -g tfx-cli assembly_info: patch: false configuration: - Debug -install: - - set PATH=C:\Ruby25-x64\bin;%PATH% build_script: - - pwsh: ./build.ps1 -script build.cake -target Default + - ps: .\build.ps1 test: off skip_tags: true + +cache: + - src\packages -> **\packages.config # preserve "packages" directory in the root of build folder but will reset it if packages.config is modified \ No newline at end of file diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index a0fe02fe4c..0000000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,21 +0,0 @@ -variables: - DOTNET_SDK_VERSION: '2.1.503' - DOTNET_PACKAGE_TYPE: 'sdk' - RUBY_VERSION: '2.5' - -jobs: -- template: build/tmpl/jobs.yml - parameters: - name: macOS - vmImage: 'macOS 10.13' - installRuby: 'false' - -- template: build/tmpl/jobs.yml - parameters: - name: Linux - vmImage: 'Ubuntu 16.04' - -- template: build/tmpl/jobs.yml - parameters: - name: Windows - vmImage: 'VS2017-Win2016' diff --git a/build.cake b/build.cake index 11a0e67171..2c26a2a751 100644 --- a/build.cake +++ b/build.cake @@ -1,750 +1,201 @@ -// Install modules -#module nuget:?package=Cake.DotNetTool.Module&version=0.1.0 +#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" -// Install addins. -#addin "nuget:?package=Cake.Gitter&version=0.9.0" -#addin "nuget:?package=Cake.Docker&version=0.9.6" -#addin "nuget:?package=Cake.Npm&version=0.15.0" -#addin "nuget:?package=Cake.Incubator&version=3.0.0" -#addin "nuget:?package=Cake.Json&version=3.0.0" -#addin "nuget:?package=Cake.Tfx&version=0.8.0" -#addin "nuget:?package=Cake.Gem&version=0.7.0" -#addin "nuget:?package=Cake.Coverlet&version=2.2.1" -#addin "nuget:?package=Cake.Codecov&version=0.5.0" -#addin "nuget:?package=Newtonsoft.Json&version=9.0.1" - -// Install tools. -#tool "nuget:?package=GitReleaseManager&version=0.7.1" -#tool "nuget:?package=NUnit.ConsoleRunner&version=3.9.0" -#tool "nuget:?package=GitReleaseNotes&version=0.7.1" -#tool "nuget:?package=ILRepack&version=2.0.16" -#tool "nuget:?package=Codecov&version=1.1.0" -#tool "nuget:?package=nuget.commandline&version=4.9.2" - -// Install .NET Core Global tools. -#tool "dotnet:?package=GitReleaseManager.Tool&version=0.8.0" - -// Load other scripts. -#load "./build/parameters.cake" -#load "./build/utils.cake" +var target = Argument("target", "Default"); +var configuration = Argument("configuration", "Release"); -////////////////////////////////////////////////////////////////////// -// PARAMETERS -////////////////////////////////////////////////////////////////////// +string version = null; +string nugetVersion = null; +string preReleaseTag = null; +string semVersion = null; +string milestone = null; bool publishingError = false; +bool IsTagged = (BuildSystem.AppVeyor.Environment.Repository.Tag.IsTag && + !string.IsNullOrWhiteSpace(BuildSystem.AppVeyor.Environment.Repository.Tag.Name)); +bool IsMainGitVersionRepo = StringComparer.OrdinalIgnoreCase.Equals("gittools/gitversion", BuildSystem.AppVeyor.Environment.Repository.Name); +bool IsPullRequest = BuildSystem.AppVeyor.Environment.PullRequest.IsPullRequest; +bool IsMainGitVersionBranch = StringComparer.OrdinalIgnoreCase.Equals("master", BuildSystem.AppVeyor.Environment.Repository.Branch); -/////////////////////////////////////////////////////////////////////////////// -// SETUP / TEARDOWN -/////////////////////////////////////////////////////////////////////////////// - -Setup(context => +void Build(string configuration, string nugetVersion, string semVersion, string version, string preReleaseTag) { - var parameters = BuildParameters.GetParameters(Context); - Build(parameters.Configuration); - var gitVersion = GetVersion(parameters); - parameters.Initialize(context, gitVersion); - - // Increase verbosity? - if (parameters.IsMainBranch && (context.Log.Verbosity != Verbosity.Diagnostic)) { - Information("Increasing verbosity to diagnostic."); - context.Log.Verbosity = Verbosity.Diagnostic; + if(IsRunningOnUnix()) + { + XBuild("./src/GitVersion.sln", new XBuildSettings() + .SetConfiguration(configuration) + .WithProperty("POSIX", "True") + .SetVerbosity(Verbosity.Minimal)); } - - Information("Building version {0} of GitVersion ({1}, {2})", - parameters.Version.SemVersion, - parameters.Configuration, - parameters.Target); - - Information("Repository info : IsMainRepo {0}, IsMainBranch {1}, IsTagged: {2}, IsPullRequest: {3}", - parameters.IsMainRepo, - parameters.IsMainBranch, - parameters.IsTagged, - parameters.IsPullRequest); - - return parameters; -}); - -Teardown((context, parameters) => -{ - try + else { - Information("Starting Teardown..."); - - Information("Repository info : IsMainRepo {0}, IsMainBranch {1}, IsTagged: {2}, IsPullRequest: {3}", - parameters.IsMainRepo, - parameters.IsMainBranch, - parameters.IsTagged, - parameters.IsPullRequest); + var msBuildSettings = new MSBuildSettings() + .SetConfiguration(configuration) + .SetPlatformTarget(PlatformTarget.MSIL) + .WithProperty("Windows", "True") + .UseToolVersion(MSBuildToolVersion.VS2015) + .SetVerbosity(Verbosity.Minimal) + .SetNodeReuse(false); - if(context.Successful) + if (BuildSystem.AppVeyor.IsRunningOnAppVeyor) { - // if(parameters.ShouldPublish) - // { - // if(parameters.CanPostToGitter) - // { - // var message = "@/all Version " + parameters.Version.SemVersion + " of the GitVersion has just been released, https://www.nuget.org/packages/GitVersion."; - - // var postMessageResult = Gitter.Chat.PostMessage( - // message: message, - // messageSettings: new GitterChatMessageSettings { Token = parameters.Gitter.Token, RoomId = parameters.Gitter.RoomId} - // ); - - // if (postMessageResult.Ok) - // { - // Information("Message {0} succcessfully sent", postMessageResult.TimeStamp); - // } - // else - // { - // Error("Failed to send message: {0}", postMessageResult.Error); - // } - // } - // } + msBuildSettings = msBuildSettings + .WithProperty("GitVersion_NuGetVersion", nugetVersion) + .WithProperty("GitVersion_SemVer", semVersion) + .WithProperty("GitVersion_MajorMinorPatch", version) + .WithProperty("GitVersion_PreReleaseTag", preReleaseTag); } - - Information("Finished running tasks."); + MSBuild("./src/GitVersion.sln", msBuildSettings); } - catch (Exception exception) - { - Error(exception.Dump()); - } -}); - -////////////////////////////////////////////////////////////////////// -// TASKS -////////////////////////////////////////////////////////////////////// - -#region Build - -Task("Clean") - .Does((parameters) => -{ - Information("Cleaning directories.."); - - CleanDirectories("./src/**/bin/" + parameters.Configuration); - CleanDirectories("./src/**/obj"); - CleanDirectories("./src/GitVersionTfsTask/scripts/**"); - - DeleteFiles("src/GitVersionTfsTask/*.vsix"); - DeleteFiles("src/GitVersionRubyGem/*.gem"); - - CleanDirectories(parameters.Paths.Directories.ToClean); -}); +} // This build task can be run to just build Task("DogfoodBuild") - .IsDependentOn("Clean") - .Does((parameters) => -{ - Build(parameters.Configuration); -}); - -Task("Build") - .IsDependentOn("Clean") - .Does((parameters) => + .IsDependentOn("NuGet-Package-Restore") + .Does(() => { - Build(parameters.Configuration); -}); - -#endregion - -#region Tests - -Task("Test") - .WithCriteria((context, parameters) => parameters.EnabledUnitTests, "Unit tests were disabled.") - .IsDependentOn("Build") - .Does((parameters) => -{ - var framework = "net461"; - - // run using dotnet test - var projects = GetFiles("./src/**/*.Tests.csproj"); - foreach(var project in projects) - { - var settings = new DotNetCoreTestSettings - { - Framework = framework, - NoBuild = true, - NoRestore = true, - Configuration = parameters.Configuration - }; - - var coverletSettings = new CoverletSettings { - CollectCoverage = true, - CoverletOutputFormat = CoverletOutputFormat.opencover, - CoverletOutputDirectory = parameters.Paths.Directories.TestCoverageOutput + "/", - CoverletOutputName = $"{project.GetFilenameWithoutExtension()}.coverage.xml" - }; - - if (IsRunningOnUnix()) - { - settings.Filter = "TestCategory!=NoMono"; - } - - // DotNetCoreTest(project.FullPath, settings, coverletSettings); - DotNetCoreTest(project.FullPath, settings); - } - - // run using NUnit - var testAssemblies = GetFiles("./src/**/bin/" + parameters.Configuration + "/" + framework + "/*.Tests.dll"); - - var nunitSettings = new NUnit3Settings - { - Results = new List { new NUnit3Result { FileName = parameters.Paths.Files.TestCoverageOutputFilePath } } - }; - - if(IsRunningOnUnix()) { - nunitSettings.Where = "cat!=NoMono"; - nunitSettings.Agents = 1; - } - - NUnit3(testAssemblies, nunitSettings); + Build(configuration, nugetVersion, semVersion, version, preReleaseTag); }); -#endregion - -#region Package - -Task("Copy-Files") - .IsDependentOn("Test") - .Does((parameters) => +Task("Version") + .IsDependentOn("DogfoodBuild") + .Does(() => { - // .NET Core - var netCoreDir = parameters.Paths.Directories.ArtifactsBinNetCore.Combine("tools"); - DotNetCorePublish("./src/GitVersionExe/GitVersionExe.csproj", new DotNetCorePublishSettings + GitVersion(new GitVersionSettings { - Framework = parameters.NetCoreVersion, - NoRestore = true, - Configuration = parameters.Configuration, - OutputDirectory = netCoreDir, - MSBuildSettings = parameters.MSBuildSettings + UpdateAssemblyInfo = true, + LogFilePath = "console", + OutputType = GitVersionOutput.BuildServer, + ToolPath = @"src\GitVersionExe\bin\Release\GitVersion.exe" }); - - // Copy license & Copy GitVersion.XML (since publish does not do this anymore) - CopyFileToDirectory("./LICENSE", netCoreDir); - CopyFileToDirectory($"./src/GitVersionExe/bin/{parameters.Configuration}/{parameters.NetCoreVersion}/GitVersion.xml", netCoreDir); - - // .NET 4.0 - DotNetCorePublish("./src/GitVersionExe/GitVersionExe.csproj", new DotNetCorePublishSettings + GitVersion assertedVersions = GitVersion(new GitVersionSettings { - Framework = parameters.FullFxVersion, - NoBuild = true, - NoRestore = true, - Configuration = parameters.Configuration, - OutputDirectory = parameters.Paths.Directories.ArtifactsBinFullFx, - MSBuildSettings = parameters.MSBuildSettings + OutputType = GitVersionOutput.Json, + ToolPath = @"src\GitVersionExe\bin\Release\GitVersion.exe" }); - var ilMergDir = parameters.Paths.Directories.ArtifactsBinFullFxILMerge; - var portableDir = parameters.Paths.Directories.ArtifactsBinFullFxPortable.Combine("tools"); - var cmdlineDir = parameters.Paths.Directories.ArtifactsBinFullFxCmdline.Combine("tools"); - - // Portable - PublishILRepackedGitVersionExe(true, parameters.Paths.Directories.ArtifactsBinFullFx, ilMergDir, portableDir, parameters.Configuration, parameters.FullFxVersion); - // Commandline - PublishILRepackedGitVersionExe(false, parameters.Paths.Directories.ArtifactsBinFullFx, ilMergDir, cmdlineDir, parameters.Configuration, parameters.FullFxVersion); - - // Vsix - var tfsPath = new DirectoryPath("./src/GitVersionTfsTask/GitVersionTask"); - EnsureDirectoryExists(tfsPath); - CopyFileToDirectory(portableDir + "/" + "LibGit2Sharp.dll.config", tfsPath); - CopyFileToDirectory(portableDir + "/" + "GitVersion.exe", tfsPath); - CopyDirectory(portableDir.Combine("lib"), tfsPath.Combine("lib")); - - // Vsix dotnet core - var tfsNetCorePath = new DirectoryPath("./src/GitVersionTfsTask/GitVersionNetCoreTask"); - EnsureDirectoryExists(tfsNetCorePath); - CopyDirectory(netCoreDir, tfsNetCorePath.Combine("netcore")); - - // Ruby Gem - var gemPath = new DirectoryPath("./src/GitVersionRubyGem/bin"); - EnsureDirectoryExists(gemPath); - CopyFileToDirectory(portableDir + "/" + "LibGit2Sharp.dll.config", gemPath); - CopyFileToDirectory(portableDir + "/" + "GitVersion.exe", gemPath); - CopyDirectory(portableDir.Combine("lib"), gemPath.Combine("lib")); + version = assertedVersions.MajorMinorPatch; + nugetVersion = assertedVersions.NuGetVersion; + preReleaseTag = assertedVersions.PreReleaseTag; + semVersion = assertedVersions.LegacySemVerPadded; }); -Task("Pack-Tfs") - .IsDependentOn("Copy-Files") - .Does((parameters) => +Task("NuGet-Package-Restore") + .Does(() => { - var workDir = "./src/GitVersionTfsTask"; - - // update version number - ReplaceTextInFile(new FilePath(workDir + "/vss-extension.mono.json"), "$version$", parameters.Version.SemVersion); - ReplaceTextInFile(new FilePath(workDir + "/vss-extension.netcore.json"), "$version$", parameters.Version.SemVersion); - UpdateTaskVersion(new FilePath(workDir + "/GitVersionTask/task.json"), parameters.Version.GitVersion); - UpdateTaskVersion(new FilePath(workDir + "/GitVersionNetCoreTask/task.json"), parameters.Version.GitVersion); - - // build and pack - NpmSet("progress", "false"); - NpmInstall(new NpmInstallSettings { WorkingDirectory = workDir, LogLevel = NpmLogLevel.Silent }); - NpmRunScript(new NpmRunScriptSettings { WorkingDirectory = workDir, ScriptName = "build", LogLevel = NpmLogLevel.Silent }); - - TfxExtensionCreate(new TfxExtensionCreateSettings - { - ToolPath = workDir + "/node_modules/.bin/" + (parameters.IsRunningOnWindows ? "tfx.cmd" : "tfx"), - WorkingDirectory = workDir, - ManifestGlobs = new List(){ "vss-extension.mono.json" }, - OutputPath = parameters.Paths.Directories.BuildArtifact - }); - - TfxExtensionCreate(new TfxExtensionCreateSettings - { - ToolPath = workDir + "/node_modules/.bin/" + (parameters.IsRunningOnWindows ? "tfx.cmd" : "tfx"), - WorkingDirectory = workDir, - ManifestGlobs = new List(){ "vss-extension.netcore.json" }, - OutputPath = parameters.Paths.Directories.BuildArtifact - }); + NuGetRestore("./src/GitVersion.sln"); }); -Task("Pack-Gem") - .IsDependentOn("Copy-Files") - .Does((parameters) => +Task("Build") + .IsDependentOn("Version") + .IsDependentOn("NuGet-Package-Restore") + .Does(() => { - var workDir = "./src/GitVersionRubyGem"; - - var gemspecFile = new FilePath(workDir + "/gitversion.gemspec"); - // update version number - ReplaceTextInFile(gemspecFile, "$version$", parameters.Version.GemVersion); - - var toolPath = FindToolInPath(IsRunningOnWindows() ? "gem.cmd" : "gem"); - GemBuild(gemspecFile, new Cake.Gem.Build.GemBuildSettings() - { - WorkingDirectory = workDir, - ToolPath = toolPath - }); - - CopyFiles(workDir + "/*.gem", parameters.Paths.Directories.BuildArtifact); + Build(configuration, nugetVersion, semVersion, version, preReleaseTag); }); -Task("Pack-Nuget") - .IsDependentOn("Copy-Files") - .Does((parameters) => +Task("Run-NUnit-Tests") + .IsDependentOn("DogfoodBuild") + .Does(() => { - foreach(var package in parameters.Packages.Nuget) + var settings = new NUnit3Settings(); + if(IsRunningOnUnix()) { - if (FileExists(package.NuspecPath)) { - var artifactPath = MakeAbsolute(parameters.PackagesBuildMap[package.Id]).FullPath; - - var nugetSettings = new NuGetPackSettings - { - Version = parameters.Version.SemVersion, - OutputDirectory = parameters.Paths.Directories.NugetRoot, - Files = GetFiles(artifactPath + "/**/*.*") - .Select(file => new NuSpecContent { Source = file.FullPath, Target = file.FullPath.Replace(artifactPath, "") }) - .ToArray() - }; - - NuGetPack(package.NuspecPath, nugetSettings); - } + settings.Where = "cat != NoMono"; } - - var settings = new DotNetCorePackSettings + 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" }, + settings); + if (AppVeyor.IsRunningOnAppVeyor) { - Configuration = parameters.Configuration, - OutputDirectory = parameters.Paths.Directories.NugetRoot, - NoBuild = true, - NoRestore = true, - MSBuildSettings = parameters.MSBuildSettings - }; - - // GitVersionCore, GitVersionTask, & global tool - DotNetCorePack("./src/GitVersionCore", settings); - DotNetCorePack("./src/GitVersionTask", settings); - DotNetCorePack("./src/GitVersionExe/GitVersion.Tool.csproj", settings); -}); - -Task("Pack-Chocolatey") - .WithCriteria((context, parameters) => parameters.IsRunningOnWindows, "Pack-Chocolatey works only on Windows agents.") - .WithCriteria((context, parameters) => parameters.IsMainBranch, "Pack-Chocolatey works only for main branch.") - .IsDependentOn("Copy-Files") - .Does((parameters) => -{ - foreach(var package in parameters.Packages.Chocolatey) - { - if (FileExists(package.NuspecPath)) { - var artifactPath = MakeAbsolute(parameters.PackagesBuildMap[package.Id]).FullPath; - - var files = GetFiles(artifactPath + "/**/*.*") - .Select(file => new ChocolateyNuSpecContent { Source = file.FullPath, Target = file.FullPath.Replace(artifactPath, "") }); - var txtFiles = (GetFiles("./nuspec/*.txt") + GetFiles("./nuspec/*.ps1")) - .Select(file => new ChocolateyNuSpecContent { Source = file.FullPath, Target = file.GetFilename().ToString() }); - - ChocolateyPack(package.NuspecPath, new ChocolateyPackSettings { - Verbose = true, - Version = parameters.Version.SemVersion, - OutputDirectory = parameters.Paths.Directories.NugetRoot, - Files = files.Concat(txtFiles).ToArray() - }); - } + Information("Uploading test results"); + AppVeyor.UploadTestResults("TestResult.xml", AppVeyorTestResultsType.NUnit3); } }); Task("Zip-Files") - .IsDependentOn("Copy-Files") - .Does((parameters) => -{ - // .NET 4.0 - var cmdlineDir = parameters.Paths.Directories.ArtifactsBinFullFxCmdline.Combine("tools"); - var fullFxFiles = GetFiles(cmdlineDir.FullPath + "/**/*"); - Zip(cmdlineDir, parameters.Paths.Files.ZipArtifactPathDesktop, fullFxFiles); - - // .NET Core - var netCoreDir = parameters.Paths.Directories.ArtifactsBinNetCore.Combine("tools"); - var coreclrFiles = GetFiles(netCoreDir.FullPath + "/**/*"); - Zip(netCoreDir, parameters.Paths.Files.ZipArtifactPathCoreClr, coreclrFiles); -}); - -Task("Docker-Build") - .WithCriteria((context, parameters) => !parameters.IsRunningOnMacOS, "Docker can be built only on Windows or Linux agents.") - .WithCriteria((context, parameters) => parameters.IsStableRelease() || parameters.IsPreRelease(), "Docker-Build works only for releases.") - .IsDependentOn("Copy-Files") - .Does((parameters) => -{ - if (parameters.IsRunningOnWindows) - { - DockerBuild("windows", "dotnetcore", parameters); - DockerBuild("windows", "fullfx", parameters); - } - else if (parameters.IsRunningOnLinux) - { - DockerBuild("linux", "dotnetcore", parameters); - DockerBuild("linux", "fullfx", parameters); - } -}); - -Task("Pack") - .IsDependentOn("Pack-Tfs") - .IsDependentOn("Pack-Gem") - .IsDependentOn("Pack-Nuget") - .IsDependentOn("Pack-Chocolatey") - .IsDependentOn("Zip-Files") - .Does((parameters) => -{ - Information("The build artifacts: \n"); - foreach(var artifact in parameters.Artifacts.All) - { - if (FileExists(artifact.ArtifactPath)) { Information("Artifact: {0}", artifact.ArtifactPath); } - } - - foreach(var package in parameters.Packages.All) - { - if (FileExists(package.PackagePath)) { Information("Artifact: {0}", package.PackagePath); } - } -}) - .ReportError(exception => -{ - Error(exception.Dump()); -}); - -#endregion - -#region Publish - -Task("Release-Notes") - .WithCriteria((context, parameters) => parameters.IsRunningOnWindows, "Release notes are generated only on Windows agents.") - .WithCriteria((context, parameters) => parameters.IsRunningOnAppVeyor, "Release notes are generated only on release agents.") - .WithCriteria((context, parameters) => parameters.IsStableRelease(), "Release notes are generated only for stable releases.") - .IsDependentOn("Clean") - .Does((parameters) => -{ - var outputFile = parameters.Paths.Files.ReleaseNotesOutputFilePath; - var githubToken = parameters.Credentials.GitHub.Token; - - GetReleaseNotes(outputFile, ".", githubToken); -}).ReportError(exception => -{ - Error(exception.Dump()); -}); - -Task("Publish-Coverage") - .WithCriteria((context, parameters) => parameters.IsRunningOnWindows, "Publish-Coverage works only on Windows agents.") - .WithCriteria((context, parameters) => parameters.IsRunningOnAppVeyor, "Publish-Coverage works only on AppVeyor.") - .WithCriteria((context, parameters) => parameters.IsStableRelease() || parameters.IsPreRelease(), "Publish-Coverage works only for releases.") - .IsDependentOn("Test") - .Does((parameters) => + .IsDependentOn("Build") + .IsDependentOn("Run-NUnit-Tests") + .Does(() => { - var coverageFiles = GetFiles(parameters.Paths.Directories.TestCoverageOutput + "/*.coverage.xml"); - - var token = parameters.Credentials.CodeCov.Token; - if(string.IsNullOrEmpty(token)) { - throw new InvalidOperationException("Could not resolve CodeCov token."); - } - - foreach (var coverageFile in coverageFiles) { - // Upload a coverage report using the CodecovSettings. - Codecov(new CodecovSettings { - Files = new [] { coverageFile.ToString() }, - Token = token - }); - } + Zip("./build/NuGetCommandLineBuild/Tools/", "build/GitVersion_" + nugetVersion + ".zip"); }); -Task("Publish-AppVeyor") - .WithCriteria((context, parameters) => parameters.IsRunningOnWindows, "Publish-AppVeyor works only on Windows agents.") - .WithCriteria((context, parameters) => parameters.IsRunningOnAppVeyor, "Publish-AppVeyor works only on AppVeyor.") - .IsDependentOn("Pack") - .IsDependentOn("Release-Notes") - .Does((parameters) => +Task("Create-Release-Notes") + .IsDependentOn("Build") + .WithCriteria(() => IsMainGitVersionRepo && IsMainGitVersionBranch && !IsPullRequest) + .Does(() => { - foreach(var artifact in parameters.Artifacts.All) - { - if (FileExists(artifact.ArtifactPath)) { AppVeyor.UploadArtifact(artifact.ArtifactPath); } - } + var githubToken = EnvironmentVariable("GitHubToken"); - foreach(var package in parameters.Packages.All) + if(!string.IsNullOrWhiteSpace(githubToken)) { - if (FileExists(package.PackagePath)) { AppVeyor.UploadArtifact(package.PackagePath); } - } - - if (FileExists(parameters.Paths.Files.TestCoverageOutputFilePath)) { - AppVeyor.UploadTestResults(parameters.Paths.Files.TestCoverageOutputFilePath, AppVeyorTestResultsType.NUnit3); - } -}) -.OnError(exception => -{ - Information("Publish-AppVeyor Task failed, but continuing with next Task..."); - Error(exception.Dump()); - publishingError = true; -}); + IEnumerable redirectedOutput; + var releaseNotesExitCode = StartProcess( + @"tools\GitReleaseNotes\tools\gitreleasenotes.exe", + new ProcessSettings { + Arguments = ". /o build/releasenotes.md /repoToken " + githubToken, + RedirectStandardOutput = true + }, + out redirectedOutput); + Information(string.Join("\n", redirectedOutput)); -Task("Publish-AzurePipeline") - .WithCriteria((context, parameters) => parameters.IsRunningOnWindows, "Publish-AzurePipeline works only on Windows agents.") - .WithCriteria((context, parameters) => parameters.IsRunningOnAzurePipeline, "Publish-AzurePipeline works only on AzurePipeline.") - .WithCriteria((context, parameters) => !parameters.IsPullRequest, "Publish-AzurePipeline works only for non-PR commits.") - .IsDependentOn("Pack") - .IsDependentOn("Release-Notes") - .Does((parameters) => -{ - foreach(var artifact in parameters.Artifacts.All) - { - if (FileExists(artifact.ArtifactPath)) { TFBuild.Commands.UploadArtifact(artifact.ContainerName, artifact.ArtifactPath, artifact.ArtifactName); } + if (!System.IO.File.Exists("./build/releasenotes.md") || string.IsNullOrEmpty(System.IO.File.ReadAllText("./build/releasenotes.md"))) { + System.IO.File.WriteAllText("./build/releasenotes.md", "No issues closed since last release"); + } } - foreach(var package in parameters.Packages.All) + else { - if (FileExists(package.PackagePath)) { TFBuild.Commands.UploadArtifact("packages", package.PackagePath, package.PackageName); } + Information("Create-Release-Notes is being skipped, as GitHub Token is not present."); } - - if (FileExists(parameters.Paths.Files.TestCoverageOutputFilePath)) { - var data = new TFBuildPublishTestResultsData { - TestResultsFiles = new[] { parameters.Paths.Files.TestCoverageOutputFilePath }, - TestRunner = TFTestRunnerType.NUnit - }; - TFBuild.Commands.PublishTestResults(data); - } -}) -.OnError(exception => -{ - Information("Publish-AzurePipeline Task failed, but continuing with next Task..."); - Error(exception.Dump()); - publishingError = true; }); -Task("Publish-Tfs") - .WithCriteria((context, parameters) => parameters.EnabledPublishTfs, "Publish-Tfs was disabled.") - .WithCriteria((context, parameters) => parameters.IsRunningOnWindows, "Publish-Tfs works only on Windows agents.") - .WithCriteria((context, parameters) => parameters.IsRunningOnAppVeyor, "Publish-Tfs works only on AppVeyor.") - .WithCriteria((context, parameters) => parameters.IsStableRelease(), "Publish-Tfs works only for releases.") - .IsDependentOn("Pack-Tfs") - .Does((parameters) => -{ - var token = parameters.Credentials.Tfx.Token; - if(string.IsNullOrEmpty(token)) { - throw new InvalidOperationException("Could not resolve Tfx token."); - } - - var workDir = "./src/GitVersionTfsTask"; - TfxExtensionPublish(parameters.Paths.Files.VsixOutputFilePath, new TfxExtensionPublishSettings - { - ToolPath = workDir + "/node_modules/.bin/" + (parameters.IsRunningOnWindows ? "tfx.cmd" : "tfx"), - AuthType = TfxAuthType.Pat, - Token = token - }); - - var netCoreWorkDir = "./src/GitVersionTfsTask.NetCore"; - TfxExtensionPublish(parameters.Paths.Files.VsixNetCoreOutputFilePath, new TfxExtensionPublishSettings - { - ToolPath = netCoreWorkDir + "/node_modules/.bin/" + (parameters.IsRunningOnWindows ? "tfx.cmd" : "tfx"), - AuthType = TfxAuthType.Pat, - Token = token - }); -}) -.OnError(exception => -{ - Information("Publish-Tfs Task failed, but continuing with next Task..."); - Error(exception.Dump()); - publishingError = true; -}); +Task("Package") + .IsDependentOn("Create-Release-Notes") + .IsDependentOn("Zip-Files"); -Task("Publish-Gem") - .WithCriteria((context, parameters) => parameters.EnabledPublishGem, "Publish-Gem was disabled.") - .WithCriteria((context, parameters) => parameters.IsRunningOnWindows, "Publish-Gem works only on Windows agents.") - .WithCriteria((context, parameters) => parameters.IsRunningOnAppVeyor, "Publish-Gem works only on AppVeyor.") - .WithCriteria((context, parameters) => parameters.IsStableRelease() || parameters.IsPreRelease(), "Publish-Gem works only for releases.") - .IsDependentOn("Pack-Gem") - .Does((parameters) => +Task("Upload-AppVeyor-Artifacts") + .IsDependentOn("Package") + .WithCriteria(() => AppVeyor.IsRunningOnAppVeyor) + .Does(() => { - var apiKey = parameters.Credentials.RubyGem.ApiKey; - if(string.IsNullOrEmpty(apiKey)) { - throw new InvalidOperationException("Could not resolve Ruby Gem Api key."); - } + var gem = string.IsNullOrEmpty(preReleaseTag) ? + "gitversion-" + version + ".gem" : + "gitversion-" + version + "." + preReleaseTag + ".gem"; - SetRubyGemPushApiKey(apiKey); - - var toolPath = FindToolInPath(IsRunningOnWindows() ? "gem.cmd" : "gem"); - GemPush(parameters.Paths.Files.GemOutputFilePath, new Cake.Gem.Push.GemPushSettings() - { - ToolPath = toolPath, + System.IO.File.WriteAllLines("build/artifacts", new[]{ + "NuGetExeBuild:GitVersion.Portable." + nugetVersion +".nupkg", + "NuGetCommandLineBuild:GitVersion.CommandLine." + nugetVersion +".nupkg", + "NuGetRefBuild:GitVersion." + nugetVersion +".nupkg", + "NuGetTaskBuild:GitVersionTask." + nugetVersion +".nupkg", + "GitVersionTfsTaskBuild:gittools.gitversion-" + semVersion +".vsix", + "GemBuild:" + gem, + "zip:GitVersion_" + nugetVersion + ".zip" }); -}) -.OnError(exception => -{ - Information("Publish-Gem Task failed, but continuing with next Task..."); - Error(exception.Dump()); - publishingError = true; -}); - -Task("Publish-DockerHub") - .WithCriteria((context, parameters) => parameters.EnabledPublishDocker, "Publish-DockerHub was disabled.") - .WithCriteria((context, parameters) => !parameters.IsRunningOnMacOS, "Publish-DockerHub works only on Windows and Linux agents.") - .WithCriteria((context, parameters) => parameters.IsRunningOnAppVeyor || (parameters.IsRunningOnTravis && !parameters.IsRunningOnMacOS), "Publish-DockerHub works only on AppVeyor or Travis.") - .WithCriteria((context, parameters) => parameters.IsStableRelease() || parameters.IsPreRelease(), "Publish-DockerHub works only for releases.") - .IsDependentOn("Docker-Build") - .Does((parameters) => -{ - var username = parameters.Credentials.Docker.UserName; - if (string.IsNullOrEmpty(username)) { - throw new InvalidOperationException("Could not resolve Docker user name."); - } - - var password = parameters.Credentials.Docker.Password; - if (string.IsNullOrEmpty(password)) { - throw new InvalidOperationException("Could not resolve Docker password."); - } - - DockerLogin(parameters.Credentials.Docker.UserName, parameters.Credentials.Docker.Password); - - if (parameters.IsRunningOnWindows) - { - DockerPush("windows", "dotnetcore", parameters); - DockerPush("windows", "fullfx", parameters); - } - else if (parameters.IsRunningOnLinux) - { - DockerPush("linux", "dotnetcore", parameters); - DockerPush("linux", "fullfx", parameters); - } - - DockerLogout(); -}) -.OnError(exception => -{ - Information("Publish-DockerHub Task failed, but continuing with next Task..."); - Error(exception.Dump()); - publishingError = true; -}); - -Task("Publish-NuGet") - .WithCriteria((context, parameters) => parameters.EnabledPublishNuget, "Publish-NuGet was disabled.") - .WithCriteria((context, parameters) => parameters.IsRunningOnWindows, "Publish-NuGet works only on Windows agents.") - .WithCriteria((context, parameters) => parameters.IsRunningOnAppVeyor, "Publish-NuGet works only on AppVeyor.") - .WithCriteria((context, parameters) => parameters.IsStableRelease() || parameters.IsPreRelease(), "Publish-NuGet works only for releases.") - .IsDependentOn("Pack-NuGet") - .Does((parameters) => -{ - var apiKey = parameters.Credentials.Nuget.ApiKey; - if(string.IsNullOrEmpty(apiKey)) { - throw new InvalidOperationException("Could not resolve NuGet API key."); - } - var apiUrl = parameters.Credentials.Nuget.ApiUrl; - if(string.IsNullOrEmpty(apiUrl)) { - throw new InvalidOperationException("Could not resolve NuGet API url."); - } + 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/GitVersion_" + nugetVersion + ".zip"); + AppVeyor.UploadArtifact("build/GemBuild/" + gem); + AppVeyor.UploadArtifact("build/artifacts"); - foreach(var package in parameters.Packages.Nuget) + if(IsMainGitVersionRepo && IsMainGitVersionBranch && !IsPullRequest) { - if (FileExists(package.PackagePath)) + if(FileExists("build/releasenotes.md")) { - // Push the package. - NuGetPush(package.PackagePath, new NuGetPushSettings - { - ApiKey = apiKey, - Source = apiUrl - }); + AppVeyor.UploadArtifact("build/releasenotes.md"); } } -}) -.OnError(exception => -{ - Information("Publish-NuGet Task failed, but continuing with next Task..."); - Error(exception.Dump()); - publishingError = true; }); -Task("Publish-Chocolatey") - .WithCriteria((context, parameters) => parameters.EnabledPublishChocolatey, "Publish-Chocolatey was disabled.") - .WithCriteria((context, parameters) => parameters.IsRunningOnWindows, "Publish-Chocolatey works only on Windows agents.") - .WithCriteria((context, parameters) => parameters.IsRunningOnAppVeyor, "Publish-Chocolatey works only on AppVeyor.") - .WithCriteria((context, parameters) => parameters.IsStableRelease() || parameters.IsPreRelease(), "Publish-Chocolatey works only for releases.") - .IsDependentOn("Pack-Chocolatey") - .Does((parameters) => -{ - var apiKey = parameters.Credentials.Chocolatey.ApiKey; - if(string.IsNullOrEmpty(apiKey)) { - throw new InvalidOperationException("Could not resolve Chocolatey API key."); - } - var apiUrl = parameters.Credentials.Chocolatey.ApiUrl; - if(string.IsNullOrEmpty(apiUrl)) { - throw new InvalidOperationException("Could not resolve Chocolatey API url."); - } +Task("Travis") + .IsDependentOn("Run-NUnit-Tests"); - foreach(var package in parameters.Packages.Chocolatey) - { - if (FileExists(package.PackagePath)) - { - // Push the package. - ChocolateyPush(package.PackagePath, new ChocolateyPushSettings - { - ApiKey = apiKey, - Source = apiUrl, - Force = true - }); - } - } -}) -.OnError(exception => -{ - Information("Publish-Chocolatey Task failed, but continuing with next Task..."); - Error(exception.Dump()); - publishingError = true; -}); - -Task("Publish") - .IsDependentOn("Publish-AppVeyor") - .IsDependentOn("Publish-AzurePipeline") - .IsDependentOn("Publish-Coverage") - .IsDependentOn("Publish-NuGet") - .IsDependentOn("Publish-Chocolatey") - .IsDependentOn("Publish-Tfs") - .IsDependentOn("Publish-Gem") - .IsDependentOn("Publish-DockerHub") - .Finally(() => -{ - if (publishingError) - { - throw new Exception("An error occurred during the publishing of GitVersion. All publishing tasks have been attempted."); - } -}); - -#endregion Task("Default") - .IsDependentOn("Publish"); + .IsDependentOn("Upload-AppVeyor-Artifacts"); -////////////////////////////////////////////////////////////////////// -// EXECUTION -////////////////////////////////////////////////////////////////////// - -var target = Argument("target", "Default"); -RunTarget(target); +RunTarget(target); \ No newline at end of file diff --git a/build.config b/build.config deleted file mode 100644 index da34551516..0000000000 --- a/build.config +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash -CAKE_VERSION=0.32.1 -DOTNET_VERSION=2.1.503 diff --git a/build.ps1 b/build.ps1 index 5b599298a5..18b8560520 100644 --- a/build.ps1 +++ b/build.ps1 @@ -21,14 +21,21 @@ The build script target to run. The build configuration to use. .PARAMETER Verbosity Specifies the amount of information to be displayed. +.PARAMETER Experimental +Tells Cake to use the latest Roslyn release. .PARAMETER WhatIf Performs a dry run of the build script. No tasks will be executed. +.PARAMETER Mono +Tells Cake to use the Mono scripting engine. +.PARAMETER SkipToolPackageRestore +Skips restoring of packages. .PARAMETER ScriptArgs Remaining arguments are added here. .LINK -https://cakebuild.net +http://cakebuild.net + #> [CmdletBinding()] @@ -38,158 +45,101 @@ Param( [string]$Configuration = "Release", [ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")] [string]$Verbosity = "Verbose", + [switch]$Experimental, [Alias("DryRun","Noop")] [switch]$WhatIf, + [switch]$Mono, + [switch]$SkipToolPackageRestore, [Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)] [string[]]$ScriptArgs ) Write-Host "Preparing to run build script..." -$DotNetInstallerUri = 'https://dot.net/v1/dotnet-install.ps1'; -$DotNetUnixInstallerUri = 'https://dot.net/v1/dotnet-install.sh' -$DotNetChannel = 'LTS' -$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent - -[string] $CakeVersion = '' -[string] $DotNetVersion= '' -foreach($line in Get-Content "$PSScriptRoot\build.config") -{ - if ($line -like 'CAKE_VERSION=*') { - $CakeVersion = $line.SubString(13) - } - elseif ($line -like 'DOTNET_VERSION=*') { - $DotNetVersion =$line.SubString(15) - } -} - -if ([string]::IsNullOrEmpty($CakeVersion) -or [string]::IsNullOrEmpty($DotNetVersion)) { - 'Failed to parse Cake / .NET Core SDK Version' - exit 1 +$PSScriptRoot = split-path -parent $MyInvocation.MyCommand.Definition; +$TOOLS_DIR = Join-Path $PSScriptRoot "tools" +$NUGET_EXE = Join-Path $TOOLS_DIR "nuget.exe" +$NUGET_URL = "http://dist.nuget.org/win-x86-commandline/latest/nuget.exe" +$CAKE_EXE = Join-Path $TOOLS_DIR "Cake/Cake.exe" +$PACKAGES_CONFIG = Join-Path $TOOLS_DIR "packages.config" + +# Should we use mono? +$UseMono = ""; +if($Mono.IsPresent) { + Write-Verbose -Message "Using the Mono based scripting engine." + $UseMono = "-mono" } -# Make sure tools folder exists -$ToolPath = Join-Path $PSScriptRoot "tools" -if (!(Test-Path $ToolPath)) { - Write-Verbose "Creating tools directory..." - New-Item -Path $ToolPath -Type Directory -Force | out-null +# Should we use the new Roslyn? +$UseExperimental = ""; +if($Experimental.IsPresent -and !($Mono.IsPresent)) { + Write-Verbose -Message "Using experimental version of Roslyn." + $UseExperimental = "-experimental" } -# SSL FIX -[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; - -########################################################################### -# INSTALL .NET CORE CLI -########################################################################### - -Function Remove-PathVariable([string]$VariableToRemove) -{ - $SplitChar = ';' - if ($IsMacOS -or $IsLinux) { - $SplitChar = ':' - } - - $path = [Environment]::GetEnvironmentVariable("PATH", "User") - if ($path -ne $null) - { - $newItems = $path.Split($SplitChar, [StringSplitOptions]::RemoveEmptyEntries) | Where-Object { "$($_)" -inotlike $VariableToRemove } - [Environment]::SetEnvironmentVariable("PATH", [System.String]::Join($SplitChar, $newItems), "User") - } - - $path = [Environment]::GetEnvironmentVariable("PATH", "Process") - if ($path -ne $null) - { - $newItems = $path.Split($SplitChar, [StringSplitOptions]::RemoveEmptyEntries) | Where-Object { "$($_)" -inotlike $VariableToRemove } - [Environment]::SetEnvironmentVariable("PATH", [System.String]::Join($SplitChar, $newItems), "Process") - } +# Is this a dry run? +$UseDryRun = ""; +if($WhatIf.IsPresent) { + $UseDryRun = "-dryrun" } -# Get .NET Core CLI path if installed. -$FoundDotNetCliVersion = $null; -if (Get-Command dotnet -ErrorAction SilentlyContinue) { - $FoundDotNetCliVersion = dotnet --version; +# Make sure tools folder exists +if ((Test-Path $PSScriptRoot) -and !(Test-Path $TOOLS_DIR)) { + Write-Verbose -Message "Creating tools directory..." + New-Item -Path $TOOLS_DIR -Type directory | out-null } -if($FoundDotNetCliVersion -ne $DotNetVersion) { - $InstallPath = Join-Path $PSScriptRoot ".dotnet" - if (!(Test-Path $InstallPath)) { - New-Item -Path $InstallPath -ItemType Directory -Force | Out-Null; +# Make sure that packages.config exist. +if (!(Test-Path $PACKAGES_CONFIG)) { + Write-Verbose -Message "Downloading packages.config..." + try { Invoke-WebRequest -Uri http://cakebuild.net/download/bootstrapper/packages -OutFile $PACKAGES_CONFIG } catch { + Throw "Could not download packages.config." } +} - if ($IsMacOS -or $IsLinux) { - (New-Object System.Net.WebClient).DownloadFile($DotNetUnixInstallerUri, "$InstallPath\dotnet-install.sh"); - & bash $InstallPath\dotnet-install.sh --version "$DotNetVersion" --install-dir "$InstallPath" --channel "$DotNetChannel" --no-path - } - else { - (New-Object System.Net.WebClient).DownloadFile($DotNetInstallerUri, "$InstallPath\dotnet-install.ps1"); - & $InstallPath\dotnet-install.ps1 -Channel $DotNetChannel -Version $DotNetVersion -InstallDir $InstallPath; +# Try find NuGet.exe in path if not exists +if (!(Test-Path $NUGET_EXE)) { + Write-Verbose -Message "Trying to find nuget.exe in PATH..." + $existingPaths = $Env:Path -Split ';' | Where-Object { (![string]::IsNullOrEmpty($_)) -and (Test-Path $_) } + $NUGET_EXE_IN_PATH = Get-ChildItem -Path $existingPaths -Filter "nuget.exe" | Select -First 1 + if ($NUGET_EXE_IN_PATH -ne $null -and (Test-Path $NUGET_EXE_IN_PATH.FullName)) { + Write-Verbose -Message "Found in PATH at $($NUGET_EXE_IN_PATH.FullName)." + $NUGET_EXE = $NUGET_EXE_IN_PATH.FullName } - - Remove-PathVariable "$InstallPath" - $env:PATH = "$InstallPath;$env:PATH" } -$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 -$env:DOTNET_CLI_TELEMETRY_OPTOUT=1 - - -########################################################################### -# INSTALL CAKE -########################################################################### - -# Make sure Cake has been installed. -[string] $CakeExePath = '' -[string] $CakeInstalledVersion = Get-Command dotnet-cake -ErrorAction SilentlyContinue | % {&$_.Source --version} - -if ($CakeInstalledVersion -eq $CakeVersion) { - # Cake found locally - $CakeExePath = (Get-Command dotnet-cake).Source +# Try download NuGet.exe if not exists +if (!(Test-Path $NUGET_EXE)) { + Write-Verbose -Message "Downloading NuGet.exe..." + try { + (New-Object System.Net.WebClient).DownloadFile($NUGET_URL, $NUGET_EXE) + } catch { + Throw "Could not download NuGet.exe." + } } -else { - $CakePath = Join-Path $ToolPath ".store\cake.tool\$CakeVersion" - $CakeExePath = (Get-ChildItem -Path $ToolPath -Filter "dotnet-cake*" -File| ForEach-Object FullName | Select-Object -First 1) - - - if ((!(Test-Path -Path $CakePath -PathType Container)) -or (!(Test-Path $CakeExePath -PathType Leaf))) { - if ((![string]::IsNullOrEmpty($CakeExePath)) -and (Test-Path $CakeExePath -PathType Leaf)) - { - & dotnet tool uninstall --tool-path $ToolPath Cake.Tool - } - - & dotnet tool install --tool-path $ToolPath --version $CakeVersion Cake.Tool - if ($LASTEXITCODE -ne 0) - { - 'Failed to install cake' - exit 1 - } - $CakeExePath = (Get-ChildItem -Path $ToolPath -Filter "dotnet-cake*" -File| ForEach-Object FullName | Select-Object -First 1) +# Save nuget.exe path to environment to be available to child processed +$ENV:NUGET_EXE = $NUGET_EXE + +# Restore tools from NuGet? +if(-Not $SkipToolPackageRestore.IsPresent) { + Push-Location + Set-Location $TOOLS_DIR + Write-Verbose -Message "Restoring tools from NuGet..." + $NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -OutputDirectory `"$TOOLS_DIR`"" + if ($LASTEXITCODE -ne 0) { + Throw "An error occured while restoring NuGet tools." } + Write-Verbose -Message ($NuGetOutput | out-string) + Pop-Location } -# ########################################################################### -# # RUN BUILD SCRIPT -# ########################################################################### - -# Build the argument list. -$Arguments = @{ - target=$Target; - configuration=$Configuration; - verbosity=$Verbosity; - dryrun=$WhatIf; - nuget_useinprocessclient=$true; -}.GetEnumerator() | ForEach-Object { "--{0}=`"{1}`"" -f $_.key, $_.value }; +# Make sure that Cake has been installed. +if (!(Test-Path $CAKE_EXE)) { + Throw "Could not find Cake.exe at $CAKE_EXE" +} # Start Cake Write-Host "Running build script..." - -& "$CakeExePath" $Script --bootstrap -if ($LASTEXITCODE -eq 0) -{ - & "$CakeExePath" $Script $Arguments -} - -if ($env:APPVEYOR) { - $host.SetShouldExit($LASTEXITCODE) -} +Invoke-Expression "& `"$CAKE_EXE`" `"$Script`" -target=`"$Target`" -configuration=`"$Configuration`" -verbosity=`"$Verbosity`" $UseMono $UseDryRun $UseExperimental $ScriptArgs" exit $LASTEXITCODE diff --git a/build.sh b/build.sh new file mode 100755 index 0000000000..3d74a70fb5 --- /dev/null +++ b/build.sh @@ -0,0 +1,82 @@ +#!/usr/bin/env bash +############################################################### +# This is the Cake bootstrapper script that is responsible for +# downloading Cake and all specified tools from NuGet. +############################################################### + +# Define directories. +SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +TOOLS_DIR=$SCRIPT_DIR/tools +NUGET_EXE=$TOOLS_DIR/nuget.exe +CAKE_EXE=$TOOLS_DIR/Cake/Cake.exe + +# Define default arguments. +SCRIPT="build.cake" +TARGET="Travis" +CONFIGURATION="Release" +VERBOSITY="verbose" +DRYRUN= +SHOW_VERSION=false +SCRIPT_ARGUMENTS=() + +# Parse arguments. +for i in "$@"; do + case $1 in + -s|--script) SCRIPT="$2"; shift ;; + -t|--target) TARGET="$2"; shift ;; + -c|--configuration) CONFIGURATION="$2"; shift ;; + -v|--verbosity) VERBOSITY="$2"; shift ;; + -d|--dryrun) DRYRUN="-dryrun" ;; + --version) SHOW_VERSION=true ;; + --) shift; SCRIPT_ARGUMENTS+=("$@"); break ;; + *) SCRIPT_ARGUMENTS+=("$1") ;; + esac + shift +done + +# Make sure the tools folder exist. +if [ ! -d $TOOLS_DIR ]; then + mkdir $TOOLS_DIR +fi + +# Make sure that packages.config exist. +if [ ! -f $TOOLS_DIR/packages.config ]; then + echo "Downloading packages.config..." + curl -Lsfo $TOOLS_DIR/packages.config http://cakebuild.net/download/bootstrapper/packages + if [ $? -ne 0 ]; then + echo "An error occured while downloading packages.config." + exit 1 + fi +fi + +# Download NuGet if it does not exist. +if [ ! -f $NUGET_EXE ]; then + echo "Downloading NuGet..." + curl -Lsfo $NUGET_EXE https://dist.nuget.org/win-x86-commandline/latest/nuget.exe + if [ $? -ne 0 ]; then + echo "An error occured while downloading nuget.exe." + exit 1 + fi +fi + +# Restore tools from NuGet. +pushd $TOOLS_DIR >/dev/null +mono $NUGET_EXE install -ExcludeVersion +if [ $? -ne 0 ]; then + echo "Could not restore NuGet packages." + exit 1 +fi +popd >/dev/null + +# Make sure that Cake has been installed. +if [ ! -f $CAKE_EXE ]; then + echo "Could not find Cake.exe at '$CAKE_EXE'." + exit 1 +fi + +# Start Cake +if $SHOW_VERSION; then + exec mono $CAKE_EXE -version +else + exec mono $CAKE_EXE $SCRIPT -verbosity=$VERBOSITY -configuration=$CONFIGURATION -target=$TARGET $DRYRUN "${SCRIPT_ARGUMENTS[@]}" +fi diff --git a/build/artifacts.cake b/build/artifacts.cake deleted file mode 100644 index 9d945d2efe..0000000000 --- a/build/artifacts.cake +++ /dev/null @@ -1,95 +0,0 @@ -public class BuildPackages -{ - public ICollection All { get; private set; } - public ICollection Nuget { get; private set; } - public ICollection Chocolatey { get; private set; } - - public static BuildPackages GetPackages( - DirectoryPath nugetRooPath, - string semVersion, - string[] packageIds, - string[] chocolateyPackageIds) - { - var toNugetPackage = BuildPackage(nugetRooPath, semVersion); - var toChocolateyPackage = BuildPackage(nugetRooPath, semVersion, isChocolateyPackage: true); - var nugetPackages = packageIds.Select(toNugetPackage).ToArray(); - var chocolateyPackages = chocolateyPackageIds.Select(toChocolateyPackage).ToArray(); - - return new BuildPackages { - All = nugetPackages.Union(chocolateyPackages).ToArray(), - Nuget = nugetPackages, - Chocolatey = chocolateyPackages - }; - } - - private static Func BuildPackage( - DirectoryPath nugetRooPath, - string version, - bool isChocolateyPackage = false) - { - return package => new BuildPackage( - id: package, - nuspecPath: string.Concat("./nuspec/", package, ".nuspec"), - packagePath: nugetRooPath.CombineWithFilePath(string.Concat(package, ".", version, ".nupkg")), - isChocolateyPackage: isChocolateyPackage); - } -} - -public class BuildPackage -{ - public string Id { get; private set; } - public FilePath NuspecPath { get; private set; } - public FilePath PackagePath { get; private set; } - public bool IsChocolateyPackage { get; private set; } - public string PackageName { get; private set; } - - - public BuildPackage( - string id, - FilePath nuspecPath, - FilePath packagePath, - bool isChocolateyPackage) - { - Id = id; - NuspecPath = nuspecPath; - PackagePath = packagePath; - IsChocolateyPackage = isChocolateyPackage; - PackageName = PackagePath.GetFilename().ToString(); - } -} - -public class BuildArtifacts -{ - public ICollection All { get; private set; } - - public static BuildArtifacts GetArtifacts(FilePath[] artifacts) - { - var toBuildArtifact = BuildArtifact("build-artifact"); - var buildArtifacts = artifacts.Select(toBuildArtifact).ToArray(); - - return new BuildArtifacts { - All = buildArtifacts.ToArray(), - }; - } - - private static Func BuildArtifact(string containerName) - { - return artifactPath => new BuildArtifact(containerName: containerName, artifactPath: artifactPath); - } -} - -public class BuildArtifact -{ - public string ContainerName { get; private set; } - public FilePath ArtifactPath { get; private set; } - public string ArtifactName { get; private set; } - - public BuildArtifact( - string containerName, - FilePath artifactPath) - { - ContainerName = containerName; - ArtifactPath = artifactPath.FullPath; - ArtifactName = ArtifactPath.GetFilename().ToString(); - } -} diff --git a/build/credentials.cake b/build/credentials.cake deleted file mode 100644 index 31a3e6416c..0000000000 --- a/build/credentials.cake +++ /dev/null @@ -1,170 +0,0 @@ -public class BuildCredentials -{ - public GitHubCredentials GitHub { get; private set; } - public GitterCredentials Gitter { get; private set; } - public DockerHubCredentials Docker { get; private set; } - public NugetCredentials Nuget { get; private set; } - public ChocolateyCredentials Chocolatey { get; private set; } - public TfxCredentials Tfx { get; private set; } - public RubyGemCredentials RubyGem { get; private set; } - public CodeCovCredentials CodeCov { get; private set; } - - public static BuildCredentials GetCredentials(ICakeContext context) - { - return new BuildCredentials - { - GitHub = GitHubCredentials.GetGitHubCredentials(context), - Gitter = GitterCredentials.GetGitterCredentials(context), - Docker = DockerHubCredentials.GetDockerHubCredentials(context), - Nuget = NugetCredentials.GetNugetCredentials(context), - Chocolatey = ChocolateyCredentials.GetChocolateyCredentials(context), - Tfx = TfxCredentials.GetTfxCredentials(context), - RubyGem = RubyGemCredentials.GetRubyGemCredentials(context), - CodeCov = CodeCovCredentials.GetCodeCovCredentials(context), - }; - } -} - -public class GitHubCredentials -{ - public string UserName { get; private set; } - public string Password { get; private set; } - public string Token { get; private set; } - - public GitHubCredentials(string userName, string password, string token) - { - UserName = userName; - Password = password; - Token = token; - } - - public static GitHubCredentials GetGitHubCredentials(ICakeContext context) - { - return new GitHubCredentials( - context.EnvironmentVariable("GITHUB_USERNAME"), - context.EnvironmentVariable("GITHUB_PASSWORD"), - context.EnvironmentVariable("GITHUB_TOKEN")); - } -} - -public class GitterCredentials -{ - public string Token { get; private set; } - public string RoomId { get; private set; } - - public GitterCredentials(string token, string roomId) - { - Token = token; - RoomId = roomId; - } - - public static GitterCredentials GetGitterCredentials(ICakeContext context) - { - return new GitterCredentials( - context.EnvironmentVariable("GITTER_TOKEN"), - context.EnvironmentVariable("GITTER_ROOM_ID") - ); - } -} - -public class DockerHubCredentials -{ - public string UserName { get; private set; } - public string Password { get; private set; } - - public DockerHubCredentials(string userName, string password) - { - UserName = userName; - Password = password; - } - - public static DockerHubCredentials GetDockerHubCredentials(ICakeContext context) - { - return new DockerHubCredentials( - context.EnvironmentVariable("DOCKER_USERNAME"), - context.EnvironmentVariable("DOCKER_PASSWORD")); - } -} - -public class NugetCredentials -{ - public string ApiKey { get; private set; } - public string ApiUrl { get; private set; } - - public NugetCredentials(string apiKey, string apiUrl) - { - ApiKey = apiKey; - ApiUrl = apiUrl; - } - - public static NugetCredentials GetNugetCredentials(ICakeContext context) - { - return new NugetCredentials( - context.EnvironmentVariable("NUGET_API_KEY"), - context.EnvironmentVariable("NUGET_API_URL")); - } -} - -public class ChocolateyCredentials -{ - public string ApiKey { get; private set; } - public string ApiUrl { get; private set; } - - public ChocolateyCredentials(string apiKey, string apiUrl) - { - ApiKey = apiKey; - ApiUrl = apiUrl; - } - - public static ChocolateyCredentials GetChocolateyCredentials(ICakeContext context) - { - return new ChocolateyCredentials( - context.EnvironmentVariable("CHOCOLATEY_API_KEY"), - context.EnvironmentVariable("CHOCOLATEY_API_URL")); - } -} - -public class TfxCredentials -{ - public string Token { get; private set; } - - public TfxCredentials(string token) - { - Token = token; - } - - public static TfxCredentials GetTfxCredentials(ICakeContext context) - { - return new TfxCredentials(context.EnvironmentVariable("TFX_TOKEN")); - } -} - -public class RubyGemCredentials -{ - public string ApiKey { get; private set; } - - public RubyGemCredentials(string apiKey) - { - ApiKey = apiKey; - } - - public static RubyGemCredentials GetRubyGemCredentials(ICakeContext context) - { - return new RubyGemCredentials(context.EnvironmentVariable("RUBY_GEM_API_KEY")); - } -} - -public class CodeCovCredentials -{ - public string Token { get; private set; } - - public CodeCovCredentials(string token) - { - Token = token; - } - - public static CodeCovCredentials GetCodeCovCredentials(ICakeContext context) - { - return new CodeCovCredentials(context.EnvironmentVariable("CODECOV_TOKEN")); - } -} diff --git a/build/parameters.cake b/build/parameters.cake deleted file mode 100644 index 737d0d5994..0000000000 --- a/build/parameters.cake +++ /dev/null @@ -1,232 +0,0 @@ -#load "./paths.cake" -#load "./artifacts.cake" -#load "./credentials.cake" -#load "./version.cake" - -public class BuildParameters -{ - public string Target { get; private set; } - public string Configuration { get; private set; } - - public string NetCoreVersion { get; private set; } = "netcoreapp2.1"; - public string FullFxVersion { get; private set; } = "net461"; - - public bool EnabledUnitTests { get; private set; } - public bool EnabledPublishGem { get; private set; } - public bool EnabledPublishTfs { get; private set; } - public bool EnabledPublishNuget { get; private set; } - public bool EnabledPublishChocolatey { get; private set; } - public bool EnabledPublishDocker { get; private set; } - - public bool IsRunningOnUnix { get; private set; } - public bool IsRunningOnWindows { get; private set; } - public bool IsRunningOnLinux { get; private set; } - public bool IsRunningOnMacOS { get; private set; } - - public bool IsLocalBuild { get; private set; } - public bool IsRunningOnAppVeyor { get; private set; } - public bool IsRunningOnTravis { get; private set; } - public bool IsRunningOnAzurePipeline { get; private set; } - - public bool IsMainRepo { get; private set; } - public bool IsMainBranch { get; private set; } - public bool IsTagged { get; private set; } - public bool IsPullRequest { get; private set; } - - public DotNetCoreMSBuildSettings MSBuildSettings { get; private set; } - - public BuildCredentials Credentials { get; private set; } - public BuildVersion Version { get; private set; } - public BuildPaths Paths { get; private set; } - public BuildPackages Packages { get; private set; } - public BuildArtifacts Artifacts { get; private set; } - public Dictionary PackagesBuildMap { get; private set; } - - public bool IsStableRelease() => !IsLocalBuild && IsMainRepo && IsMainBranch && !IsPullRequest && IsTagged; - public bool IsPreRelease() => !IsLocalBuild && IsMainRepo && IsMainBranch && !IsPullRequest && !IsTagged; - - public bool CanPostToGitter => !string.IsNullOrWhiteSpace(Credentials.Gitter.Token) && !string.IsNullOrWhiteSpace(Credentials.Gitter.RoomId); - - public static BuildParameters GetParameters(ICakeContext context) - { - if (context == null) - { - throw new ArgumentNullException(nameof(context)); - } - - var target = context.Argument("target", "Default"); - var buildSystem = context.BuildSystem(); - - return new BuildParameters { - Target = target, - Configuration = context.Argument("configuration", "Release"), - - EnabledUnitTests = IsEnabled(context, "ENABLED_UNIT_TESTS"), - EnabledPublishGem = IsEnabled(context, "ENABLED_PUBLISH_GEM"), - EnabledPublishTfs = IsEnabled(context, "ENABLED_PUBLISH_TFS"), - EnabledPublishNuget = IsEnabled(context, "ENABLED_PUBLISH_NUGET"), - EnabledPublishChocolatey = IsEnabled(context, "ENABLED_PUBLISH_CHOCOLATEY"), - EnabledPublishDocker = IsEnabled(context, "ENABLED_PUBLISH_DOCKER"), - - IsRunningOnUnix = context.IsRunningOnUnix(), - IsRunningOnWindows = context.IsRunningOnWindows(), - IsRunningOnLinux = context.Environment.Platform.Family == PlatformFamily.Linux, - IsRunningOnMacOS = context.Environment.Platform.Family == PlatformFamily.OSX, - - IsLocalBuild = buildSystem.IsLocalBuild, - IsRunningOnAppVeyor = buildSystem.IsRunningOnAppVeyor, - IsRunningOnTravis = buildSystem.IsRunningOnTravisCI, - IsRunningOnAzurePipeline = buildSystem.IsRunningOnVSTS, - - IsMainRepo = IsOnMainRepo(context), - IsMainBranch = IsOnMainBranch(context), - IsPullRequest = IsPullRequestBuild(context), - IsTagged = IsBuildTagged(context), - }; - } - - public void Initialize(ICakeContext context, GitVersion gitVersion) - { - Version = BuildVersion.Calculate(context, this, gitVersion); - - Paths = BuildPaths.GetPaths(context, Configuration, Version); - - Packages = BuildPackages.GetPackages( - Paths.Directories.NugetRoot, - Version.SemVersion, - new [] { "GitVersion.CommandLine.DotNetCore", "GitVersion.CommandLine", "GitVersionCore", "GitVersionTask", "GitVersion.Tool" }, - new [] { "GitVersion.Portable" }); - - var files = Paths.Files; - Artifacts = BuildArtifacts.GetArtifacts(new[] { - files.ZipArtifactPathDesktop, - files.ZipArtifactPathCoreClr, - files.TestCoverageOutputFilePath, - files.ReleaseNotesOutputFilePath, - files.VsixOutputFilePath, - files.VsixNetCoreOutputFilePath, - files.GemOutputFilePath - }); - - PackagesBuildMap = new Dictionary - { - ["GitVersion.CommandLine.DotNetCore"] = Paths.Directories.ArtifactsBinNetCore, - ["GitVersion.CommandLine"] = Paths.Directories.ArtifactsBinFullFxCmdline, - ["GitVersion.Portable"] = Paths.Directories.ArtifactsBinFullFxPortable, - ["GitVersion.Tool"] = Paths.Directories.ArtifactsBinNetCore, - }; - - Credentials = BuildCredentials.GetCredentials(context); - - MSBuildSettings = GetMsBuildSettings(context, Version); - } - - private DotNetCoreMSBuildSettings GetMsBuildSettings(ICakeContext context, BuildVersion version) - { - var msBuildSettings = new DotNetCoreMSBuildSettings() - .WithProperty("Version", version.SemVersion) - .WithProperty("AssemblyVersion", version.Version) - .WithProperty("PackageVersion", version.SemVersion) - .WithProperty("FileVersion", version.Version); - - if(!IsRunningOnWindows) - { - var frameworkPathOverride = context.Environment.Runtime.IsCoreClr - ? new []{ - new DirectoryPath("/Library/Frameworks/Mono.framework/Versions/Current/lib/mono"), - new DirectoryPath("/usr/lib/mono"), - new DirectoryPath("/usr/local/lib/mono") - } - .Select(directory =>directory.Combine("4.5")) - .FirstOrDefault(directory => context.DirectoryExists(directory)) - ?.FullPath + "/" - : new FilePath(typeof(object).Assembly.Location).GetDirectory().FullPath + "/"; - - // Use FrameworkPathOverride when not running on Windows. - context.Information("Build will use FrameworkPathOverride={0} since not building on Windows.", frameworkPathOverride); - msBuildSettings.WithProperty("FrameworkPathOverride", frameworkPathOverride); - } - - return msBuildSettings; - } - - private static bool IsOnMainRepo(ICakeContext context) - { - var buildSystem = context.BuildSystem(); - string repositoryName = null; - if (buildSystem.IsRunningOnAppVeyor) - { - repositoryName = buildSystem.AppVeyor.Environment.Repository.Name; - } - else if (buildSystem.IsRunningOnTravisCI) - { - repositoryName = buildSystem.TravisCI.Environment.Repository.Slug; - } - else if (buildSystem.IsRunningOnVSTS) - { - repositoryName = buildSystem.TFBuild.Environment.Repository.RepoName; - } - - context.Information("Repository Name: {0}" , repositoryName); - - return !string.IsNullOrWhiteSpace(repositoryName) && StringComparer.OrdinalIgnoreCase.Equals("gittools/gitversion", repositoryName); - } - - private static bool IsOnMainBranch(ICakeContext context) - { - var buildSystem = context.BuildSystem(); - string repositoryBranch = null; - if (buildSystem.IsRunningOnAppVeyor) - { - repositoryBranch = buildSystem.AppVeyor.Environment.Repository.Branch; - } - else if (buildSystem.IsRunningOnTravisCI) - { - repositoryBranch = buildSystem.TravisCI.Environment.Build.Branch; - } - else if (buildSystem.IsRunningOnVSTS) - { - repositoryBranch = buildSystem.TFBuild.Environment.Repository.Branch; - } - - context.Information("Repository Branch: {0}" , repositoryBranch); - - return !string.IsNullOrWhiteSpace(repositoryBranch) && StringComparer.OrdinalIgnoreCase.Equals("master", repositoryBranch); - } - - private static bool IsPullRequestBuild(ICakeContext context) - { - var buildSystem = context.BuildSystem(); - if (buildSystem.IsRunningOnAppVeyor) - { - return buildSystem.AppVeyor.Environment.PullRequest.IsPullRequest; - } - if (buildSystem.IsRunningOnTravisCI) - { - var value = buildSystem.TravisCI.Environment.Repository.PullRequest; - return !string.IsNullOrWhiteSpace(value) && !string.Equals(value, false.ToString(), StringComparison.InvariantCultureIgnoreCase); - } - else if (buildSystem.IsRunningOnVSTS) - { - var value = context.EnvironmentVariable("SYSTEM_PULLREQUEST_ISFORK"); - return !string.IsNullOrWhiteSpace(value) && !string.Equals(value, false.ToString(), StringComparison.InvariantCultureIgnoreCase); - } - return false; - } - - private static bool IsBuildTagged(ICakeContext context) - { - var gitPath = context.Tools.Resolve(context.IsRunningOnWindows() ? "git.exe" : "git"); - context.StartProcess(gitPath, new ProcessSettings { Arguments = "rev-parse --verify HEAD", RedirectStandardOutput = true }, out var sha); - context.StartProcess(gitPath, new ProcessSettings { Arguments = "tag --points-at " + sha.Single(), RedirectStandardOutput = true }, out var redirectedOutput); - - return redirectedOutput.Any(); - } - - private static bool IsEnabled(ICakeContext context, string envVar, bool nullOrEmptyAsEnabled = true) - { - var value = context.EnvironmentVariable(envVar); - - return string.IsNullOrWhiteSpace(value) ? nullOrEmptyAsEnabled : bool.Parse(value); - } -} diff --git a/build/paths.cake b/build/paths.cake deleted file mode 100644 index 52591d9429..0000000000 --- a/build/paths.cake +++ /dev/null @@ -1,161 +0,0 @@ -public class BuildPaths -{ - public BuildFiles Files { get; private set; } - public BuildDirectories Directories { get; private set; } - - public static BuildPaths GetPaths( - ICakeContext context, - string configuration, - BuildVersion version - ) - { - if (context == null) - { - throw new ArgumentNullException(nameof(context)); - } - if (string.IsNullOrEmpty(configuration)) - { - throw new ArgumentNullException(nameof(configuration)); - } - if (version == null) - { - throw new ArgumentNullException(nameof(version)); - } - - var semVersion = version.SemVersion; - - var artifactsDir = (DirectoryPath)(context.Directory("./artifacts") + context.Directory("v" + semVersion)); - var artifactsBinDir = artifactsDir.Combine("bin"); - var artifactsBinFullFxDir = artifactsBinDir.Combine("net461"); - var artifactsBinFullFxILMergeDir = artifactsBinFullFxDir.Combine("il-merge"); - var artifactsBinFullFxPortableDir = artifactsBinFullFxDir.Combine("portable"); - var artifactsBinFullFxCmdlineDir = artifactsBinFullFxDir.Combine("cmdline"); - var artifactsBinNetCoreDir = artifactsBinDir.Combine("netcoreapp2.0"); - var nugetRootDir = artifactsDir.Combine("nuget"); - var buildArtifactDir = artifactsDir.Combine("build-artifact"); - var testCoverageOutputDir = artifactsDir.Combine("code-coverage"); - - var zipArtifactPathCoreClr = artifactsDir.CombineWithFilePath("GitVersion-bin-coreclr-v" + semVersion + ".zip"); - var zipArtifactPathDesktop = artifactsDir.CombineWithFilePath("GitVersion-bin-fullfx-v" + semVersion + ".zip"); - - var testCoverageOutputFilePath = testCoverageOutputDir.CombineWithFilePath("TestResult.xml"); - - var releaseNotesOutputFilePath = buildArtifactDir.CombineWithFilePath("releasenotes.md"); - var gemOutputFilePath = buildArtifactDir.CombineWithFilePath("gitversion-" + version.GemVersion + ".gem"); - var vsixOutputFilePath = buildArtifactDir.CombineWithFilePath("gittools.gitversion-" + semVersion + ".vsix"); - var vsixNetCoreOutputFilePath = buildArtifactDir.CombineWithFilePath("gittools.gitversion-netcore-" + semVersion + ".vsix"); - - // Directories - var buildDirectories = new BuildDirectories( - artifactsDir, - buildArtifactDir, - testCoverageOutputDir, - nugetRootDir, - artifactsBinDir, - artifactsBinFullFxDir, - artifactsBinFullFxPortableDir, - artifactsBinFullFxCmdlineDir, - artifactsBinFullFxILMergeDir, - artifactsBinNetCoreDir); - - // Files - var buildFiles = new BuildFiles( - context, - zipArtifactPathCoreClr, - zipArtifactPathDesktop, - testCoverageOutputFilePath, - releaseNotesOutputFilePath, - vsixOutputFilePath, - vsixNetCoreOutputFilePath, - gemOutputFilePath); - - return new BuildPaths - { - Files = buildFiles, - Directories = buildDirectories - }; - } -} - -public class BuildFiles -{ - public FilePath ZipArtifactPathCoreClr { get; private set; } - public FilePath ZipArtifactPathDesktop { get; private set; } - public FilePath TestCoverageOutputFilePath { get; private set; } - public FilePath ReleaseNotesOutputFilePath { get; private set; } - public FilePath VsixOutputFilePath { get; private set; } - public FilePath VsixNetCoreOutputFilePath { get; private set; } - public FilePath GemOutputFilePath { get; private set; } - - public BuildFiles( - ICakeContext context, - FilePath zipArtifactPathCoreClr, - FilePath zipArtifactPathDesktop, - FilePath testCoverageOutputFilePath, - FilePath releaseNotesOutputFilePath, - FilePath vsixOutputFilePath, - FilePath vsixNetCoreOutputFilePath, - FilePath gemOutputFilePath - ) - { - ZipArtifactPathCoreClr = zipArtifactPathCoreClr; - ZipArtifactPathDesktop = zipArtifactPathDesktop; - TestCoverageOutputFilePath = testCoverageOutputFilePath; - ReleaseNotesOutputFilePath = releaseNotesOutputFilePath; - VsixOutputFilePath = vsixOutputFilePath; - VsixNetCoreOutputFilePath = vsixNetCoreOutputFilePath; - GemOutputFilePath = gemOutputFilePath; - } -} - -public class BuildDirectories -{ - public DirectoryPath Artifacts { get; private set; } - public DirectoryPath NugetRoot { get; private set; } - public DirectoryPath BuildArtifact { get; private set; } - public DirectoryPath TestCoverageOutput { get; private set; } - public DirectoryPath ArtifactsBin { get; private set; } - public DirectoryPath ArtifactsBinFullFx { get; private set; } - public DirectoryPath ArtifactsBinFullFxPortable { get; private set; } - public DirectoryPath ArtifactsBinFullFxCmdline { get; private set; } - public DirectoryPath ArtifactsBinFullFxILMerge { get; private set; } - public DirectoryPath ArtifactsBinNetCore { get; private set; } - public ICollection ToClean { get; private set; } - - public BuildDirectories( - DirectoryPath artifactsDir, - DirectoryPath buildArtifactDir, - DirectoryPath testCoverageOutputDir, - DirectoryPath nugetRootDir, - DirectoryPath artifactsBinDir, - DirectoryPath artifactsBinFullFxDir, - DirectoryPath artifactsBinFullFxPortableDir, - DirectoryPath artifactsBinFullFxCmdlineDir, - DirectoryPath artifactsBinFullFxILMergeDir, - DirectoryPath artifactsBinNetCoreDir - ) - { - Artifacts = artifactsDir; - BuildArtifact = buildArtifactDir; - TestCoverageOutput = testCoverageOutputDir; - NugetRoot = nugetRootDir; - ArtifactsBin = artifactsBinDir; - ArtifactsBinFullFx = artifactsBinFullFxDir; - ArtifactsBinFullFxPortable = artifactsBinFullFxPortableDir; - ArtifactsBinFullFxCmdline = artifactsBinFullFxCmdlineDir; - ArtifactsBinFullFxILMerge = artifactsBinFullFxILMergeDir; - ArtifactsBinNetCore = artifactsBinNetCoreDir; - ToClean = new[] { - Artifacts, - BuildArtifact, - TestCoverageOutput, - NugetRoot, - ArtifactsBin, - ArtifactsBinFullFx, - ArtifactsBinFullFxPortable, - ArtifactsBinFullFxCmdline, - ArtifactsBinFullFxILMerge, - ArtifactsBinNetCore - }; - } -} diff --git a/build/tmpl/jobs.yml b/build/tmpl/jobs.yml deleted file mode 100644 index 3a5e583a25..0000000000 --- a/build/tmpl/jobs.yml +++ /dev/null @@ -1,21 +0,0 @@ -parameters: - name: '' # defaults for any parameters that aren't specified - vmImage: '' - installRuby: 'true' -jobs: -- job: ${{ parameters.name }} - pool: - vmImage: ${{ parameters.vmImage }} - steps: - - task: DotNetCoreInstaller@0 - displayName: 'Use .NET Core sdk $(DOTNET_SDK_VERSION)' - inputs: - version: $(DOTNET_SDK_VERSION) - packageType: $(DOTNET_PACKAGE_TYPE) - - ${{ if eq(parameters.installRuby, 'true') }}: - - task: UseRubyVersion@0 - inputs: - versionSpec: $(RUBY_VERSION) - addToPath: true # Optional - - powershell: ./build.ps1 -script build.cake -target Default - displayName: 'Cake build' diff --git a/build/utils.cake b/build/utils.cake deleted file mode 100644 index 80d74c4a7d..0000000000 --- a/build/utils.cake +++ /dev/null @@ -1,203 +0,0 @@ - -FilePath FindToolInPath(string tool) -{ - var pathEnv = EnvironmentVariable("PATH"); - if (string.IsNullOrEmpty(pathEnv) || string.IsNullOrEmpty(tool)) return tool; - - var paths = pathEnv.Split(new []{ IsRunningOnUnix() ? ':' : ';'}, StringSplitOptions.RemoveEmptyEntries); - return paths.Select(path => new DirectoryPath(path).CombineWithFilePath(tool)).FirstOrDefault(filePath => FileExists(filePath.FullPath)); -} - -DirectoryPath HomePath() -{ - return IsRunningOnWindows() - ? new DirectoryPath(EnvironmentVariable("HOMEDRIVE") + EnvironmentVariable("HOMEPATH")) - : new DirectoryPath(EnvironmentVariable("HOME")); -} - -void ReplaceTextInFile(FilePath filePath, string oldValue, string newValue, bool encrypt = false) -{ - Information("Replacing {0} with {1} in {2}", oldValue, !encrypt ? newValue : "******", filePath); - var file = filePath.FullPath.ToString(); - System.IO.File.WriteAllText(file, System.IO.File.ReadAllText(file).Replace(oldValue, newValue)); -} - -void SetRubyGemPushApiKey(string apiKey) -{ - // it's a hack, creating a credentials file to be able to push the gem - var workDir = "./src/GitVersionRubyGem"; - var gemHomeDir = HomePath().Combine(".gem"); - var credentialFile = new FilePath(workDir + "/credentials"); - EnsureDirectoryExists(gemHomeDir); - ReplaceTextInFile(credentialFile, "$api_key$", apiKey, true); - CopyFileToDirectory(credentialFile, gemHomeDir); -} - -GitVersion GetVersion(BuildParameters parameters) -{ - var dllFile = GetFiles($"**/GitVersionExe/bin/{parameters.Configuration}/{parameters.NetCoreVersion}/GitVersion.dll").FirstOrDefault(); - var settings = new GitVersionSettings - { - OutputType = GitVersionOutput.Json, - ToolPath = FindToolInPath(IsRunningOnUnix() ? "dotnet" : "dotnet.exe"), - ArgumentCustomization = args => dllFile + " " + args.Render() - }; - - var gitVersion = GitVersion(settings); - - if (!parameters.IsLocalBuild && !(parameters.IsRunningOnAzurePipeline && parameters.IsPullRequest)) - { - settings.UpdateAssemblyInfo = true; - settings.LogFilePath = "console"; - settings.OutputType = GitVersionOutput.BuildServer; - - GitVersion(settings); - } - return gitVersion; -} - -void Build(string configuration) -{ - DotNetCoreRestore("./src/GitVersion.sln"); - MSBuild("./src/GitVersion.sln", settings => - { - settings.SetConfiguration(configuration) - .SetVerbosity(Verbosity.Minimal) - .WithTarget("Build") - .WithProperty("POSIX", IsRunningOnUnix().ToString()); - }); -} - -void ILRepackGitVersionExe(bool includeLibGit2Sharp, DirectoryPath target, DirectoryPath ilMerge, string configuration, string dotnetVersion) -{ - var exeName = "GitVersion.exe"; - var keyFilePath = "./src/key.snk"; - - var targetDir = target + "/"; - var ilMergeDir = ilMerge + "/"; - var targetPath = targetDir + exeName; - string outFilePath = ilMergeDir + exeName; - - CleanDirectory(ilMergeDir); - CreateDirectory(ilMergeDir); - - 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 }; - - if (IsRunningOnUnix()) - { - var libFolder = GetDirectories($"**/GitVersionExe/bin/{configuration}/{dotnetVersion}").FirstOrDefault(); - settings.Libs = new List { libFolder }; - } - - ILRepack(outFilePath, targetPath, sourceFiles, settings); - - CopyFileToDirectory("./LICENSE", ilMergeDir); - CopyFileToDirectory(targetDir + "GitVersion.pdb", ilMergeDir); - - Information("Copying libgit2sharp files.."); - - if (!includeLibGit2Sharp) { - CopyFileToDirectory(targetDir + "LibGit2Sharp.dll", ilMergeDir); - } - CopyFileToDirectory(targetDir + "LibGit2Sharp.dll.config", ilMergeDir); - CopyDirectory(targetDir + "/lib/", ilMergeDir + "/lib/"); -} - -void PublishILRepackedGitVersionExe(bool includeLibGit2Sharp, DirectoryPath targetDir, DirectoryPath ilMergDir, DirectoryPath outputDir, string configuration, string dotnetVersion) -{ - ILRepackGitVersionExe(includeLibGit2Sharp, targetDir, ilMergDir, configuration, dotnetVersion); - CopyDirectory(ilMergDir, outputDir); - - if (includeLibGit2Sharp) { - CopyFiles("./src/GitVersionExe/NugetAssets/*.ps1", outputDir); - } - - // Copy license & Copy GitVersion.XML (since publish does not do this anymore) - CopyFileToDirectory("./LICENSE", outputDir); - CopyFileToDirectory("./src/GitVersionExe/bin/" + configuration + "/" + dotnetVersion + "/GitVersion.xml", outputDir); -} - -void DockerBuild(string platform, string variant, BuildParameters parameters) -{ - var workDir = DirectoryPath.FromString($"./src/Docker/{platform}/{variant}"); - - var sourceDir = variant == "dotnetcore" - ? parameters.Paths.Directories.ArtifactsBinNetCore.Combine("tools") - : parameters.Paths.Directories.ArtifactsBinFullFxCmdline.Combine("tools"); - - CopyDirectory(sourceDir, workDir.Combine("content")); - - var tags = GetDockerTags(platform, variant, parameters); - - var buildSettings = new DockerImageBuildSettings - { - Rm = true, - Tag = tags, - File = $"{workDir}/Dockerfile", - BuildArg = new []{ $"contentFolder=/content" }, - // Pull = true, - // Platform = platform // TODO this one is not supported on docker versions < 18.02 - }; - - DockerBuild(buildSettings, workDir.ToString()); -} - -void DockerPush(string platform, string variant, BuildParameters parameters) -{ - var tags = GetDockerTags(platform, variant, parameters); - - foreach (var tag in tags) - { - DockerPush(tag); - } -} - -string[] GetDockerTags(string platform, string variant, BuildParameters parameters) { - var name = $"gittools/gitversion-{variant}"; - - var tags = new List { - $"{name}:{platform}", - $"{name}:{platform}-{parameters.Version.Version}" - }; - - tags.Add($"{name}:{platform}-{parameters.Version.SemVersion}"); - - if (variant == "dotnetcore" && parameters.IsStableRelease()) { - tags.Add($"{name}:latest"); - } - - return tags.ToArray(); -} - -void GetReleaseNotes(FilePath outputPath, DirectoryPath workDir, string repoToken) -{ - var toolPath = Context.Tools.Resolve("GitReleaseNotes.exe"); - - var arguments = new ProcessArgumentBuilder() - .Append(workDir.ToString()) - .Append("/OutputFile") - .Append(outputPath.ToString()) - .Append("/RepoToken") - .Append(repoToken); - - StartProcess(toolPath, new ProcessSettings { Arguments = arguments, RedirectStandardOutput = true }, out var redirectedOutput); - - Information(string.Join("\n", redirectedOutput)); -} - -void UpdateTaskVersion(FilePath taskJsonPath, GitVersion gitVersion) -{ - var taskJson = ParseJsonFromFile(taskJsonPath); - taskJson["version"]["Major"] = gitVersion.Major.ToString(); - taskJson["version"]["Minor"] = gitVersion.Minor.ToString(); - taskJson["version"]["Patch"] = gitVersion.Patch.ToString(); - SerializeJsonToPrettyFile(taskJsonPath, taskJson); -} diff --git a/build/version.cake b/build/version.cake deleted file mode 100644 index 32ee62cc74..0000000000 --- a/build/version.cake +++ /dev/null @@ -1,25 +0,0 @@ -public class BuildVersion -{ - public GitVersion GitVersion { get; private set; } - public string Version { get; private set; } - public string SemVersion { get; private set; } - public string GemVersion { get; private set; } - - public static BuildVersion Calculate(ICakeContext context, BuildParameters parameters, GitVersion gitVersion) - { - var version = gitVersion.MajorMinorPatch; - var semVersion = gitVersion.LegacySemVer; - - if (!string.IsNullOrWhiteSpace(gitVersion.BuildMetaData)) { - semVersion += "-" + gitVersion.BuildMetaData; - } - - return new BuildVersion - { - GitVersion = gitVersion, - Version = version, - SemVersion = semVersion, - GemVersion = semVersion.Replace("-", "."), - }; - } -} diff --git a/deploy.cake b/deploy.cake new file mode 100644 index 0000000000..c02b35b545 --- /dev/null +++ b/deploy.cake @@ -0,0 +1,280 @@ +#addin "nuget:https://www.nuget.org/api/v2?package=Cake.Json&version=1.0.2.13" +#addin "nuget:https://www.nuget.org/api/v2?package=Cake.Docker&version=0.7.7" + +var target = Argument("target", "Deploy"); +var tagOverride = Argument("TagOverride", ""); + +using System.Net; +using System.Linq; +using System.Collections.Generic; + +string Get(string url) +{ + var assetsRequest = WebRequest.CreateHttp(url); + assetsRequest.Method = "GET"; + assetsRequest.Accept = "application/vnd.github.v3+json"; + assetsRequest.UserAgent = "BuildScript"; + + using (var assetsResponse = assetsRequest.GetResponse()) + { + var assetsStream = assetsResponse.GetResponseStream(); + var assetsReader = new StreamReader(assetsStream); + var assetsBody = assetsReader.ReadToEnd(); + return assetsBody; + } +} + +Task("EnsureRequirements") + .Does(() => + { + // This allows us to test deployments locally.. + if (!string.IsNullOrWhiteSpace(tagOverride)) + { + tag = tagOverride; + return; + } + + if (!AppVeyor.IsRunningOnAppVeyor) + throw new Exception("Deployment should happen via appveyor"); + + var isTag = + AppVeyor.Environment.Repository.Tag.IsTag && + !string.IsNullOrWhiteSpace(AppVeyor.Environment.Repository.Tag.Name); + if (!isTag) + throw new Exception("Deployment should happen from a published GitHub release"); + }); + +var tag = ""; +Dictionary artifactLookup = null; +var publishingError = false; +Task("UpdateVersionInfo") + .IsDependentOn("EnsureRequirements") + .Does(() => + { + // Will not be empty if overriden + if (tag == "") + { + tag = AppVeyor.Environment.Repository.Tag.Name; + AppVeyor.UpdateBuildVersion(tag); + } + }); + +Task("DownloadGitHubReleaseArtifacts") + .IsDependentOn("UpdateVersionInfo") + .Does(() => + { + var assets_url = ParseJson(Get("https://api.github.com/repos/GitTools/GitVersion/releases/tags/" + tag)) + .GetValue("assets_url").Value(); + EnsureDirectoryExists("./releaseArtifacts"); + foreach(var asset in DeserializeJson(Get(assets_url))) + { + DownloadFile(asset.Value("browser_download_url"), "./releaseArtifacts/" + asset.Value("name")); + } + + // Turns .artifacts file into a lookup + artifactLookup = System.IO.File + .ReadAllLines("./releaseArtifacts/artifacts") + .Select(l => l.Split(':')) + .ToDictionary(v => v[0], v => v[1]); + + // 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("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"); } + }); + +Task("Publish-NuGetPackage") + .IsDependentOn("DownloadGitHubReleaseArtifacts") + .Does(() => +{ + NuGetPush( + "./releaseArtifacts/" + artifactLookup["NuGetRefBuild"], + 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-NuGetCommandLine") + .IsDependentOn("DownloadGitHubReleaseArtifacts") + .Does(() => +{ + NuGetPush( + "./releaseArtifacts/" + artifactLookup["NuGetCommandLineBuild"], + 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") + .Does(() => +{ + NuGetPush( + "./releaseArtifacts/" + artifactLookup["NuGetTaskBuild"], + 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-Chocolatey") + .IsDependentOn("DownloadGitHubReleaseArtifacts") + .Does(() => +{ + NuGetPush( + "./releaseArtifacts/" + artifactLookup["NuGetExeBuild"], + new NuGetPushSettings { + ApiKey = EnvironmentVariable("ChocolateyApiKey"), + Source = "https://chocolatey.org/api/v2/package" + }); +}) +.OnError(exception => +{ + Information("Publish-Chocolatey Task failed, but continuing with next Task..."); + publishingError = true; +}); + +Task("Publish-Gem") + .IsDependentOn("DownloadGitHubReleaseArtifacts") + .Does(() => +{ + var returnCode = StartProcess("cmd", new ProcessSettings + { + Arguments = " /c gem push ./releaseArtifacts/" + artifactLookup["GemBuild"] + " --key " + EnvironmentVariable("GemApiKey") + " && exit 0 || exit 1" + }); + + if (returnCode != 0) { + Information("Publish-Gem Task failed, but continuing with next Task..."); + publishingError = true; + } +}); + + +Task("Publish-VstsTask") + .IsDependentOn("DownloadGitHubReleaseArtifacts") + .Does(() => +{ + var returnCode = StartProcess("cmd", new ProcessSettings + { + Arguments = " /c tfx extension publish --vsix ./releaseArtifacts/" + artifactLookup["GitVersionTfsTaskBuild"] + " --no-prompt --auth-type pat --token " + EnvironmentVariable("MarketplaceApiKey") + " && exit 0 || exit 1" + }); + + if (returnCode != 0) { + Information("Publish-VstsTask Task failed, but continuing with next Task..."); + publishingError = true; + } +}); + + +Task("Publish-DockerImage") + .IsDependentOn("DownloadGitHubReleaseArtifacts") + .Does(() => +{ + var username = EnvironmentVariable("DOCKER_USERNAME"); + var password = EnvironmentVariable("DOCKER_PASSWORD"); + if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password)) + { + Warning("Skipping docker publish due to missing credentials"); + return; + } + + var returnCode = StartProcess("docker", new ProcessSettings + { + Arguments = "build . --build-arg GitVersionZip=" + artifactLookup["zip"] + " --tag gittools/gitversion:" + tag + }); + if (returnCode != 0) { + Information("Publish-DockerImage Task failed to build image, but continuing with next Task..."); + publishingError = true; + return; + } + + returnCode = StartProcess("docker", new ProcessSettings + { + Arguments = "run -v " + System.IO.Directory.GetCurrentDirectory() + ":/repo gittools/gitversion:" + tag + }); + if (returnCode != 0) { + Information("Publish-DockerImage Task failed to run built image, but continuing with next Task..."); + publishingError = true; + return; + } + + // Login to dockerhub + returnCode = StartProcess("docker", new ProcessSettings + { + Arguments = "login -u=\"" + username +"\" -p=\"" + password +"\"" + }); + if (returnCode != 0) { + Information("Publish-DockerImage Task failed to login, but continuing with next Task..."); + publishingError = true; + return; + } + + // Publish Tag + returnCode = StartProcess("docker", new ProcessSettings + { + Arguments = "push gittools/gitversion:" + tag + }); + if (returnCode != 0) { + Information("Publish-DockerImage Task failed push version tag, but continuing with next Task..."); + publishingError = true; + return; + } + + // Publish latest + returnCode = StartProcess("docker", new ProcessSettings + { + Arguments = "tag gittools/gitversion:" + tag + " gittools/gitversion:latest" + }); + if (returnCode != 0) { + Information("Publish-DockerImage Task failed latest tag, but continuing with next Task..."); + publishingError = true; + } + returnCode = StartProcess("docker", new ProcessSettings + { + Arguments = "push gittools/gitversion:latest" + }); + if (returnCode != 0) { + Information("Publish-DockerImage Task failed latest tag, but continuing with next Task..."); + publishingError = true; + } +}); + +Task("Deploy") + .IsDependentOn("Publish-NuGetPackage") + .IsDependentOn("Publish-NuGetCommandLine") + .IsDependentOn("Publish-MsBuildTask") + .IsDependentOn("Publish-Chocolatey") +// .IsDependentOn("Publish-Gem") + .IsDependentOn("Publish-VstsTask") + .IsDependentOn("Publish-DockerImage") + .Finally(() => +{ + if(publishingError) + { + throw new Exception("An error occurred during the publishing of Cake. All publishing tasks have been attempted."); + } +}); + +RunTarget(target); \ No newline at end of file diff --git a/deploy.ps1 b/deploy.ps1 new file mode 100644 index 0000000000..59f237466e --- /dev/null +++ b/deploy.ps1 @@ -0,0 +1,145 @@ +########################################################################## +# This is the Cake bootstrapper script for PowerShell. +# This file was downloaded from https://github.com/cake-build/resources +# Feel free to change this file to fit your needs. +########################################################################## + +<# + +.SYNOPSIS +This is a Powershell script to bootstrap a Cake build. + +.DESCRIPTION +This Powershell script will download NuGet if missing, restore NuGet tools (including Cake) +and execute your Cake build script with the parameters you provide. + +.PARAMETER Script +The build script to execute. +.PARAMETER Target +The build script target to run. +.PARAMETER Configuration +The build configuration to use. +.PARAMETER Verbosity +Specifies the amount of information to be displayed. +.PARAMETER Experimental +Tells Cake to use the latest Roslyn release. +.PARAMETER WhatIf +Performs a dry run of the build script. +No tasks will be executed. +.PARAMETER Mono +Tells Cake to use the Mono scripting engine. +.PARAMETER SkipToolPackageRestore +Skips restoring of packages. +.PARAMETER ScriptArgs +Remaining arguments are added here. + +.LINK +http://cakebuild.net + +#> + +[CmdletBinding()] +Param( + [string]$Script = "deploy.cake", + [string]$Target = "Deploy", + [string]$Configuration = "Release", + [ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")] + [string]$Verbosity = "Verbose", + [switch]$Experimental, + [Alias("DryRun","Noop")] + [switch]$WhatIf, + [switch]$Mono, + [switch]$SkipToolPackageRestore, + [Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)] + [string[]]$ScriptArgs +) + +Write-Host "Preparing to run build script..." + +$PSScriptRoot = split-path -parent $MyInvocation.MyCommand.Definition; +$TOOLS_DIR = Join-Path $PSScriptRoot "tools" +$NUGET_EXE = Join-Path $TOOLS_DIR "nuget.exe" +$NUGET_URL = "http://dist.nuget.org/win-x86-commandline/latest/nuget.exe" +$CAKE_EXE = Join-Path $TOOLS_DIR "Cake/Cake.exe" +$PACKAGES_CONFIG = Join-Path $TOOLS_DIR "packages.config" + +# Should we use mono? +$UseMono = ""; +if($Mono.IsPresent) { + Write-Verbose -Message "Using the Mono based scripting engine." + $UseMono = "-mono" +} + +# Should we use the new Roslyn? +$UseExperimental = ""; +if($Experimental.IsPresent -and !($Mono.IsPresent)) { + Write-Verbose -Message "Using experimental version of Roslyn." + $UseExperimental = "-experimental" +} + +# Is this a dry run? +$UseDryRun = ""; +if($WhatIf.IsPresent) { + $UseDryRun = "-dryrun" +} + +# Make sure tools folder exists +if ((Test-Path $PSScriptRoot) -and !(Test-Path $TOOLS_DIR)) { + Write-Verbose -Message "Creating tools directory..." + New-Item -Path $TOOLS_DIR -Type directory | out-null +} + +# Make sure that packages.config exist. +if (!(Test-Path $PACKAGES_CONFIG)) { + Write-Verbose -Message "Downloading packages.config..." + try { Invoke-WebRequest -Uri http://cakebuild.net/download/bootstrapper/packages -OutFile $PACKAGES_CONFIG } catch { + Throw "Could not download packages.config." + } +} + +# Try find NuGet.exe in path if not exists +if (!(Test-Path $NUGET_EXE)) { + Write-Verbose -Message "Trying to find nuget.exe in PATH..." + $existingPaths = $Env:Path -Split ';' | Where-Object { (![string]::IsNullOrEmpty($_)) -and (Test-Path $_) } + $NUGET_EXE_IN_PATH = Get-ChildItem -Path $existingPaths -Filter "nuget.exe" | Select -First 1 + if ($NUGET_EXE_IN_PATH -ne $null -and (Test-Path $NUGET_EXE_IN_PATH.FullName)) { + Write-Verbose -Message "Found in PATH at $($NUGET_EXE_IN_PATH.FullName)." + $NUGET_EXE = $NUGET_EXE_IN_PATH.FullName + } +} + +# Try download NuGet.exe if not exists +if (!(Test-Path $NUGET_EXE)) { + Write-Verbose -Message "Downloading NuGet.exe..." + try { + (New-Object System.Net.WebClient).DownloadFile($NUGET_URL, $NUGET_EXE) + } catch { + Throw "Could not download NuGet.exe." + } +} + +# Save nuget.exe path to environment to be available to child processed +$ENV:NUGET_EXE = $NUGET_EXE + +# Restore tools from NuGet? +if(-Not $SkipToolPackageRestore.IsPresent) { + Push-Location + Set-Location $TOOLS_DIR + Write-Verbose -Message "Restoring tools from NuGet..." + $NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -OutputDirectory `"$TOOLS_DIR`"" + if ($LASTEXITCODE -ne 0) { + Throw "An error occured while restoring NuGet tools." + } + Write-Verbose -Message ($NuGetOutput | out-string) + Pop-Location +} + +# Make sure that Cake has been installed. +if (!(Test-Path $CAKE_EXE)) { + Throw "Could not find Cake.exe at $CAKE_EXE" +} + +# Start Cake +Write-Host "Running build script..." +Invoke-Expression "& `"$CAKE_EXE`" `"$Script`" -target=`"$Target`" -configuration=`"$Configuration`" -verbosity=`"$Verbosity`" $UseMono $UseDryRun $UseExperimental $ScriptArgs" +exit $LASTEXITCODE diff --git a/docs/build-server-support/build-server/continua.md b/docs/build-server-support/build-server/continua.md index 156148479c..840eee9eff 100644 --- a/docs/build-server-support/build-server/continua.md +++ b/docs/build-server-support/build-server/continua.md @@ -1,45 +1,45 @@ -# Continua CI Setup - -This guide explains how to run GitVersion inside [Continua CI](https://www.finalbuilder.com/continua-ci). - -## Assumptions -This guide assumes a few variables are present in the configuration. Note that this example uses `Catel` as repository name, but it should be replaced by the name of the repository where GitVersion is runnign against. - -* RepositoryBranchName => $Source.Catel.BranchName$ -* RepositoryCommitId => $Source.Catel.LatestChangeset.Id$ -* RepositoryName => Catel -* RepositoryName => $Source.Catel.Path$ -* RepositoryUrl => $Source.Catel.Url$ - -It also requires a few variables which will automatically be filled by GitVersion. The example below are just a few, any of the GitVersion variables written to the output can be used. - -* GitVersion_FullSemVer -* GitVersion_MajorMinorPatch -* GitVersion_NuGetVersion - -You also need to add a property collector for the agents to detect the GitVersion tool on the agents: - -* Namespace => GitVersion -* Run On => Agent -* Type => Path Finder Plugin -* Property Name => Path -* Executable => GitVersion.exe -* Search paths => your installation folder (e.g. `C:\Tools\GitVersion` or if you are using Chocolatey `C:\ProgramData\chocolatey\lib\GitVersion.Portable\tools`) - -## Basic Usage -To run GitLink inside [Continua CI](https://www.finalbuilder.com/continua-ci), follow the steps below: - -* Add a new `Execute Program` step to a stage -* In the `Execute Program` tab, set the following values: - * Executable path: $Agent.GitVersion.Path$ - * Working directory: %RepositoryPath% -* In the `Arguments` tab, set the following values: - * Arguments: /url %RepositoryUrl% /b %RepositoryBranchName% /c %RepositoryCommitId% /output buildserver -* In the `Options` tab, set the following values: - * Wait for completion: checked - * Log output: checked - * Check program exit code: checked - * Exit code must be: equal to - * Exit code: 0 - -Now GitVersion will automatically run and fill the `GitVersion_` variables. +# Continua CI Setup + +This guide explains how to run GitVersion inside [Continua CI](https://www.finalbuilder.com/continua-ci). + +## Assumptions +This guide assumes a few variables are present in the configuration. Note that this example uses `Catel` as repository name, but it should be replaced by the name of the repository where GitVersion is runnign against. + +* RepositoryBranchName => $Source.Catel.BranchName$ +* RepositoryCommitId => $Source.Catel.LatestChangeset.Id$ +* RepositoryName => Catel +* RepositoryName => $Source.Catel.Path$ +* RepositoryUrl => $Source.Catel.Url$ + +It also requires a few variables which will automatically be filled by GitVersion. The example below are just a few, any of the GitVersion variables written to the output can be used. + +* GitVersion_FullSemVer +* GitVersion_MajorMinorPatch +* GitVersion_NuGetVersion + +You also need to add a property collector for the agents to detect the GitVersion tool on the agents: + +* Namespace => GitVersion +* Run On => Agent +* Type => Path Finder Plugin +* Property Name => Path +* Executable => GitVersion.exe +* Search paths => your installation folder (e.g. `C:\Tools\GitVersion` or if you are using Chocolatey `C:\ProgramData\chocolatey\lib\GitVersion.Portable\tools`) + +## Basic Usage +To run GitLink inside [Continua CI](https://www.finalbuilder.com/continua-ci), follow the steps below: + +* Add a new `Execute Program` step to a stage +* In the `Execute Program` tab, set the following values: + * Executable path: $Agent.GitVersion.Path$ + * Working directory: %RepositoryPath% +* In the `Arguments` tab, set the following values: + * Arguments: /url %RepositoryUrl% /b %RepositoryBranchName% /c %RepositoryCommitId% /output buildserver +* In the `Options` tab, set the following values: + * Wait for completion: checked + * Log output: checked + * Check program exit code: checked + * Exit code must be: equal to + * Exit code: 0 + +Now GitVersion will automatically run and fill the `GitVersion_` variables. diff --git a/docs/build-server-support/build-server/azure-devops b/docs/build-server-support/build-server/tfs-build-vnext.md similarity index 93% rename from docs/build-server-support/build-server/azure-devops rename to docs/build-server-support/build-server/tfs-build-vnext.md index 8378c44d4e..a1bff4667e 100644 --- a/docs/build-server-support/build-server/azure-devops +++ b/docs/build-server-support/build-server/tfs-build-vnext.md @@ -1,6 +1,6 @@ -# TFS Build or Azure DevOps Pipeline Setup +# Team Foundation Build (vNext) Setup ## Basic Usage -In Azure DevOps Pipeline (the web based build system) you can call GitVersion either using the Command Line build step or install an extension / custom build step. The custom build step requires a one-time setup to import the GitVersion task into your TFS or Azure DevOps Pipeline instance. +In Team Foundation Build (the web based build system) you can call GitVersion either using the Command Line build step or install an extension / custom build step. The custom build step requires a one-time setup to import the GitVersion task into your TFS or VSTS instance. ## Executing GitVersion ### Using GitVersion with the MSBuild Task NuGet Package @@ -14,7 +14,7 @@ See [MSBuild Task](/usage/msbuild-task) for further instructions how to use the 3. Set the Tool parameter to `\GitVersion.exe`. 4. Set the Arguments parameter to `/output buildserver /nofetch`. 5. If you want the GitVersionTask to update AssemblyInfo files add `updateAssemblyInfo true` to the Arguments parameter. -6. If you want to update the build number you need to send a [logging command](https://github.com/Microsoft/azure-pipelines-tasks/blob/master/docs/authoring/commands.md) to TFS. +6. If you want to update the build number you need to send a [logging command](https://github.com/Microsoft/vso-agent-tasks/blob/master/docs/authoring/commands.md) to TFS. ### Using the custom GitVersion build step #### Installing @@ -36,7 +36,7 @@ From a TFS build definition, select "Add a Step" and then in the Build category, If you want the GitVersionTask to update AssemblyInfo files, check the box in the task configuration. For advanced usage, you can pass additional options to the GitVersion exe in the Additional arguments section. -The Azure DevOps Pipeline build step can update your build number with GitVersion variables. See below for details. +The VSO build step can update your build number with GitVersion variables. See below for details. ## Running inside TFS @@ -68,6 +68,6 @@ Just checking the `Clean Repository` check box in the build definition settings You can force deletion of the whole folder and a re-clone containing all tags by settings the variable `Build.Clean` to `all`. This will take more time during build but makes sure that all tags are fetched. In the future it is planned to allow using `git.exe` instead of current `libgit2sharp` for syncing the repos which might allow other possibilities to solve this issue. -For details see this [GitHub issue](https://github.com/Microsoft/azure-pipelines-tasks/issues/1218). +For details see this [GitHub issue](https://github.com/Microsoft/vso-agent-tasks/issues/1218). * If running a build for a certain commit (through passing the commit SHA while queueing the build) all tags from the repository will be fetched, even the ones newer than the commit. This can lead to different version numbers while re-running historical builds. diff --git a/docs/configuration.md b/docs/configuration.md index f96b6ea4ee..c58116bb93 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -97,7 +97,7 @@ Sets the `mode` of how GitVersion should create a new version. Read more at ### increment The part of the SemVer to increment when GitVersion detects it needs to be increased, such as for commits after a tag: `Major`, `Minor`, `Patch`, `None`. -The special value `Inherit` means that GitVersion should find the parent branch (i.e. the branch where the current branch was branched from), and use its values for [increment](#increment), [prevent-increment-of-merged-branch-version](#prevent-increment-of-merged-branch-version) and [tracks-release-branches](#tracks-release-branches). +The special value `Inherit` means that GitVersion should find the parent branch (i.e. the branch where the current branch was branched from), and use its values for [increment](#increment), [prevent-increment-of-merged-branch-version](#prevent-increment-of-merged-branch-version) and [is-develop](#is-develop). ### continuous-delivery-fallback-tag When using `mode: ContinuousDeployment`, the value specified in @@ -189,7 +189,7 @@ If you have branch specific configuration upgrading to v4 will force you to upgr ```yaml branches: master: - regex: ^master + regex: master mode: ContinuousDelivery tag: '' increment: Patch @@ -198,7 +198,7 @@ branches: tracks-release-branches: false is-release-branch: false release: - regex: ^releases?[/-] + regex: releases?[/-] mode: ContinuousDelivery tag: beta increment: Patch @@ -207,7 +207,7 @@ branches: tracks-release-branches: false is-release-branch: true feature: - regex: ^features?[/-] + regex: features?[/-] mode: ContinuousDelivery tag: useBranchName increment: Inherit @@ -216,7 +216,7 @@ branches: tracks-release-branches: false is-release-branch: false pull-request: - regex: ^(pull|pull\-requests|pr)[/-] + regex: (pull|pull\-requests|pr)[/-] mode: ContinuousDelivery tag: PullRequest increment: Inherit @@ -226,7 +226,7 @@ branches: tracks-release-branches: false is-release-branch: false hotfix: - regex: ^hotfix(es)?[/-] + regex: hotfix(es)?[/-] mode: ContinuousDelivery tag: beta increment: Patch @@ -235,7 +235,7 @@ branches: tracks-release-branches: false is-release-branch: false support: - regex: ^support[/-] + regex: support[/-] mode: ContinuousDelivery tag: '' increment: Patch @@ -244,7 +244,7 @@ branches: tracks-release-branches: false is-release-branch: false develop: - regex: ^dev(elop)?(ment)?$ + regex: dev(elop)?(ment)?$ mode: ContinuousDeployment tag: unstable increment: Minor diff --git a/docs/img/release-1-deploy.png b/docs/img/release-1-deploy.png deleted file mode 100644 index 89783eb6c2..0000000000 Binary files a/docs/img/release-1-deploy.png and /dev/null differ diff --git a/docs/img/release-2-deploy.png b/docs/img/release-2-deploy.png deleted file mode 100644 index 244c19ac02..0000000000 Binary files a/docs/img/release-2-deploy.png and /dev/null differ diff --git a/docs/img/release-3-deploy.png b/docs/img/release-3-deploy.png deleted file mode 100644 index bee8032004..0000000000 Binary files a/docs/img/release-3-deploy.png and /dev/null differ diff --git a/docs/img/release-4-deploy.png b/docs/img/release-4-deploy.png deleted file mode 100644 index 1fb9f8e15a..0000000000 Binary files a/docs/img/release-4-deploy.png and /dev/null differ diff --git a/docs/more-info/how-it-works.md b/docs/more-info/how-it-works.md index 2a7369dfaa..6728424a52 100644 --- a/docs/more-info/how-it-works.md +++ b/docs/more-info/how-it-works.md @@ -1,37 +1,38 @@ # How it works GitVersion v3 works very differently to v2. Version 2 had knowledge of both GitFlow and GitHubFlow hard coded into it, with each branch having it's own class which calculated the version for that branch type. -v3 is driven by [configuration](../configuration.md), meaning most of the behaviors in GitVersion can be tweaked to work the way you want. This also makes it *much* more predictable and easier to diagnose when odd things are happening. +v3 is driven by [configuration](../configuration.md), meaning most of the behaviors in GitVersion can be tweaked to work the way you want. It also makes it *much* more predictable and easy to diagnose why odd things are happening. ## Architecture -GitVersion has three distinct steps for calculating versions in v3. +GitVersion has three distict steps for calculating versions in v3.0. -1. If the current commit is tagged, the tag is used and build metadata (excluding commit count) is added. The other two steps will not execute. +1. If the current commit is tagged, the tag is used and build metadata (Excluding commit count) is added. The other two steps will not execute 2. A set of strategies are evaluated to decide on the base version and some metadata about that version. These strategies include HighestReachableTag, NextVersionInConfig, MergedBranchWithVersion, VersionInBranchName etc. -3. The highest base version is selected, using that base version as the new version is calculated. +3. The highest base version is selected, using that base version the new version is calculated. Visually it looks something like this: ![Version Calculation](http://www.plantuml.com:80/plantuml/png/fLCxJyCm4DxzAsuib4P914i69De1CS38Vd6kYIN7ZcodK8aVp-KX6Y2fKCbY9NV-7lVb2WoOeoVOMRDNfH0lz1vUoNbbpGwrR3K6ws1p3rlk-bN8u972f2AC3GHEbLN8m1D1Jjg-mPuXAZvx9kL1ZW1KY5dOZczMI0Pf54VnHtf7jpaAWJg0sW-uXw4PK3Eb1sMaevfCW6i1_0m6po1l7HfPJUxvu5XYUOHLWq5MLptCudmMK9--u5glJ0dIEaVo1Dw3JgVM6Km4cM9mzyrQXHuQHnj7chhl0JcnIrHjno1wiWtgfi8eWVK_7OQAmBHrJWvORFVM2PmrE7AcWZGh-Lj0FvptVvLiUPnCdG_XhNhOov9wQ1fzv7nw5S5EwSvw6CDQNfnMwUAP0XQyQpj70nkx3Nn3p5NFY9IshbNWepKi8ublWFiSPkC0ee8El75Dv5aOxqZQBScbWpWn0Pe2wb6aM1p4Eea_0G00) [Edit Diagram](http://www.plantuml.com/plantuml/form?url=http://www.plantuml.com/plantuml/png/fLCxJyCm4DxzAsuib4P914i69De1CS38Vd6kYIN7ZcodK8aVp-KX6Y2fKCbY9NV-7lVb2WoOeoVOMRDNfH0lz1vUoNbbpGwrR3K6ws1p3rlk-bN8u972f2AC3GHEbLN8m1D1Jjg-mPuXAZvx9kL1ZW1KY5dOZczMI0Pf54VnHtf7jpaAWJg0sW-uXw4PK3Eb1sMaevfCW6i1_0m6po1l7HfPJUxvu5XYUOHLWq5MLptCudmMK9--u5glJ0dIEaVo1Dw3JgVM6Km4cM9mzyrQXHuQHnj7chhl0JcnIrHjno1wiWtgfi8eWVK_7OQAmBHrJWvORFVM2PmrE7AcWZGh-Lj0FvptVvLiUPnCdG_XhNhOov9wQ1fzv7nw5S5EwSvw6CDQNfnMwUAP0XQyQpj70nkx3Nn3p5NFY9IshbNWepKi8ublWFiSPkC0ee8El75Dv5aOxqZQBScbWpWn0Pe2wb6aM1p4Eea_0G00) -**\*** Some strategies allow the version to be incremented, others don't. More info below . -**+** This version is out of context with the rest of the example. It is here simply to show what happens if the check is true. +**\*** Some strategies allow the version to be incremented, others don't. More info below +**+** This version is out of context with the rest of the example. It is here just to show what happens if the check is true ### Base Version Strategies -Currently we have the following strategies: +Currently we have the following strategies - `HighestTagBaseVersionStrategy` - Finds the highest reachable tag from the current branch - - `VersionInBranchBaseVersionStrategy` - Extracts version information from the branch name (e.g., `release/3.0.0` will find `3.0.0`) + - `VersionInBranchBaseVersionStrategy` - Extracts version information from the branch name. eg `release/3.0.0` will find `3.0.0` - `ConfigNextVersionBaseVersionStrategy` - Returns the version from the GitVersion.yaml file - - `MergeMessageBaseVersionStrategy` - Finds version numbers from merge messages (e.g., `Merge 'release/3.0.0' into 'master'` will return `3.0.0`) + - `MergeMessageBaseVersionStrategy` - Finds version numbers from merge messages. eg. `Merge 'release/3.0.0' into 'master'` will return `3.0.0` - `FallbackBaseVersionStrategy` - Always returns 0.1.0 for new repositories -Each strategy needs to return an instance of `BaseVersion` which has the following properties: +Each strategy needs to return an instance of `BaseVersion` which has the following properties - - `Source` - Description of the source (e.g., `Merge message 'Merge 'release/3.0.0' into 'master'`) - - `ShouldIncrement` - Some strategies should have the version incremented, others do not (e.g., `ConfigNextVersionBaseVersionStrategy` returns false, `HighestTagBaseVersionStrategy` returns true) + - `Source` - Description of the source. eg `Merge message 'Merge 'release/3.0.0' into 'master'' + - `ShouldIncrement` - Some strategies should have the version incremented, others do not. eg `ConfigNextVersionBaseVersionStrategy` returns false, `HighestTagBaseVersionStrategy` returns true - `SemanticVersion` - SemVer of the base version strategy - - `BaseVersionSource` - SHA hash of the source. Commits will be counted from this hash. Can be null (e.g., `ConfigNextVersionBaseVersionStrategy` returns null). - - `BranchNameOverride` - When `useBranchName` or `{BranchName}` is used in the tag configuration, this allows the branch name to be changed by a base version. `VersionInBranchBaseVersionStrategy` uses this to strip out anything before the first `-` or `/.` so `foo` ends up being evaluated as `foo`. If in doubt, just use null. + - `BaseVersionSource` - Sha of the source. Commits will be counted from this Sha. Can be null (eg ConfigNextVersionBaseVersionStrategy returns null) + - `BranchNameOverride` - When `useBranchName` or `{BranchName}` is used in the tag configuration, this allows the branch name to be changed by a base version. + VersionInBranchBaseVersionStrategy uses this to strip out anything before the first - or /. So `foo` ends up being evaluated as `foo`. If in doubt, just use null diff --git a/docs/more-info/variables.md b/docs/more-info/variables.md index 8fc170b963..8c955605ed 100644 --- a/docs/more-info/variables.md +++ b/docs/more-info/variables.md @@ -24,7 +24,6 @@ For the `release/3.0.0` branch of GitVersion it shows: "InformationalVersion":"3.0.0-beta.1+1.Branch.release/3.0.0.Sha.28c853159a46b5a87e6cc9c4f6e940c59d6bc68a", "BranchName":"release/3.0.0", "Sha":"28c853159a46b5a87e6cc9c4f6e940c59d6bc68a", - "ShortSha":"28c8531", "NuGetVersionV2":"3.0.0-beta0001", "NuGetVersion":"3.0.0-beta0001", "NuGetPreReleaseTagV2":"beta0001", diff --git a/docs/usage/command-line.md b/docs/usage/command-line.md index dc61f9a66d..2c19f8b6d4 100644 --- a/docs/usage/command-line.md +++ b/docs/usage/command-line.md @@ -80,5 +80,8 @@ It will not change config file 'GitVersion.yml'. ### Example: How to override configuration option 'tag-prefix' to use prefix 'custom' `GitVersion.exe /output json /overrideconfig tag-prefix=custom` +## Writing version metadata in WiX format +To support integration with WiX projects, use `GitVersion.exe /updatewixversionfile`. All the [variables](../more-info/variables.md) are written to `GitVersion_WixVersion.wxi` under the current working directory and can be referenced in the WiX project files. + ## Mono To use on mac or linux, install `mono-complete` then just run `mono GitVersion.exe` diff --git a/mkdocs.yml b/mkdocs.yml index 21f8b1a85d..53f4e45624 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -23,7 +23,7 @@ pages: - Octopus Deploy: build-server-support/build-server/octopus-deploy.md - TeamCity: build-server-support/build-server/teamcity.md - Team Build (TFS): build-server-support/build-server/teambuild.md - - TFS Build vNext: build-server-support/build-server/azure-devops.md + - TFS Build vNext: build-server-support/build-server/tfs-build-vnext.md - Examples: examples.md - FAQ: faq.md - Why?: why.md diff --git a/nuspec/GitVersion.CommandLine.DotNetCore.nuspec b/nuspec/GitVersion.CommandLine.DotNetCore.nuspec deleted file mode 100644 index 1d2f88fd90..0000000000 --- a/nuspec/GitVersion.CommandLine.DotNetCore.nuspec +++ /dev/null @@ -1,19 +0,0 @@ - - - - GitVersion.CommandLine.DotNetCore - $version$ - GitVersion.CommandLine.DotNetCore - GitTools and Contributors - GitTools and Contributors - MIT - https://github.com/GitTools/GitVersion - https://raw.githubusercontent.com/GitTools/GitVersion/master/docs/img/package_icon.png - false - Derives SemVer information from a repository following GitFlow or GitHubFlow. - en-AU - Git Versioning GitVersion GitFlowVersion GitFlow GitHubFlow SemVer - true - https://github.com/GitTools/GitVersion/releases - - diff --git a/nuspec/LICENSE.txt b/nuspec/LICENSE.txt deleted file mode 100644 index 7e5992d6cf..0000000000 --- a/nuspec/LICENSE.txt +++ /dev/null @@ -1,20 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2013 NServiceBus Ltd - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/nuspec/VERIFICATION.txt b/nuspec/VERIFICATION.txt deleted file mode 100644 index bd0489649b..0000000000 --- a/nuspec/VERIFICATION.txt +++ /dev/null @@ -1,7 +0,0 @@ -VERIFICATION -Verification is intended to assist the Chocolatey moderators and community -in verifying that this package's contents are trustworthy. - -This package is published by the GitTools organization itself. The binaries are -identical to other package types published by the project, in particular -the GitVersion.Portable nuget package. diff --git a/nuspec/chocolateyInstall.ps1 b/nuspec/chocolateyInstall.ps1 deleted file mode 100644 index 6227375d8b..0000000000 --- a/nuspec/chocolateyInstall.ps1 +++ /dev/null @@ -1 +0,0 @@ -Generate-BinFile "gv" "$packageFolder\Tools\GitVersion.exe" diff --git a/src/.nuget/NuGet.exe b/src/.nuget/NuGet.exe new file mode 100644 index 0000000000..c41a0d0deb Binary files /dev/null and b/src/.nuget/NuGet.exe differ diff --git a/src/Directory.Build.props b/src/Directory.Build.props deleted file mode 100644 index 8280b500df..0000000000 --- a/src/Directory.Build.props +++ /dev/null @@ -1,22 +0,0 @@ - - - $(MSBuildThisFileDirectory)obj\$(MSBuildProjectName)\ - - GitTools and Contributors - https://github.com/GitTools/GitVersion - false - Git;Versioning;GitVersion;GitFlowVersion;GitFlow;GitHubFlow;SemVer - Copyright GitTools 2019. - MIT - https://raw.githubusercontent.com/GitTools/GitVersion/master/docs/img/package_icon.png - https://github.com/GitTools/GitVersion/releases - $(Authors) - - - - 0.25.0-preview-0033 - [1.0.185] - 2018.3.0 - 5.4.0 - - diff --git a/src/Docker/Readme.md b/src/Docker/Readme.md deleted file mode 100644 index 6aecca9f86..0000000000 --- a/src/Docker/Readme.md +++ /dev/null @@ -1,16 +0,0 @@ -# There are 4 variants of docker image : - -- based on **microsoft/dotnet-framework:4.7.2-runtime** - Windows Full FX -- based on **microsoft/dotnet:2.1-runtime** - Windows dotnet core -- based on **microsoft/dotnet-framework:4.7.2-runtime** - linux Full FX - on mono -- based on **microsoft/dotnet:2.1-runtime** - linux dotnet core - -To run on windows container run this -`docker run --rm -v "$(pwd):c:/repo" gittools/gitversion-fullfx:windows-4.0.0 c:/repo` - -`docker run --rm -v "$(pwd):c:/repo" gittools/gitversion-dotnetcore:windows-4.0.0 c:/repo` - -To run on linux container run this -`docker run --rm -v "$(pwd):/repo" gittools/gitversion-fullfx:linux-4.0.0 /repo` - -`docker run --rm -v "$(pwd):/repo" gittools/gitversion-dotnetcore:linux-4.0.0 /repo` diff --git a/src/Docker/linux/dotnetcore/Dockerfile b/src/Docker/linux/dotnetcore/Dockerfile deleted file mode 100644 index 8e68835390..0000000000 --- a/src/Docker/linux/dotnetcore/Dockerfile +++ /dev/null @@ -1,12 +0,0 @@ -FROM microsoft/dotnet:2.1-runtime -LABEL maintainers="GitTools Maintainers" -ARG contentFolder - -RUN apt-get update && \ - apt-get install -y libgit2-dev && \ - ln -s /usr/lib/x86_64-linux-gnu/libgit2.so /lib/x86_64-linux-gnu/libgit2-15e1193.so - -WORKDIR /app -COPY $contentFolder/ ./ - -ENTRYPOINT ["dotnet", "GitVersion.dll"] diff --git a/src/Docker/linux/fullfx/Dockerfile b/src/Docker/linux/fullfx/Dockerfile deleted file mode 100644 index 441c78954c..0000000000 --- a/src/Docker/linux/fullfx/Dockerfile +++ /dev/null @@ -1,12 +0,0 @@ -FROM mono:5.14 -LABEL maintainers="GitTools Maintainers" -ARG contentFolder - -RUN apt-get update && \ - apt-get install -y libgit2-dev && \ - ln -s /usr/lib/x86_64-linux-gnu/libgit2.so /lib/x86_64-linux-gnu/libgit2-15e1193.so - -WORKDIR /app -COPY $contentFolder/ ./ - -ENTRYPOINT ["mono", "GitVersion.exe"] diff --git a/src/Docker/windows/dotnetcore/Dockerfile b/src/Docker/windows/dotnetcore/Dockerfile deleted file mode 100644 index 5722953251..0000000000 --- a/src/Docker/windows/dotnetcore/Dockerfile +++ /dev/null @@ -1,8 +0,0 @@ -FROM microsoft/dotnet:2.1-runtime -LABEL maintainers="GitTools Maintainers" -ARG contentFolder - -WORKDIR /app -COPY $contentFolder/ ./ - -ENTRYPOINT ["dotnet", "GitVersion.dll"] diff --git a/src/Docker/windows/fullfx/Dockerfile b/src/Docker/windows/fullfx/Dockerfile deleted file mode 100644 index 2099bfd8ff..0000000000 --- a/src/Docker/windows/fullfx/Dockerfile +++ /dev/null @@ -1,8 +0,0 @@ -FROM microsoft/dotnet-framework:4.7.2-runtime -LABEL maintainers="GitTools Maintainers" -ARG contentFolder - -WORKDIR /app -COPY $contentFolder/ ./ - -ENTRYPOINT ["GitVersion.exe"] diff --git a/src/DockerBase/Dockerfile b/src/DockerBase/Dockerfile new file mode 100644 index 0000000000..39d3fcc5c8 --- /dev/null +++ b/src/DockerBase/Dockerfile @@ -0,0 +1,23 @@ +FROM ubuntu:16.04 + +MAINTAINER GitTools Maintainers + +# moviong the timezone setting at the top, as this may be the most infrequent change in this file +RUN ln -sfn /usr/share/zoneinfo/GMT /etc/localtime + +# Following current install guide from +# http://www.mono-project.com/download/#download-lin on 2017-12-08 +# regarding to the repository sources +RUN echo "deb http://download.mono-project.com/repo/ubuntu xenial main" |\ + tee /etc/apt/sources.list.d/mono-official.list + +# This will do: +# * Accept the repository key +# * Get the current package inventory state +# * Install given packages only with required dependencies +# * Cleanup to reduce Docker image size +RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF &&\ + apt-get update &&\ + apt-get -y --no-install-recommends install libcurl3 tzdata unzip curl git-all mono-complete &&\ + apt-get -yqq clean &&\ + rm -rf /var/lib/apt/lists/* /tmp/* diff --git a/src/DockerBase/readme b/src/DockerBase/readme new file mode 100644 index 0000000000..a4c2d0b2ff --- /dev/null +++ b/src/DockerBase/readme @@ -0,0 +1,6 @@ +# Docker Base +We need a custom docker base image because mono is too old to support libgit2sharp + +## To build/publish +docker build . --tag gittools/libgit2sharp-mono +docker push gittools/libgit2sharp-mono \ No newline at end of file diff --git a/src/GitVersion.sln b/src/GitVersion.sln index cde2bbebeb..6af6252047 100644 --- a/src/GitVersion.sln +++ b/src/GitVersion.sln @@ -1,12 +1,15 @@ + Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.27130.2024 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GitVersionExe", "GitVersionExe\GitVersionExe.csproj", "{C3578A7B-09A6-4444-9383-0DEAFA4958BD}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitVersionExe", "GitVersionExe\GitVersionExe.csproj", "{C3578A7B-09A6-4444-9383-0DEAFA4958BD}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GitVersionTask.Tests", "GitVersionTask.Tests\GitVersionTask.Tests.csproj", "{5A86453B-96FB-4B6E-A283-225BB9F753D3}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitVersionTask.Tests", "GitVersionTask.Tests\GitVersionTask.Tests.csproj", "{5A86453B-96FB-4B6E-A283-225BB9F753D3}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GitVersionCore.Tests", "GitVersionCore.Tests\GitVersionCore.Tests.csproj", "{BF905F84-382C-440D-92F5-C61108626D8D}" +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}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{3EFFC5D6-88D0-49D9-BB53-E1B7EB49DD45}" ProjectSection(SolutionItems) = preProject @@ -14,53 +17,32 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution ..\.gitignore = ..\.gitignore ..\.travis.yml = ..\.travis.yml ..\appveyor.yml = ..\appveyor.yml - ..\azure-pipelines.yml = ..\azure-pipelines.yml ..\BREAKING CHANGES.md = ..\BREAKING CHANGES.md ..\build.cake = ..\build.cake ..\build.ps1 = ..\build.ps1 + ..\build.sh = ..\build.sh ..\CONTRIBUTING.md = ..\CONTRIBUTING.md - Directory.Build.props = Directory.Build.props + ..\deploy.cake = ..\deploy.cake ..\GitVersion.yml = ..\GitVersion.yml ..\LICENSE = ..\LICENSE ..\mkdocs.yml = ..\mkdocs.yml ..\README.md = ..\README.md EndProjectSection EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GitVersionCore", "GitVersionCore\GitVersionCore.csproj", "{F9741A0D-B9D7-4557-9A1C-A7252C1071F5}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GitVersionExe.Tests", "GitVersionExe.Tests\GitVersionExe.Tests.csproj", "{75C2BE85-1DAF-4E34-8305-B17AFAA982A6}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GitVersionTask", "GitVersionTask\GitVersionTask.csproj", "{F7AC0E71-3E9A-4F6D-B986-E004825A48E1}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GitVersion.Tool", "GitVersionExe\GitVersion.Tool.csproj", "{929263FD-5CD2-42E1-BF3D-E0C1B0320DA4}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docker", "docker", "{E13041A1-70D2-4474-AB8C-87ACE9410DD9}" - ProjectSection(SolutionItems) = preProject - Docker\Readme.md = Docker\Readme.md - EndProjectSection -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "linux", "linux", "{3E72E4A8-B979-4D76-8F4B-F0318C4337D0}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "windows", "windows", "{942A9D37-53AD-4F3C-8141-03EC5F48BADA}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitVersionCore", "GitVersionCore\GitVersionCore.csproj", "{F9741A0D-B9D7-4557-9A1C-A7252C1071F5}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "dotnetcore", "dotnetcore", "{F910CAFC-A81D-4F2A-AE66-F3FAF4DA4291}" - ProjectSection(SolutionItems) = preProject - Docker\linux\dotnetcore\Dockerfile = Docker\linux\dotnetcore\Dockerfile - EndProjectSection -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "fullfx", "fullfx", "{D82A526A-C5E6-4039-A904-A8F66472DDC6}" - ProjectSection(SolutionItems) = preProject - Docker\linux\fullfx\Dockerfile = Docker\linux\fullfx\Dockerfile - EndProjectSection +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitVersionExe.Tests", "GitVersionExe.Tests\GitVersionExe.Tests.csproj", "{75C2BE85-1DAF-4E34-8305-B17AFAA982A6}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "dotnetcore", "dotnetcore", "{D52A3B57-C914-4B28-90C8-53B6F1664C61}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "TfsTask", "TfsTask", "{A0ED1410-E970-45E8-A357-05605E2B7BFF}" ProjectSection(SolutionItems) = preProject - Docker\windows\dotnetcore\Dockerfile = Docker\windows\dotnetcore\Dockerfile - EndProjectSection -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "fullfx", "fullfx", "{61529CF9-DC9E-4BEC-88EC-C111E90D0D95}" - ProjectSection(SolutionItems) = preProject - Docker\windows\fullfx\Dockerfile = Docker\windows\fullfx\Dockerfile + GitVersionTfsTask\Create-Vsix.ps1 = GitVersionTfsTask\Create-Vsix.ps1 + GitVersionTfsTask\extension-icon.png = GitVersionTfsTask\extension-icon.png + GitVersionTfsTask\GitVersion.ts = GitVersionTfsTask\GitVersion.ts + GitVersionTfsTask\icon.png = GitVersionTfsTask\icon.png + GitVersionTfsTask\manifest.json = GitVersionTfsTask\manifest.json + GitVersionTfsTask\overview.md = GitVersionTfsTask\overview.md + GitVersionTfsTask\task.json = GitVersionTfsTask\task.json + GitVersionTfsTask\Update-GitVersionTfsTaskVersion.ps1 = GitVersionTfsTask\Update-GitVersionTfsTaskVersion.ps1 EndProjectSection EndProject Global @@ -77,6 +59,10 @@ 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 @@ -89,27 +75,8 @@ 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 - {929263FD-5CD2-42E1-BF3D-E0C1B0320DA4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {929263FD-5CD2-42E1-BF3D-E0C1B0320DA4}.Debug|Any CPU.Build.0 = Debug|Any CPU - {929263FD-5CD2-42E1-BF3D-E0C1B0320DA4}.Release|Any CPU.ActiveCfg = Release|Any CPU - {929263FD-5CD2-42E1-BF3D-E0C1B0320DA4}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {3E72E4A8-B979-4D76-8F4B-F0318C4337D0} = {E13041A1-70D2-4474-AB8C-87ACE9410DD9} - {942A9D37-53AD-4F3C-8141-03EC5F48BADA} = {E13041A1-70D2-4474-AB8C-87ACE9410DD9} - {F910CAFC-A81D-4F2A-AE66-F3FAF4DA4291} = {3E72E4A8-B979-4D76-8F4B-F0318C4337D0} - {D82A526A-C5E6-4039-A904-A8F66472DDC6} = {3E72E4A8-B979-4D76-8F4B-F0318C4337D0} - {D52A3B57-C914-4B28-90C8-53B6F1664C61} = {942A9D37-53AD-4F3C-8141-03EC5F48BADA} - {61529CF9-DC9E-4BEC-88EC-C111E90D0D95} = {942A9D37-53AD-4F3C-8141-03EC5F48BADA} - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {0C1C310E-7A4D-4032-878B-6DC375894C49} - EndGlobalSection EndGlobal diff --git a/src/GitVersion.sln.DotSettings b/src/GitVersion.sln.DotSettings index 6f32af444a..4d4feefb78 100644 --- a/src/GitVersion.sln.DotSettings +++ b/src/GitVersion.sln.DotSettings @@ -1,4 +1,4 @@ - + True @@ -134,7 +134,6 @@ ALWAYS_ADD ALWAYS_ADD ALWAYS_ADD - NEVER False False False @@ -544,15 +543,9 @@ II.2.12 <HandlesEvent /> <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> <Policy Inspect="True" Prefix="T" Suffix="" Style="AaBb" /> <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> - True True - True - True - True - True True True - True True True True diff --git a/src/GitVersionCore.Tests/Approved/JsonVersionBuilderTests.Json.approved.txt b/src/GitVersionCore.Tests/Approved/JsonVersionBuilderTests.Json.approved.txt index 73d8519a48..76f74d5073 100644 --- a/src/GitVersionCore.Tests/Approved/JsonVersionBuilderTests.Json.approved.txt +++ b/src/GitVersionCore.Tests/Approved/JsonVersionBuilderTests.Json.approved.txt @@ -19,7 +19,6 @@ "InformationalVersion":"1.2.0-unstable.4+5.Branch.feature1.Sha.commitSha", "BranchName":"feature1", "Sha":"commitSha", - "ShortSha":"commitShortSha", "NuGetVersionV2":"1.2.0-unstable0004", "NuGetVersion":"1.2.0-unstable0004", "NuGetPreReleaseTagV2":"unstable0004", diff --git a/src/GitVersionCore.Tests/Approved/VariableProviderTests.ProvidesVariablesInContinuousDeliveryModeForPreRelease.approved.txt b/src/GitVersionCore.Tests/Approved/VariableProviderTests.ProvidesVariablesInContinuousDeliveryModeForPreRelease.approved.txt index 4b2a620248..b35176f231 100644 --- a/src/GitVersionCore.Tests/Approved/VariableProviderTests.ProvidesVariablesInContinuousDeliveryModeForPreRelease.approved.txt +++ b/src/GitVersionCore.Tests/Approved/VariableProviderTests.ProvidesVariablesInContinuousDeliveryModeForPreRelease.approved.txt @@ -19,7 +19,6 @@ "InformationalVersion":"1.2.3-unstable.4+5.Branch.develop.Sha.commitSha", "BranchName":"develop", "Sha":"commitSha", - "ShortSha":"commitShortSha", "NuGetVersionV2":"1.2.3-unstable0004", "NuGetVersion":"1.2.3-unstable0004", "NuGetPreReleaseTagV2":"unstable0004", diff --git a/src/GitVersionCore.Tests/Approved/VariableProviderTests.ProvidesVariablesInContinuousDeliveryModeForPreReleaseWithPadding.approved.txt b/src/GitVersionCore.Tests/Approved/VariableProviderTests.ProvidesVariablesInContinuousDeliveryModeForPreReleaseWithPadding.approved.txt index c4b38bab2b..ada2ae55c4 100644 --- a/src/GitVersionCore.Tests/Approved/VariableProviderTests.ProvidesVariablesInContinuousDeliveryModeForPreReleaseWithPadding.approved.txt +++ b/src/GitVersionCore.Tests/Approved/VariableProviderTests.ProvidesVariablesInContinuousDeliveryModeForPreReleaseWithPadding.approved.txt @@ -19,7 +19,6 @@ "InformationalVersion":"1.2.3-unstable.4+5.Branch.develop.Sha.commitSha", "BranchName":"develop", "Sha":"commitSha", - "ShortSha":"commitShortSha", "NuGetVersionV2":"1.2.3-unstable00004", "NuGetVersion":"1.2.3-unstable00004", "NuGetPreReleaseTagV2":"unstable0004", diff --git a/src/GitVersionCore.Tests/Approved/VariableProviderTests.ProvidesVariablesInContinuousDeliveryModeForStable.approved.txt b/src/GitVersionCore.Tests/Approved/VariableProviderTests.ProvidesVariablesInContinuousDeliveryModeForStable.approved.txt index 4c62ef7178..7fc32ced80 100644 --- a/src/GitVersionCore.Tests/Approved/VariableProviderTests.ProvidesVariablesInContinuousDeliveryModeForStable.approved.txt +++ b/src/GitVersionCore.Tests/Approved/VariableProviderTests.ProvidesVariablesInContinuousDeliveryModeForStable.approved.txt @@ -19,7 +19,6 @@ "InformationalVersion":"1.2.3+5.Branch.develop.Sha.commitSha", "BranchName":"develop", "Sha":"commitSha", - "ShortSha":"commitShortSha", "NuGetVersionV2":"1.2.3", "NuGetVersion":"1.2.3", "NuGetPreReleaseTagV2":"", diff --git a/src/GitVersionCore.Tests/Approved/VariableProviderTests.ProvidesVariablesInContinuousDeploymentModeForPreRelease.approved.txt b/src/GitVersionCore.Tests/Approved/VariableProviderTests.ProvidesVariablesInContinuousDeploymentModeForPreRelease.approved.txt index 34d620cdb0..db6df7caf5 100644 --- a/src/GitVersionCore.Tests/Approved/VariableProviderTests.ProvidesVariablesInContinuousDeploymentModeForPreRelease.approved.txt +++ b/src/GitVersionCore.Tests/Approved/VariableProviderTests.ProvidesVariablesInContinuousDeploymentModeForPreRelease.approved.txt @@ -19,7 +19,6 @@ "InformationalVersion":"1.2.3-unstable.5+Branch.develop.Sha.commitSha", "BranchName":"develop", "Sha":"commitSha", - "ShortSha":"commitShortSha", "NuGetVersionV2":"1.2.3-unstable0005", "NuGetVersion":"1.2.3-unstable0005", "NuGetPreReleaseTagV2":"unstable0005", diff --git a/src/GitVersionCore.Tests/Approved/VariableProviderTests.ProvidesVariablesInContinuousDeploymentModeForStable.approved.txt b/src/GitVersionCore.Tests/Approved/VariableProviderTests.ProvidesVariablesInContinuousDeploymentModeForStable.approved.txt index cdb12ad18b..e6513c5894 100644 --- a/src/GitVersionCore.Tests/Approved/VariableProviderTests.ProvidesVariablesInContinuousDeploymentModeForStable.approved.txt +++ b/src/GitVersionCore.Tests/Approved/VariableProviderTests.ProvidesVariablesInContinuousDeploymentModeForStable.approved.txt @@ -19,7 +19,6 @@ "InformationalVersion":"1.2.3-ci.5+Branch.develop.Sha.commitSha", "BranchName":"develop", "Sha":"commitSha", - "ShortSha":"commitShortSha", "NuGetVersionV2":"1.2.3-ci0005", "NuGetVersion":"1.2.3-ci0005", "NuGetPreReleaseTagV2":"ci0005", diff --git a/src/GitVersionCore.Tests/Approved/VariableProviderTests.ProvidesVariablesInContinuousDeploymentModeForStableWhenCurrentCommitIsTagged.approved.txt b/src/GitVersionCore.Tests/Approved/VariableProviderTests.ProvidesVariablesInContinuousDeploymentModeForStableWhenCurrentCommitIsTagged.approved.txt index 9a514f337d..eaa4c8f8bf 100644 --- a/src/GitVersionCore.Tests/Approved/VariableProviderTests.ProvidesVariablesInContinuousDeploymentModeForStableWhenCurrentCommitIsTagged.approved.txt +++ b/src/GitVersionCore.Tests/Approved/VariableProviderTests.ProvidesVariablesInContinuousDeploymentModeForStableWhenCurrentCommitIsTagged.approved.txt @@ -19,7 +19,6 @@ "InformationalVersion":"1.2.3+5.Sha.commitSha", "BranchName":"", "Sha":"commitSha", - "ShortSha":"commitShortSha", "NuGetVersionV2":"1.2.3", "NuGetVersion":"1.2.3", "NuGetPreReleaseTagV2":"", diff --git a/src/GitVersionCore.Tests/Approved/cs/AssemblyInfoFileUpdaterTests.Issue1183_ShouldAddFSharpAssemblyInformationalVersionBesideOtherAttributes.approved.txt b/src/GitVersionCore.Tests/Approved/cs/AssemblyInfoFileUpdaterTests.Issue1183_ShouldAddFSharpAssemblyInformationalVersionBesideOtherAttributes.approved.txt deleted file mode 100644 index 344e5a6b41..0000000000 --- a/src/GitVersionCore.Tests/Approved/cs/AssemblyInfoFileUpdaterTests.Issue1183_ShouldAddFSharpAssemblyInformationalVersionBesideOtherAttributes.approved.txt +++ /dev/null @@ -1,4 +0,0 @@ -[assembly: AssemblyVersion("2.3.1.0")] -[assembly: AssemblyFileVersion("2.3.1.0")] -[assembly: AssemblyInformationalVersion("2.3.1+3.Branch.foo.Sha.hash")] -// comment diff --git a/src/GitVersionCore.Tests/Approved/cs/GitVersionInformationGeneratorTests.ShouldCreateFile.approved.txt b/src/GitVersionCore.Tests/Approved/cs/GitVersionInformationGeneratorTests.ShouldCreateFile.approved.txt index cf3225e48a..698163acfe 100644 --- a/src/GitVersionCore.Tests/Approved/cs/GitVersionInformationGeneratorTests.ShouldCreateFile.approved.txt +++ b/src/GitVersionCore.Tests/Approved/cs/GitVersionInformationGeneratorTests.ShouldCreateFile.approved.txt @@ -31,7 +31,6 @@ static class GitVersionInformation public static string InformationalVersion = "1.2.3-unstable.4+5.Branch.feature1.Sha.commitSha"; public static string BranchName = "feature1"; public static string Sha = "commitSha"; - public static string ShortSha = "commitShortSha"; public static string NuGetVersionV2 = "1.2.3-unstable0004"; public static string NuGetVersion = "1.2.3-unstable0004"; public static string NuGetPreReleaseTagV2 = "unstable0004"; diff --git a/src/GitVersionCore.Tests/Approved/fs/AssemblyInfoFileUpdateTests.ShouldAddAssemblyInformationalVersionWhenUpdatingAssemblyVersionFile.approved.txt b/src/GitVersionCore.Tests/Approved/fs/AssemblyInfoFileUpdateTests.ShouldAddAssemblyInformationalVersionWhenUpdatingAssemblyVersionFile.approved.txt deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/GitVersionCore.Tests/Approved/fs/AssemblyInfoFileUpdateTests.ShouldCreateAssemblyInfoFileAtPathWhenNotExistsAndEnsureAssemblyInfo.approved.txt b/src/GitVersionCore.Tests/Approved/fs/AssemblyInfoFileUpdateTests.ShouldCreateAssemblyInfoFileAtPathWhenNotExistsAndEnsureAssemblyInfo.approved.txt deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/GitVersionCore.Tests/Approved/fs/AssemblyInfoFileUpdateTests.ShouldCreateAssemblyInfoFileWhenNotExistsAndEnsureAssemblyInfo.approved.txt b/src/GitVersionCore.Tests/Approved/fs/AssemblyInfoFileUpdateTests.ShouldCreateAssemblyInfoFileWhenNotExistsAndEnsureAssemblyInfo.approved.txt deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/GitVersionCore.Tests/Approved/fs/AssemblyInfoFileUpdateTests.ShouldCreateAssemblyInfoFilesAtPathWhenNotExistsAndEnsureAssemblyInfo.approved.txt b/src/GitVersionCore.Tests/Approved/fs/AssemblyInfoFileUpdateTests.ShouldCreateAssemblyInfoFilesAtPathWhenNotExistsAndEnsureAssemblyInfo.approved.txt deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/GitVersionCore.Tests/Approved/fs/AssemblyInfoFileUpdateTests.ShouldNotAddAssemblyInformationalVersionWhenUpdatingAssemblyVersionFileWhenVersionSchemeIsNone.approved.txt b/src/GitVersionCore.Tests/Approved/fs/AssemblyInfoFileUpdateTests.ShouldNotAddAssemblyInformationalVersionWhenUpdatingAssemblyVersionFileWhenVersionSchemeIsNone.approved.txt deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/GitVersionCore.Tests/Approved/fs/AssemblyInfoFileUpdateTests.ShouldNotReplaceAssemblyVersionWhenVersionSchemeIsNone.approved.txt b/src/GitVersionCore.Tests/Approved/fs/AssemblyInfoFileUpdateTests.ShouldNotReplaceAssemblyVersionWhenVersionSchemeIsNone.approved.txt deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/GitVersionCore.Tests/Approved/fs/AssemblyInfoFileUpdaterTests.Issue1183_ShouldAddFSharpAssemblyInformationalVersionBesideOtherAttributes.approved.txt b/src/GitVersionCore.Tests/Approved/fs/AssemblyInfoFileUpdaterTests.Issue1183_ShouldAddFSharpAssemblyInformationalVersionBesideOtherAttributes.approved.txt deleted file mode 100644 index df0a35a6f8..0000000000 --- a/src/GitVersionCore.Tests/Approved/fs/AssemblyInfoFileUpdaterTests.Issue1183_ShouldAddFSharpAssemblyInformationalVersionBesideOtherAttributes.approved.txt +++ /dev/null @@ -1,5 +0,0 @@ -[] -[] -[] -do -() diff --git a/src/GitVersionCore.Tests/Approved/fs/GitVersionInformationGeneratorTests.ShouldCreateFile.approved.txt b/src/GitVersionCore.Tests/Approved/fs/GitVersionInformationGeneratorTests.ShouldCreateFile.approved.txt index 12bf359b72..f7ff69ede2 100644 --- a/src/GitVersionCore.Tests/Approved/fs/GitVersionInformationGeneratorTests.ShouldCreateFile.approved.txt +++ b/src/GitVersionCore.Tests/Approved/fs/GitVersionInformationGeneratorTests.ShouldCreateFile.approved.txt @@ -31,7 +31,6 @@ module GitVersionInformation let InformationalVersion = "1.2.3-unstable.4+5.Branch.feature1.Sha.commitSha" let BranchName = "feature1" let Sha = "commitSha" - let ShortSha = "commitShortSha" let NuGetVersionV2 = "1.2.3-unstable0004" let NuGetVersion = "1.2.3-unstable0004" let NuGetPreReleaseTagV2 = "unstable0004" diff --git a/src/GitVersionCore.Tests/Approved/vb/AssemblyInfoFileUpdateTests.ShouldAddAssemblyInformationalVersionWhenUpdatingAssemblyVersionFile.approved.txt b/src/GitVersionCore.Tests/Approved/vb/AssemblyInfoFileUpdateTests.ShouldAddAssemblyInformationalVersionWhenUpdatingAssemblyVersionFile.approved.txt deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/GitVersionCore.Tests/Approved/vb/AssemblyInfoFileUpdateTests.ShouldCreateAssemblyInfoFileAtPathWhenNotExistsAndEnsureAssemblyInfo.approved.txt b/src/GitVersionCore.Tests/Approved/vb/AssemblyInfoFileUpdateTests.ShouldCreateAssemblyInfoFileAtPathWhenNotExistsAndEnsureAssemblyInfo.approved.txt deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/GitVersionCore.Tests/Approved/vb/AssemblyInfoFileUpdateTests.ShouldCreateAssemblyInfoFileWhenNotExistsAndEnsureAssemblyInfo.approved.txt b/src/GitVersionCore.Tests/Approved/vb/AssemblyInfoFileUpdateTests.ShouldCreateAssemblyInfoFileWhenNotExistsAndEnsureAssemblyInfo.approved.txt deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/GitVersionCore.Tests/Approved/vb/AssemblyInfoFileUpdateTests.ShouldCreateAssemblyInfoFilesAtPathWhenNotExistsAndEnsureAssemblyInfo.approved.txt b/src/GitVersionCore.Tests/Approved/vb/AssemblyInfoFileUpdateTests.ShouldCreateAssemblyInfoFilesAtPathWhenNotExistsAndEnsureAssemblyInfo.approved.txt deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/GitVersionCore.Tests/Approved/vb/AssemblyInfoFileUpdateTests.ShouldNotAddAssemblyInformationalVersionWhenUpdatingAssemblyVersionFileWhenVersionSchemeIsNone.approved.txt b/src/GitVersionCore.Tests/Approved/vb/AssemblyInfoFileUpdateTests.ShouldNotAddAssemblyInformationalVersionWhenUpdatingAssemblyVersionFileWhenVersionSchemeIsNone.approved.txt deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/GitVersionCore.Tests/Approved/vb/AssemblyInfoFileUpdateTests.ShouldNotReplaceAssemblyVersionWhenVersionSchemeIsNone.approved.txt b/src/GitVersionCore.Tests/Approved/vb/AssemblyInfoFileUpdateTests.ShouldNotReplaceAssemblyVersionWhenVersionSchemeIsNone.approved.txt deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/GitVersionCore.Tests/Approved/vb/AssemblyInfoFileUpdaterTests.Issue1183_ShouldAddFSharpAssemblyInformationalVersionBesideOtherAttributes.approved.txt b/src/GitVersionCore.Tests/Approved/vb/AssemblyInfoFileUpdaterTests.Issue1183_ShouldAddFSharpAssemblyInformationalVersionBesideOtherAttributes.approved.txt deleted file mode 100644 index 45fdd1b2bc..0000000000 --- a/src/GitVersionCore.Tests/Approved/vb/AssemblyInfoFileUpdaterTests.Issue1183_ShouldAddFSharpAssemblyInformationalVersionBesideOtherAttributes.approved.txt +++ /dev/null @@ -1,4 +0,0 @@ - - - -' comment diff --git a/src/GitVersionCore.Tests/Approved/vb/GitVersionInformationGeneratorTests.ShouldCreateFile.approved.txt b/src/GitVersionCore.Tests/Approved/vb/GitVersionInformationGeneratorTests.ShouldCreateFile.approved.txt index b628771a5d..9f894fffb6 100644 --- a/src/GitVersionCore.Tests/Approved/vb/GitVersionInformationGeneratorTests.ShouldCreateFile.approved.txt +++ b/src/GitVersionCore.Tests/Approved/vb/GitVersionInformationGeneratorTests.ShouldCreateFile.approved.txt @@ -32,7 +32,6 @@ NotInheritable Class GitVersionInformation Public Shared InformationalVersion As String = "1.2.3-unstable.4+5.Branch.feature1.Sha.commitSha" Public Shared BranchName As String = "feature1" Public Shared Sha As String = "commitSha" - Public Shared ShortSha As String = "commitShortSha" Public Shared NuGetVersionV2 As String = "1.2.3-unstable0004" Public Shared NuGetVersion As String = "1.2.3-unstable0004" Public Shared NuGetPreReleaseTagV2 As String = "unstable0004" diff --git a/src/GitVersionCore.Tests/AssemblyFileVersionTests.cs b/src/GitVersionCore.Tests/AssemblyFileVersionTests.cs index db65691e48..e09f186191 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 : TestBase + public class AssemblyFileVersionTests { [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 14b65df11a..dadc0c4bad 100644 --- a/src/GitVersionCore.Tests/AssemblyInfoFileUpdaterTests.cs +++ b/src/GitVersionCore.Tests/AssemblyInfoFileUpdaterTests.cs @@ -1,6 +1,7 @@ -using System; +using System; using System.Collections.Generic; using System.IO; +using System.Linq; using GitVersion; using GitVersion.Helpers; using GitVersionCore.Tests; @@ -9,7 +10,6 @@ using Shouldly; [TestFixture] -[Parallelizable(ParallelScope.None)] public class AssemblyInfoFileUpdaterTests { [SetUp] @@ -431,29 +431,6 @@ public void ShouldAddAssemblyInformationalVersionWhenUpdatingAssemblyVersionFile }); } - [TestCase("cs", "[assembly: AssemblyVersion(\"1.0.0.0\")]\r\n[assembly: AssemblyFileVersion(\"1.0.0.0\")]\r\n// comment\r\n")] - [TestCase("fs", "[]\r\n[]\r\ndo\r\n()\r\n")] - [TestCase("vb", "\r\n\r\n' comment\r\n")] - [Category("NoMono")] - [Description("Won't run on Mono due to source information not being available for ShouldMatchApproved.")] - public void Issue1183_ShouldAddFSharpAssemblyInformationalVersionBesideOtherAttributes(string fileExtension, string assemblyFileContent) - { - var workingDir = Path.GetTempPath(); - var assemblyInfoFile = "AssemblyInfo." + fileExtension; - var fileName = Path.Combine(workingDir, assemblyInfoFile); - - VerifyAssemblyInfoFile(assemblyFileContent, fileName, verify: (fileSystem, variables) => - { - 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))); - } - }); - } - [TestCase("cs", "[assembly: AssemblyFileVersion(\"1.0.0.0\")]")] [TestCase("fs", "[]")] [TestCase("vb", "")] @@ -486,7 +463,7 @@ private static void VerifyAssemblyInfoFile( var fileSystem = Substitute.For(); var version = new SemanticVersion { - BuildMetaData = new SemanticVersionBuildMetaData(3, "foo", "hash", "shortHash", DateTimeOffset.Now), + BuildMetaData = new SemanticVersionBuildMetaData(3, "foo", "hash", DateTimeOffset.Now), Major = 2, Minor = 3, Patch = 1 @@ -505,4 +482,4 @@ private static void VerifyAssemblyInfoFile( verify(fileSystem, variables); } -} +} \ No newline at end of file diff --git a/src/GitVersionCore.Tests/AssemblyParallelizable.cs b/src/GitVersionCore.Tests/AssemblyParallelizable.cs deleted file mode 100644 index 9f6f4f451f..0000000000 --- a/src/GitVersionCore.Tests/AssemblyParallelizable.cs +++ /dev/null @@ -1,3 +0,0 @@ -using NUnit.Framework; - -[assembly: Parallelizable(ParallelScope.Fixtures)] \ No newline at end of file diff --git a/src/GitVersionCore.Tests/BuildServers/BuildServerBaseTests.cs b/src/GitVersionCore.Tests/BuildServers/BuildServerBaseTests.cs index c224fdc611..2e7fc23413 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 : TestBase +public class BuildServerBaseTests { [Test] public void BuildNumberIsFullSemVer() diff --git a/src/GitVersionCore.Tests/BuildServers/ContinuaCiTests.cs b/src/GitVersionCore.Tests/BuildServers/ContinuaCiTests.cs index 38edab1c24..f039f7f546 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 : TestBase +public class ContinuaCiTests { [Test] diff --git a/src/GitVersionCore.Tests/BuildServers/EnvRunTests.cs b/src/GitVersionCore.Tests/BuildServers/EnvRunTests.cs deleted file mode 100644 index b5deee3ae9..0000000000 --- a/src/GitVersionCore.Tests/BuildServers/EnvRunTests.cs +++ /dev/null @@ -1,67 +0,0 @@ -using System; -using System.IO; -using GitVersion; -using GitVersionCore.Tests; -using NUnit.Framework; -using Shouldly; - -[TestFixture] -public class EnvRunTests : TestBase -{ - private const string EnvVarName = "ENVRUN_DATABASE"; - private string mFilePath; - - [SetUp] - public void SetEnvironmentVariableForTest() - { - // set environment variable and create an empty envrun file to indicate that EnvRun is running... - mFilePath = Path.Combine(Path.GetTempPath(), "envrun.db"); - Environment.SetEnvironmentVariable(EnvVarName, mFilePath, EnvironmentVariableTarget.Process); - File.OpenWrite(mFilePath).Dispose(); - } - - [TearDown] - public void ClearEnvironmentVariableForTest() - { - Environment.SetEnvironmentVariable(EnvVarName, null, EnvironmentVariableTarget.Process); - File.Delete(mFilePath); - } - - [Test] - public void CanApplyToCurrentContext() - { - EnvRun envrun = new EnvRun(); - bool applys = envrun.CanApplyToCurrentContext(); - applys.ShouldBeTrue(); - } - - [Test] - public void CanApplyToCurrentContext_EnvironmentVariableNotSet() - { - Environment.SetEnvironmentVariable(EnvVarName, null, EnvironmentVariableTarget.Process); - EnvRun envrun = new EnvRun(); - bool applys = envrun.CanApplyToCurrentContext(); - applys.ShouldBeFalse(); - } - - [TestCase("1.2.3")] - [TestCase("1.2.3-rc4")] - public void GenerateSetVersionMessage(string fullSemVer) - { - EnvRun envrun = new EnvRun(); - var vars = new TestableVersionVariables(fullSemVer: fullSemVer); - var version = envrun.GenerateSetVersionMessage(vars); - version.ShouldBe(fullSemVer); - } - - [TestCase("Version", "1.2.3", "@@envrun[set name='GitVersion_Version' value='1.2.3']")] - [TestCase("Version", "1.2.3-rc4", "@@envrun[set name='GitVersion_Version' value='1.2.3-rc4']")] - public void GenerateSetParameterMessage(string name, string value, string expected) - { - EnvRun envrun = new EnvRun(); - var output = envrun.GenerateSetParameterMessage(name, value); - output.ShouldHaveSingleItem(); - output[0].ShouldBe(expected); - } - -} diff --git a/src/GitVersionCore.Tests/BuildServers/EnvironmentVariableJenkinsTests.cs b/src/GitVersionCore.Tests/BuildServers/EnvironmentVariableJenkinsTests.cs index 8a651fd4e7..511822d2c4 100644 --- a/src/GitVersionCore.Tests/BuildServers/EnvironmentVariableJenkinsTests.cs +++ b/src/GitVersionCore.Tests/BuildServers/EnvironmentVariableJenkinsTests.cs @@ -1,11 +1,10 @@ using System; using GitVersion; -using GitVersionCore.Tests; using NUnit.Framework; using Shouldly; [TestFixture] -public class EnvironmentVariableJenkinsTests : TestBase +public class EnvironmentVariableJenkinsTests { 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 12d6c2e60e..2c6ea5e39d 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 : TestBase +public class GitLabCiMessageGenerationTests { [Test] public void GenerateSetVersionMessageReturnsVersionAsIs_AlthoughThisIsNotUsedByJenkins() diff --git a/src/GitVersionCore.Tests/BuildServers/JenkinsMessageGenerationTests.cs b/src/GitVersionCore.Tests/BuildServers/JenkinsMessageGenerationTests.cs index ed2d13a948..418463dbc9 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 : TestBase +public class JenkinsMessageGenerationTests { [Test] public void GenerateSetVersionMessageReturnsVersionAsIs_AlthoughThisIsNotUsedByJenkins() diff --git a/src/GitVersionCore.Tests/BuildServers/MyGetTests.cs b/src/GitVersionCore.Tests/BuildServers/MyGetTests.cs index 440ca933a9..82a420b7bb 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 : TestBase +public class MyGetTests { [Test] public void Develop_branch() diff --git a/src/GitVersionCore.Tests/BuildServers/TeamCityTests.cs b/src/GitVersionCore.Tests/BuildServers/TeamCityTests.cs index 3731abfadf..c391aca037 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 : TestBase +public class TeamCityTests { [Test] public void Develop_branch() diff --git a/src/GitVersionCore.Tests/BuildServers/VsoAgentBuildNumberTests.cs b/src/GitVersionCore.Tests/BuildServers/VsoAgentBuildNumberTests.cs index 16552b821d..c3aecb813a 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 : TestBase +public class VsoAgentBuildNumberTests { 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 f78abd3476..e9e629e632 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 : TestBase +public class VsoAgentTests { string key = "BUILD_BUILDNUMBER"; diff --git a/src/GitVersionCore.Tests/CommitDateTests.cs b/src/GitVersionCore.Tests/CommitDateTests.cs index 541b362903..8520786baf 100644 --- a/src/GitVersionCore.Tests/CommitDateTests.cs +++ b/src/GitVersionCore.Tests/CommitDateTests.cs @@ -1,4 +1,6 @@ -using System; +using System; +using System.Collections; +using System.Collections.Generic; using System.Linq; using GitVersion; using GitVersion.VersionFilters; @@ -7,7 +9,7 @@ namespace GitVersionCore.Tests { [TestFixture] - public class CommitDateTests : TestBase + public class CommitDateTests { [Test] [TestCase("yyyy-MM-dd", "2017-10-06")] @@ -21,7 +23,7 @@ public void CommitDateFormatTest(string format, string expectedOutcome) var formatValues = new SemanticVersionFormatValues( new SemanticVersion { - BuildMetaData = new SemanticVersionBuildMetaData(0, "master", "3139d4eeb044f46057693473eacc2655b3b27e7d", "3139d4eeb", new DateTimeOffset(date, TimeSpan.Zero)), // assume time zone is UTC + BuildMetaData = new SemanticVersionBuildMetaData(0, "master", "3139d4eeb044f46057693473eacc2655b3b27e7d", new DateTimeOffset(date, TimeSpan.Zero)), // assume time zone is UTC }, new EffectiveConfiguration( diff --git a/src/GitVersionCore.Tests/ConfigProviderTests.CanWriteOutEffectiveConfiguration.approved.txt b/src/GitVersionCore.Tests/ConfigProviderTests.CanWriteOutEffectiveConfiguration.approved.txt index 7d0d4f02a6..2650aedd2b 100644 --- a/src/GitVersionCore.Tests/ConfigProviderTests.CanWriteOutEffectiveConfiguration.approved.txt +++ b/src/GitVersionCore.Tests/ConfigProviderTests.CanWriteOutEffectiveConfiguration.approved.txt @@ -18,7 +18,7 @@ branches: increment: Minor prevent-increment-of-merged-branch-version: false track-merge-target: true - regex: ^dev(elop)?(ment)?$ + regex: dev(elop)?(ment)?$ source-branches: [] tracks-release-branches: true is-release-branch: false @@ -29,7 +29,7 @@ branches: increment: Patch prevent-increment-of-merged-branch-version: true track-merge-target: false - regex: ^master$ + regex: master$ source-branches: - develop - release @@ -42,7 +42,7 @@ branches: increment: Patch prevent-increment-of-merged-branch-version: true track-merge-target: false - regex: ^releases?[/-] + regex: releases?[/-] source-branches: - develop - master @@ -57,7 +57,7 @@ branches: increment: Inherit prevent-increment-of-merged-branch-version: false track-merge-target: false - regex: ^features?[/-] + regex: features?[/-] source-branches: - develop - master @@ -75,7 +75,7 @@ branches: prevent-increment-of-merged-branch-version: false tag-number-pattern: '[/-](?\d+)' track-merge-target: false - regex: ^(pull|pull\-requests|pr)[/-] + regex: (pull|pull\-requests|pr)[/-] source-branches: - develop - master @@ -92,7 +92,7 @@ branches: increment: Patch prevent-increment-of-merged-branch-version: false track-merge-target: false - regex: ^hotfix(es)?[/-] + regex: hotfix(es)?[/-] source-branches: - develop - master @@ -106,7 +106,7 @@ branches: increment: Patch prevent-increment-of-merged-branch-version: true track-merge-target: false - regex: ^support[/-] + regex: support[/-] source-branches: - master tracks-release-branches: false diff --git a/src/GitVersionCore.Tests/ConfigProviderTests.cs b/src/GitVersionCore.Tests/ConfigProviderTests.cs index e4b27f009e..090561e920 100644 --- a/src/GitVersionCore.Tests/ConfigProviderTests.cs +++ b/src/GitVersionCore.Tests/ConfigProviderTests.cs @@ -1,10 +1,9 @@ using GitVersion; using GitVersion.Helpers; -using GitVersionCore.Tests; using NUnit.Framework; using Shouldly; using System; -using System.Collections.Generic; +using System.ComponentModel; using System.IO; using System.Linq; using System.Reflection; @@ -12,7 +11,7 @@ using YamlDotNet.Serialization; [TestFixture] -public class ConfigProviderTests : TestBase +public class ConfigProviderTests { private const string DefaultRepoPath = "c:\\MyGitRepo"; private const string DefaultWorkingPath = "c:\\MyGitRepo\\Working"; @@ -363,71 +362,4 @@ public void WarnOnObsoleteIsDevelopBranchConfigurationSetting() const string expectedMessage = @"'is-develop' is deprecated, use 'tracks-release-branches' instead."; exception.Message.ShouldContain(expectedMessage); } - - [Test] - public void ShouldUseSpecifiedSourceBranchesForDevelop() - { - var defaultConfig = ConfigurationProvider.Provide(repoPath, fileSystem); - const string text = @" -next-version: 2.0.0 -branches: - develop: - mode: ContinuousDeployment - source-branches: ['develop'] - tag: dev"; - SetupConfigFileContent(text); - var config = ConfigurationProvider.Provide(repoPath, fileSystem); - - config.Branches["develop"].SourceBranches.ShouldBe(new List { "develop" }); - } - - [Test] - public void ShouldUseDefaultSourceBranchesWhenNotSpecifiedForDevelop() - { - var defaultConfig = ConfigurationProvider.Provide(repoPath, fileSystem); - const string text = @" -next-version: 2.0.0 -branches: - develop: - mode: ContinuousDeployment - tag: dev"; - SetupConfigFileContent(text); - var config = ConfigurationProvider.Provide(repoPath, fileSystem); - - config.Branches["develop"].SourceBranches.ShouldBe(new List()); - } - - [Test] - public void ShouldUseSpecifiedSourceBranchesForFeature() - { - var defaultConfig = ConfigurationProvider.Provide(repoPath, fileSystem); - const string text = @" -next-version: 2.0.0 -branches: - feature: - mode: ContinuousDeployment - source-branches: ['develop', 'release'] - tag: dev"; - SetupConfigFileContent(text); - var config = ConfigurationProvider.Provide(repoPath, fileSystem); - - config.Branches["feature"].SourceBranches.ShouldBe(new List { "develop", "release" }); - } - - [Test] - public void ShouldUseDefaultSourceBranchesWhenNotSpecifiedForFeature() - { - var defaultConfig = ConfigurationProvider.Provide(repoPath, fileSystem); - const string text = @" -next-version: 2.0.0 -branches: - feature: - mode: ContinuousDeployment - tag: dev"; - SetupConfigFileContent(text); - var config = ConfigurationProvider.Provide(repoPath, fileSystem); - - config.Branches["feature"].SourceBranches.ShouldBe( - new List { "develop", "master", "release", "feature", "support", "hotfix" }); - } } diff --git a/src/GitVersionCore.Tests/Configuration/IgnoreConfigTests.cs b/src/GitVersionCore.Tests/Configuration/IgnoreConfigTests.cs index 513e1327a6..aae3807a23 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 : TestBase + public class IgnoreConfigTests { [Test] public void CanDeserialize() diff --git a/src/GitVersionCore.Tests/DocumentationTests.cs b/src/GitVersionCore.Tests/DocumentationTests.cs index 660ea9f356..b2aed4ab2f 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 : TestBase +public class DocumentationTests { private DirectoryInfo docsDirectory; diff --git a/src/GitVersionCore.Tests/DynamicRepositoryTests.cs b/src/GitVersionCore.Tests/DynamicRepositoryTests.cs index a8a2782ca8..968f691ae0 100644 --- a/src/GitVersionCore.Tests/DynamicRepositoryTests.cs +++ b/src/GitVersionCore.Tests/DynamicRepositoryTests.cs @@ -1,10 +1,9 @@ using System.IO; using GitVersion; -using GitVersionCore.Tests; using NUnit.Framework; [TestFixture] -public class DynamicRepositoryTests : TestBase +public class DynamicRepositoryTests { string workDirectory; diff --git a/src/GitVersionCore.Tests/ExecuteCoreTests.cs b/src/GitVersionCore.Tests/ExecuteCoreTests.cs index 376d00776f..d167b60a52 100644 --- a/src/GitVersionCore.Tests/ExecuteCoreTests.cs +++ b/src/GitVersionCore.Tests/ExecuteCoreTests.cs @@ -1,7 +1,6 @@ -using GitTools.Testing; +using GitTools.Testing; using GitVersion; using GitVersion.Helpers; -using GitVersionCore.Tests; using NUnit.Framework; using Shouldly; using System; @@ -9,8 +8,7 @@ using System.Text; [TestFixture] -[Parallelizable(ParallelScope.None)] -public class ExecuteCoreTests : TestBase +public class ExecuteCoreTests { IFileSystem fileSystem; @@ -63,7 +61,6 @@ public void CacheFileExistsOnDisk() InformationalVersion: 4.10.3-test.19+Branch.feature/test.Sha.dd2a29aff0c948e1bdf3dabbe13e1576e70d5f9f BranchName: feature/test Sha: dd2a29aff0c948e1bdf3dabbe13e1576e70d5f9f -ShortSha: dd2a29af NuGetVersionV2: 4.10.3-test0019 NuGetVersion: 4.10.3-test0019 NuGetPreReleaseTagV2: test0019 @@ -110,7 +107,6 @@ public void CacheFileExistsOnDiskWhenOverrideConfigIsSpecifiedVersionShouldBeDyn InformationalVersion: 4.10.3-test.19+Branch.feature/test.Sha.dd2a29aff0c948e1bdf3dabbe13e1576e70d5f9f BranchName: feature/test Sha: dd2a29aff0c948e1bdf3dabbe13e1576e70d5f9f -ShortSha: dd2a29af NuGetVersionV2: 4.10.3-test0019 NuGetVersion: 4.10.3-test0019 NuGetPreReleaseTagV2: test0019 @@ -174,7 +170,6 @@ public void ConfigChangeInvalidatesCache() InformationalVersion: 4.10.3-test.19+Branch.feature/test.Sha.dd2a29aff0c948e1bdf3dabbe13e1576e70d5f9f BranchName: feature/test Sha: dd2a29aff0c948e1bdf3dabbe13e1576e70d5f9f -ShortSha: dd2a29af NuGetVersionV2: 4.10.3-test0019 NuGetVersion: 4.10.3-test0019 NuGetPreReleaseTagV2: test0019 @@ -224,7 +219,6 @@ public void NoCacheBypassesCache() InformationalVersion: 4.10.3-test.19+Branch.feature/test.Sha.dd2a29aff0c948e1bdf3dabbe13e1576e70d5f9f BranchName: feature/test Sha: dd2a29aff0c948e1bdf3dabbe13e1576e70d5f9f -ShortSha: dd2a29af NuGetVersionV2: 4.10.3-test0019 NuGetVersion: 4.10.3-test0019 NuGetPreReleaseTagV2: test0019 @@ -275,7 +269,6 @@ LogMessages RepositoryScope(ExecuteCore executeCore = null, Action debugLogger = s => { @@ -321,4 +314,4 @@ LogMessages RepositoryScope(ExecuteCore executeCore = null, Action + + + diff --git a/src/GitVersionCore.Tests/GitRepoMetadataProviderTests.cs b/src/GitVersionCore.Tests/GitRepoMetadataProviderTests.cs index 0b18a30918..ec7d50c345 100644 --- a/src/GitVersionCore.Tests/GitRepoMetadataProviderTests.cs +++ b/src/GitVersionCore.Tests/GitRepoMetadataProviderTests.cs @@ -1,13 +1,14 @@ -namespace GitVersionCore.Tests +namespace GitVersionCore.Tests { using System; + using GitTools; using GitTools.Testing; using GitVersion; using NUnit.Framework; using Shouldly; [TestFixture] - public class GitRepoMetadataProviderTests : TestBase + public class GitRepoMetadataProviderTests { [Test] public void FindsCorrectMergeBaseForForwardMerge() @@ -196,4 +197,4 @@ public void FindsCorrectMergeBaseForMultipleForwardMerges() } } } -} +} \ No newline at end of file diff --git a/src/GitVersionCore.Tests/GitToolsTestingExtensions.cs b/src/GitVersionCore.Tests/GitToolsTestingExtensions.cs index dba18257e1..930f71d9c9 100644 --- a/src/GitVersionCore.Tests/GitToolsTestingExtensions.cs +++ b/src/GitVersionCore.Tests/GitToolsTestingExtensions.cs @@ -1,6 +1,7 @@ -namespace GitVersionCore.Tests +namespace GitVersionCore.Tests { using System; + using GitTools; using GitTools.Testing; using GitVersion; using LibGit2Sharp; @@ -76,4 +77,4 @@ public static void InitialiseRepo(this RemoteRepositoryFixture fixture) new GitPreparer(null, null, new Authentication(), false, fixture.LocalRepositoryFixture.RepositoryPath).Initialise(true, null); } } -} +} \ No newline at end of file diff --git a/src/GitVersionCore.Tests/GitVersionContextTests.cs b/src/GitVersionCore.Tests/GitVersionContextTests.cs index 96440bf28a..21dcbd4d22 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 : TestBase + public class GitVersionContextTests { [Test] [Theory] diff --git a/src/GitVersionCore.Tests/GitVersionCore.Tests.csproj b/src/GitVersionCore.Tests/GitVersionCore.Tests.csproj index 07f2b9c921..6c7f1ad723 100644 --- a/src/GitVersionCore.Tests/GitVersionCore.Tests.csproj +++ b/src/GitVersionCore.Tests/GitVersionCore.Tests.csproj @@ -1,39 +1,221 @@ - - + + + + - net461 - false - + Debug + AnyCPU + {BF905F84-382C-440D-92F5-C61108626D8D} + Library + Properties + GitVersionCore.Tests + GitVersionCore.Tests + v4.5 + 6 + 512 + + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + false + + full false + bin\Release\ + TRACE + prompt + 4 + false true - true - - - - - - - - all - runtime; build; native; contentfiles; analyzers - - - - - - + + ..\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 + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + {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 90a592932b..a22a8bca1d 100644 --- a/src/GitVersionCore.Tests/GitVersionInformationGeneratorTests.cs +++ b/src/GitVersionCore.Tests/GitVersionInformationGeneratorTests.cs @@ -1,5 +1,9 @@ -using System; +using System; +using System.Collections.Generic; using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; using GitVersion; using NUnit.Framework; using Shouldly; @@ -7,7 +11,6 @@ namespace GitVersionCore.Tests { [TestFixture] - [Parallelizable(ParallelScope.None)] public class GitVersionInformationGeneratorTests { [SetUp] @@ -35,7 +38,7 @@ public void ShouldCreateFile(string fileExtension) Patch = 3, PreReleaseTag = "unstable4", BuildMetaData = new SemanticVersionBuildMetaData(5, - "feature1", "commitSha", "commitShortSha", DateTimeOffset.Parse("2014-03-06 23:59:59Z")) + "feature1", "commitSha", DateTimeOffset.Parse("2014-03-06 23:59:59Z")) }; var variables = VariableProvider.GetVariablesFor(semanticVersion, new TestEffectiveConfiguration(), false); diff --git a/src/GitVersionCore.Tests/InformationalVersionBuilderTests.cs b/src/GitVersionCore.Tests/InformationalVersionBuilderTests.cs index 23c1b87cb1..cc23f81f69 100644 --- a/src/GitVersionCore.Tests/InformationalVersionBuilderTests.cs +++ b/src/GitVersionCore.Tests/InformationalVersionBuilderTests.cs @@ -1,23 +1,22 @@ using System; using GitVersion; -using GitVersionCore.Tests; using NUnit.Framework; [TestFixture] -public class InformationalVersionBuilderTests : TestBase +public class InformationalVersionBuilderTests { - [TestCase("feature1", "a682956dc1a2752aa24597a0f5cd939f93614509", "a682956d", 1, 2, 3, "unstable", 1, "1.2.3-unstable+1.Branch.feature1.Sha.a682956dc1a2752aa24597a0f5cd939f93614509")] - [TestCase("develop", "a682956dc1a2752aa24597a0f5cd939f93614509", "a682956d", 1, 2, 3, "alpha645", null, "1.2.3-alpha.645+Branch.develop.Sha.a682956dc1a2752aa24597a0f5cd939f93614509")] - [TestCase("develop", "a682956dc1a2752aa24597a0f5cd939f93614509", "a682956d", 1, 2, 3, "unstable645", null, "1.2.3-unstable.645+Branch.develop.Sha.a682956dc1a2752aa24597a0f5cd939f93614509")] - [TestCase("develop", "a682956dc1a2752aa24597a0f5cd939f93614509", "a682956d", 1, 2, 3, "beta645", null, "1.2.3-beta.645+Branch.develop.Sha.a682956dc1a2752aa24597a0f5cd939f93614509")] - [TestCase("hotfix-foo", "a682956dc1a2752aa24597a0f5cd939f93614509", "a682956d", 1, 2, 3, "alpha645", null, "1.2.3-alpha.645+Branch.hotfix-foo.Sha.a682956dc1a2752aa24597a0f5cd939f93614509")] - [TestCase("hotfix-foo", "a682956dc1a2752aa24597a0f5cd939f93614509", "a682956d", 1, 2, 3, "beta645", null, "1.2.3-beta.645+Branch.hotfix-foo.Sha.a682956dc1a2752aa24597a0f5cd939f93614509")] - [TestCase("hotfix-foo", "a682956dc1a2752aa24597a0f5cd939f93614509", "a682956d", 1, 2, 3, null, null, "1.2.3+Branch.hotfix-foo.Sha.a682956dc1a2752aa24597a0f5cd939f93614509")] - [TestCase("master", "a682956dc1a2752aa24597a0f5cd939f93614509", "a682956d", 1, 2, 3, null, null, "1.2.3+Branch.master.Sha.a682956dc1a2752aa24597a0f5cd939f93614509")] - [TestCase("myPullRequest", "a682956dc1a2752aa24597a0f5cd939f93614509", "a682956d", 1, 2, 3, "unstable3", null, "1.2.3-unstable.3+Branch.myPullRequest.Sha.a682956dc1a2752aa24597a0f5cd939f93614509")] - [TestCase("release-1.2", "a682956dc1a2752aa24597a0f5cd939f93614509", "a682956d", 1, 2, 0, "beta2", null, "1.2.0-beta.2+Branch.release-1.2.Sha.a682956dc1a2752aa24597a0f5cd939f93614509")] - [TestCase("release-1.2", "a682956dc1a2752aa24597a0f5cd939f93614509", "a682956d", 1, 2, 0, "alpha2", null, "1.2.0-alpha.2+Branch.release-1.2.Sha.a682956dc1a2752aa24597a0f5cd939f93614509")] - public void ValidateInformationalVersionBuilder(string branchName, string sha, string shortSha, int major, int minor, int patch, + [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")] + [TestCase("develop", "a682956dc1a2752aa24597a0f5cd939f93614509", 1, 2, 3, "unstable645", null, "1.2.3-unstable.645+Branch.develop.Sha.a682956dc1a2752aa24597a0f5cd939f93614509")] + [TestCase("develop", "a682956dc1a2752aa24597a0f5cd939f93614509", 1, 2, 3, "beta645", null, "1.2.3-beta.645+Branch.develop.Sha.a682956dc1a2752aa24597a0f5cd939f93614509")] + [TestCase("hotfix-foo", "a682956dc1a2752aa24597a0f5cd939f93614509", 1, 2, 3, "alpha645", null, "1.2.3-alpha.645+Branch.hotfix-foo.Sha.a682956dc1a2752aa24597a0f5cd939f93614509")] + [TestCase("hotfix-foo", "a682956dc1a2752aa24597a0f5cd939f93614509", 1, 2, 3, "beta645", null, "1.2.3-beta.645+Branch.hotfix-foo.Sha.a682956dc1a2752aa24597a0f5cd939f93614509")] + [TestCase("hotfix-foo", "a682956dc1a2752aa24597a0f5cd939f93614509", 1, 2, 3, null, null, "1.2.3+Branch.hotfix-foo.Sha.a682956dc1a2752aa24597a0f5cd939f93614509")] + [TestCase("master", "a682956dc1a2752aa24597a0f5cd939f93614509", 1, 2, 3, null, null, "1.2.3+Branch.master.Sha.a682956dc1a2752aa24597a0f5cd939f93614509")] + [TestCase("myPullRequest", "a682956dc1a2752aa24597a0f5cd939f93614509", 1, 2, 3, "unstable3", null, "1.2.3-unstable.3+Branch.myPullRequest.Sha.a682956dc1a2752aa24597a0f5cd939f93614509")] + [TestCase("release-1.2", "a682956dc1a2752aa24597a0f5cd939f93614509", 1, 2, 0, "beta2", null, "1.2.0-beta.2+Branch.release-1.2.Sha.a682956dc1a2752aa24597a0f5cd939f93614509")] + [TestCase("release-1.2", "a682956dc1a2752aa24597a0f5cd939f93614509", 1, 2, 0, "alpha2", null, "1.2.0-alpha.2+Branch.release-1.2.Sha.a682956dc1a2752aa24597a0f5cd939f93614509")] + public void ValidateInformationalVersionBuilder(string branchName, string sha, int major, int minor, int patch, string tag, int? suffix, string versionString) { var semanticVersion = new SemanticVersion @@ -26,7 +25,7 @@ public void ValidateInformationalVersionBuilder(string branchName, string sha, s Minor = minor, Patch = patch, PreReleaseTag = tag, - BuildMetaData = new SemanticVersionBuildMetaData(suffix, branchName, sha, shortSha, DateTimeOffset.MinValue), + BuildMetaData = new SemanticVersionBuildMetaData(suffix, branchName,sha,DateTimeOffset.MinValue), }; var informationalVersion = semanticVersion.ToString("i"); diff --git a/src/GitVersionCore.Tests/Init/InitScenarios.cs b/src/GitVersionCore.Tests/Init/InitScenarios.cs index 4978a81425..57748cc488 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 : TestBase + public class InitScenarios { [SetUp] public void Setup() diff --git a/src/GitVersionCore.Tests/IntegrationTests/BranchWithoutCommitScenario.cs b/src/GitVersionCore.Tests/IntegrationTests/BranchWithoutCommitScenario.cs index aec7d8d465..e7b3793ca9 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 : TestBase +public class BranchWithoutCommitScenario { [Test] public void CanTakeVersionFromReleaseBranch() diff --git a/src/GitVersionCore.Tests/IntegrationTests/DevelopScenarios.cs b/src/GitVersionCore.Tests/IntegrationTests/DevelopScenarios.cs index 9f505afbf4..e95d420615 100644 --- a/src/GitVersionCore.Tests/IntegrationTests/DevelopScenarios.cs +++ b/src/GitVersionCore.Tests/IntegrationTests/DevelopScenarios.cs @@ -1,4 +1,4 @@ -using GitTools.Testing; +using GitTools.Testing; using GitVersion; using GitVersionCore.Tests; using LibGit2Sharp; @@ -6,7 +6,7 @@ using System.Collections.Generic; [TestFixture] -public class DevelopScenarios : TestBase +public class DevelopScenarios { [Test] public void WhenDevelopHasMultipleCommits_SpecifyExistingCommitId() @@ -183,25 +183,4 @@ public void InheritVersionFromReleaseBranch() fixture.AssertFullSemver("2.1.0-MyFeature.1+5"); } } - - [Test] - public void WhenMultipleDevelopBranchesExistAndCurrentBranchHasIncrementInheritPolicyAndCurrentCommitIsAMerge() - { - using (var fixture = new EmptyRepositoryFixture()) - { - fixture.Repository.MakeATaggedCommit("1.0.0"); - fixture.Repository.CreateBranch("bob_develop"); - fixture.Repository.CreateBranch("develop"); - fixture.Repository.CreateBranch("feature/x"); - - Commands.Checkout(fixture.Repository, "develop"); - fixture.Repository.MakeACommit(); - - Commands.Checkout(fixture.Repository, "feature/x"); - fixture.Repository.MakeACommit(); - fixture.Repository.MergeNoFF("develop"); - - fixture.AssertFullSemver("1.0.1-x.1+3"); - } - } -} +} \ No newline at end of file diff --git a/src/GitVersionCore.Tests/IntegrationTests/DocumentationSamples.cs b/src/GitVersionCore.Tests/IntegrationTests/DocumentationSamples.cs index 2b8dbc90f7..d61baa7d12 100644 --- a/src/GitVersionCore.Tests/IntegrationTests/DocumentationSamples.cs +++ b/src/GitVersionCore.Tests/IntegrationTests/DocumentationSamples.cs @@ -1,12 +1,12 @@ -using System; +using System; +using GitTools; using GitTools.Testing; -using GitVersion; using GitVersionCore.Tests; using NUnit.Framework; using Shouldly; [TestFixture] -public class DocumentationSamples : TestBase +public class DocumentationSamples { [Test] public void GitFlowFeatureBranch() @@ -423,4 +423,4 @@ public void GitHubFlowMajorRelease() fixture.AssertFullSemver("2.0.1+1"); } } -} +} \ No newline at end of file diff --git a/src/GitVersionCore.Tests/IntegrationTests/FeatureBranchScenarios.cs b/src/GitVersionCore.Tests/IntegrationTests/FeatureBranchScenarios.cs index 7bd7506d1a..7d5bf8c5ae 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 : TestBase +public class FeatureBranchScenarios { [Test] public void ShouldInheritIncrementCorrectlyWithMultiplePossibleParentsAndWeirdlyNamedDevelopBranch() diff --git a/src/GitVersionCore.Tests/IntegrationTests/FileSystemTests.cs b/src/GitVersionCore.Tests/IntegrationTests/FileSystemTests.cs index 378c30e123..b047022b24 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 : TestBase +public class FileSystemTests { public string TempFilePath { get; set; } diff --git a/src/GitVersionCore.Tests/IntegrationTests/HotfixBranchScenarios.cs b/src/GitVersionCore.Tests/IntegrationTests/HotfixBranchScenarios.cs index 8859bd03e0..285a542958 100644 --- a/src/GitVersionCore.Tests/IntegrationTests/HotfixBranchScenarios.cs +++ b/src/GitVersionCore.Tests/IntegrationTests/HotfixBranchScenarios.cs @@ -3,10 +3,9 @@ using GitVersionCore.Tests; using LibGit2Sharp; using NUnit.Framework; -using GitVersion; [TestFixture] -public class HotfixBranchScenarios : TestBase +public class HotfixBranchScenarios { [Test] // This test actually validates #465 as well @@ -124,116 +123,4 @@ public void PatchOlderReleaseExample() fixture.AssertFullSemver("2.1.0-alpha.7"); } } - - /// - /// Create a feature branch from a hotfix branch, and merge back, then delete it - /// - [Test] - public void FeatureOnHotfix_FeatureBranchDeleted() - { - var config = new Config - { - AssemblyVersioningScheme = AssemblyVersioningScheme.MajorMinorPatchTag, - VersioningMode = VersioningMode.ContinuousDeployment - }; - - using (var fixture = new EmptyRepositoryFixture()) - { - - var release450 = "release/4.5.0"; - var hotfix451 = "hotfix/4.5.1"; - var support45 = "support/4.5"; - var tag450 = "4.5.0"; - var featureBranch = "feature/some-bug-fix"; - - fixture.Repository.MakeACommit("initial"); - fixture.Repository.CreateBranch("develop"); - Commands.Checkout(fixture.Repository, "develop"); - - // create release branch - fixture.Repository.CreateBranch(release450); - Commands.Checkout(fixture.Repository, release450); - fixture.AssertFullSemver(config, "4.5.0-beta.0"); - fixture.Repository.MakeACommit("blabla"); - Commands.Checkout(fixture.Repository, "develop"); - fixture.Repository.MergeNoFF(release450, Generate.SignatureNow()); - Commands.Checkout(fixture.Repository, "master"); - fixture.Repository.MergeNoFF(release450, Generate.SignatureNow()); - - // create support branch - fixture.Repository.CreateBranch(support45); - Commands.Checkout(fixture.Repository, support45); - fixture.Repository.ApplyTag(tag450); - fixture.AssertFullSemver(config, "4.5.0"); - - // create hotfix branch - fixture.Repository.CreateBranch(hotfix451); - Commands.Checkout(fixture.Repository, hotfix451); - - // feature branch from hotfix - fixture.Repository.CreateBranch(featureBranch); - Commands.Checkout(fixture.Repository, featureBranch); - fixture.Repository.MakeACommit("blabla"); // commit 1 - Commands.Checkout(fixture.Repository, hotfix451); - fixture.Repository.MergeNoFF(featureBranch, Generate.SignatureNow()); // commit 2 - fixture.Repository.Branches.Remove(featureBranch); - fixture.AssertFullSemver(config, "4.5.1-beta.2"); - } - } - - /// - /// Create a feature branch from a hotfix branch, and merge back, but don't delete it - /// - [Test] - public void FeatureOnHotfix_FeatureBranchNotDeleted() - { - var config = new Config - { - AssemblyVersioningScheme = AssemblyVersioningScheme.MajorMinorPatchTag, - VersioningMode = VersioningMode.ContinuousDeployment - }; - - using (var fixture = new EmptyRepositoryFixture()) - { - - var release450 = "release/4.5.0"; - var hotfix451 = "hotfix/4.5.1"; - var support45 = "support/4.5"; - var tag450 = "4.5.0"; - var featureBranch = "feature/some-bug-fix"; - - fixture.Repository.MakeACommit("initial"); - fixture.Repository.CreateBranch("develop"); - Commands.Checkout(fixture.Repository, "develop"); - - // create release branch - fixture.Repository.CreateBranch(release450); - Commands.Checkout(fixture.Repository, release450); - fixture.AssertFullSemver(config, "4.5.0-beta.0"); - fixture.Repository.MakeACommit("blabla"); - Commands.Checkout(fixture.Repository, "develop"); - fixture.Repository.MergeNoFF(release450, Generate.SignatureNow()); - Commands.Checkout(fixture.Repository, "master"); - fixture.Repository.MergeNoFF(release450, Generate.SignatureNow()); - - // create support branch - fixture.Repository.CreateBranch(support45); - Commands.Checkout(fixture.Repository, support45); - fixture.Repository.ApplyTag(tag450); - fixture.AssertFullSemver(config, "4.5.0"); - - // create hotfix branch - fixture.Repository.CreateBranch(hotfix451); - Commands.Checkout(fixture.Repository, hotfix451); - - // feature branch from hotfix - fixture.Repository.CreateBranch(featureBranch); - Commands.Checkout(fixture.Repository, featureBranch); - fixture.Repository.MakeACommit("blabla"); // commit 1 - Commands.Checkout(fixture.Repository, hotfix451); - fixture.Repository.MergeNoFF(featureBranch, Generate.SignatureNow()); // commit 2 - fixture.AssertFullSemver(config, "4.5.1-beta.2"); - } - } - } \ No newline at end of file diff --git a/src/GitVersionCore.Tests/IntegrationTests/MainlineDevelopmentMode.cs b/src/GitVersionCore.Tests/IntegrationTests/MainlineDevelopmentMode.cs index 9aa32c42c9..f062d66a9c 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 : TestBase +public class MainlineDevelopmentMode { private Config config = new Config { @@ -198,94 +198,6 @@ public void VerifySupportForwardMerge() } } - [Test] - public void VerifyDevelopTracksMasterVersion() - { - using (var fixture = new EmptyRepositoryFixture()) - { - fixture.Repository.MakeACommit("1"); - fixture.MakeATaggedCommit("1.0.0"); - fixture.MakeACommit(); - - // branching increments the version - fixture.BranchTo("develop"); - fixture.AssertFullSemver(config, "1.1.0-alpha.0"); - fixture.MakeACommit(); - fixture.AssertFullSemver(config, "1.1.0-alpha.1"); - - // merging develop into master increments minor version on master - fixture.Checkout("master"); - fixture.MergeNoFF("develop"); - fixture.AssertFullSemver(config, "1.1.0"); - - // a commit on develop before the merge still has the same version number - fixture.Checkout("develop"); - fixture.AssertFullSemver(config, "1.1.0-alpha.1"); - - // moving on to further work on develop tracks master's version from the merge - fixture.MakeACommit(); - fixture.AssertFullSemver(config, "1.2.0-alpha.1"); - - // adding a commit to master increments patch - fixture.Checkout("master"); - fixture.MakeACommit(); - fixture.AssertFullSemver(config, "1.1.1"); - - // adding a commit to master doesn't change develop's version - fixture.Checkout("develop"); - fixture.AssertFullSemver(config, "1.2.0-alpha.1"); - } - } - - [Test] - public void VerifyDevelopFeatureTracksMasterVersion() - { - using (var fixture = new EmptyRepositoryFixture()) - { - fixture.Repository.MakeACommit("1"); - fixture.MakeATaggedCommit("1.0.0"); - fixture.MakeACommit(); - - // branching increments the version - fixture.BranchTo("develop"); - fixture.AssertFullSemver(config, "1.1.0-alpha.0"); - fixture.MakeACommit(); - fixture.AssertFullSemver(config, "1.1.0-alpha.1"); - - // merging develop into master increments minor version on master - fixture.Checkout("master"); - fixture.MergeNoFF("develop"); - fixture.AssertFullSemver(config, "1.1.0"); - - // a commit on develop before the merge still has the same version number - fixture.Checkout("develop"); - fixture.AssertFullSemver(config, "1.1.0-alpha.1"); - - // a branch from develop before the merge tracks the pre-merge version from master - // (note: the commit on develop looks like a commit to this branch, thus the .1) - fixture.BranchTo("feature/foo"); - fixture.AssertFullSemver(config, "1.0.2-foo.1"); - - // further work on the branch tracks the merged version from master - fixture.MakeACommit(); - fixture.AssertFullSemver(config, "1.1.1-foo.1"); - - // adding a commit to master increments patch - fixture.Checkout("master"); - fixture.MakeACommit(); - fixture.AssertFullSemver(config, "1.1.1"); - - // adding a commit to master doesn't change the feature's version - fixture.Checkout("feature/foo"); - fixture.AssertFullSemver(config, "1.1.1-foo.1"); - - // merging the feature to develop increments develop - fixture.Checkout("develop"); - fixture.MergeNoFF("feature/foo"); - fixture.AssertFullSemver(config, "1.2.0-alpha.2"); - } - } - [Test] public void VerifyMergingMasterToFeatureDoesNotCauseBranchCommitsToIncrementVersion() { diff --git a/src/GitVersionCore.Tests/IntegrationTests/MasterScenarios.cs b/src/GitVersionCore.Tests/IntegrationTests/MasterScenarios.cs index bc5f4dded1..93f9fc3832 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 : TestBase +public class MasterScenarios { [Test] public void CanHandleContinuousDelivery() diff --git a/src/GitVersionCore.Tests/IntegrationTests/OtherBranchScenarios.cs b/src/GitVersionCore.Tests/IntegrationTests/OtherBranchScenarios.cs index a5c7177fce..c1c03b5243 100644 --- a/src/GitVersionCore.Tests/IntegrationTests/OtherBranchScenarios.cs +++ b/src/GitVersionCore.Tests/IntegrationTests/OtherBranchScenarios.cs @@ -1,11 +1,11 @@ -using GitTools.Testing; +using GitTools.Testing; using GitVersionCore.Tests; using LibGit2Sharp; using NUnit.Framework; using Shouldly; [TestFixture] -public class OtherBranchScenarios : TestBase +public class OtherBranchScenarios { [Test] public void CanTakeVersionFromReleaseBranch() @@ -15,10 +15,10 @@ public void CanTakeVersionFromReleaseBranch() const string TaggedVersion = "1.0.3"; fixture.Repository.MakeATaggedCommit(TaggedVersion); fixture.Repository.MakeCommits(5); - fixture.Repository.CreateBranch("release/beta-2.0.0"); - Commands.Checkout(fixture.Repository, "release/beta-2.0.0"); + fixture.Repository.CreateBranch("alpha-2.0.0"); + Commands.Checkout(fixture.Repository, "alpha-2.0.0"); - fixture.AssertFullSemver("2.0.0-beta.1+0"); + fixture.AssertFullSemver("2.0.0-alpha.1+0"); } } @@ -57,4 +57,4 @@ public void ShouldNotGetVersionFromFeatureBranchIfNotMerged() version.SemVer.ShouldBe("1.0.0-alpha.1"); } } -} +} \ No newline at end of file diff --git a/src/GitVersionCore.Tests/IntegrationTests/OtherScenarios.cs b/src/GitVersionCore.Tests/IntegrationTests/OtherScenarios.cs index e4bda5e637..5fef1447c6 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 : TestBase + public class OtherScenarios { // 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 6bfd403a15..73951c9068 100644 --- a/src/GitVersionCore.Tests/IntegrationTests/PullRequestScenarios.cs +++ b/src/GitVersionCore.Tests/IntegrationTests/PullRequestScenarios.cs @@ -1,11 +1,11 @@ +using GitTools; using GitTools.Testing; -using GitVersion; using GitVersionCore.Tests; using LibGit2Sharp; using NUnit.Framework; [TestFixture] -public class PullRequestScenarios : TestBase +public class PullRequestScenarios { [Test] public void CanCalculatePullRequestChanges() @@ -109,4 +109,4 @@ public void CalculatesCorrectVersionAfterReleaseBranchMergedToMaster() fixture.AssertFullSemver("2.0.0-PullRequest0002.0"); } } -} +} \ No newline at end of file diff --git a/src/GitVersionCore.Tests/IntegrationTests/ReleaseBranchScenarios.cs b/src/GitVersionCore.Tests/IntegrationTests/ReleaseBranchScenarios.cs index f7a92bac01..0dacc90c58 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 : TestBase +public class ReleaseBranchScenarios { [Test] public void NoMergeBacksToDevelopInCaseThereAreNoChangesInReleaseBranch() @@ -419,44 +419,6 @@ public void CommitOnDevelop_AfterReleaseBranchMergeToDevelop_ShouldNotResetCount } } - [Test] - public void CommitBeetweenMergeReleaseToDevelop_ShouldNotResetCount() - { - var config = new Config - { - VersioningMode = VersioningMode.ContinuousDeployment - }; - - using(var fixture = new EmptyRepositoryFixture()) - { - fixture.Repository.MakeACommit("initial"); - fixture.Repository.CreateBranch("develop"); - Commands.Checkout(fixture.Repository, "develop"); - fixture.Repository.CreateBranch("release-2.0.0"); - Commands.Checkout(fixture.Repository, "release-2.0.0"); - fixture.AssertFullSemver(config, "2.0.0-beta.0"); - - // Make some commits on release - var commit1 = fixture.Repository.MakeACommit(); - var commit2 = fixture.Repository.MakeACommit(); - fixture.AssertFullSemver(config, "2.0.0-beta.2"); - - // Merge release to develop - emulate commit beetween other person release commit push and this commit merge to develop - Commands.Checkout(fixture.Repository, "develop"); - fixture.Repository.Merge(commit1, Generate.SignatureNow(), new MergeOptions { FastForwardStrategy = FastForwardStrategy.NoFastForward }); - fixture.Repository.MergeNoFF("release-2.0.0", Generate.SignatureNow()); - - // Check version on release after merge to develop - Commands.Checkout(fixture.Repository, "release-2.0.0"); - fixture.AssertFullSemver(config, "2.0.0-beta.2"); - - // Check version on release after making some new commits - fixture.Repository.MakeACommit(); - fixture.Repository.MakeACommit(); - fixture.AssertFullSemver(config, "2.0.0-beta.4"); - } - } - public void ReleaseBranchShouldUseBranchNameVersionDespiteBumpInPreviousCommit() { using (var fixture = new EmptyRepositoryFixture()) @@ -550,77 +512,4 @@ public void FeatureFromReleaseBranch_ShouldNotResetCount() fixture.AssertFullSemver(config, "2.0.0-beta.16"); } } - - /// - /// Create a feature branch from a release branch, and merge back, then delete it - /// - [Test] - public void FeatureOnRelease_FeatureBranchDeleted() - { - var config = new Config - { - AssemblyVersioningScheme = AssemblyVersioningScheme.MajorMinorPatchTag, - VersioningMode = VersioningMode.ContinuousDeployment - }; - - using (var fixture = new EmptyRepositoryFixture()) - { - var release450 = "release/4.5.0"; - var featureBranch = "feature/some-bug-fix"; - - fixture.Repository.MakeACommit("initial"); - fixture.Repository.CreateBranch("develop"); - Commands.Checkout(fixture.Repository, "develop"); - - // begin the release branch - fixture.Repository.CreateBranch(release450); - Commands.Checkout(fixture.Repository, release450); - fixture.AssertFullSemver(config, "4.5.0-beta.0"); - - fixture.Repository.CreateBranch(featureBranch); - Commands.Checkout(fixture.Repository, featureBranch); - fixture.Repository.MakeACommit("blabla"); // commit 1 - Commands.Checkout(fixture.Repository, release450); - fixture.Repository.MergeNoFF(featureBranch, Generate.SignatureNow()); // commit 2 - fixture.Repository.Branches.Remove(featureBranch); - - fixture.AssertFullSemver(config, "4.5.0-beta.2"); - } - } - - /// - /// Create a feature branch from a release branch, and merge back, but don't delete it - /// - [Test] - public void FeatureOnRelease_FeatureBranchNotDeleted() - { - var config = new Config - { - AssemblyVersioningScheme = AssemblyVersioningScheme.MajorMinorPatchTag, - VersioningMode = VersioningMode.ContinuousDeployment - }; - - using (var fixture = new EmptyRepositoryFixture()) - { - var release450 = "release/4.5.0"; - var featureBranch = "feature/some-bug-fix"; - - fixture.Repository.MakeACommit("initial"); - fixture.Repository.CreateBranch("develop"); - Commands.Checkout(fixture.Repository, "develop"); - - // begin the release branch - fixture.Repository.CreateBranch(release450); - Commands.Checkout(fixture.Repository, release450); - fixture.AssertFullSemver(config, "4.5.0-beta.0"); - - fixture.Repository.CreateBranch(featureBranch); - Commands.Checkout(fixture.Repository, featureBranch); - fixture.Repository.MakeACommit("blabla"); // commit 1 - Commands.Checkout(fixture.Repository, release450); - fixture.Repository.MergeNoFF(featureBranch, Generate.SignatureNow()); // commit 2 - - fixture.AssertFullSemver(config, "4.5.0-beta.2"); - } - } } \ No newline at end of file diff --git a/src/GitVersionCore.Tests/IntegrationTests/RemoteRepositoryScenarios.cs b/src/GitVersionCore.Tests/IntegrationTests/RemoteRepositoryScenarios.cs index 3aeca901d4..d6debdcc42 100644 --- a/src/GitVersionCore.Tests/IntegrationTests/RemoteRepositoryScenarios.cs +++ b/src/GitVersionCore.Tests/IntegrationTests/RemoteRepositoryScenarios.cs @@ -1,13 +1,14 @@ -using System; +using System; +using System.ComponentModel; +using GitTools.Git; using GitTools.Testing; -using GitVersion; using GitVersionCore.Tests; using LibGit2Sharp; using NUnit.Framework; using Shouldly; [TestFixture] -public class RemoteRepositoryScenarios : TestBase +public class RemoteRepositoryScenarios { [Test] public void GivenARemoteGitRepositoryWithCommits_ThenClonedLocalShouldMatchRemoteVersion() @@ -86,4 +87,4 @@ public void GivenARemoteGitRepositoryWhenCheckingOutDetachedhead_UsingTrackingBr fixture.AssertFullSemver("0.1.0+4", fixture.LocalRepositoryFixture.Repository); } } -} +} \ No newline at end of file diff --git a/src/GitVersionCore.Tests/IntegrationTests/SupportBranchScenarios.cs b/src/GitVersionCore.Tests/IntegrationTests/SupportBranchScenarios.cs index 2684e9b9b6..47f4037dee 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 : TestBase +public class SupportBranchScenarios { [Test] public void SupportIsCalculatedCorrectly() diff --git a/src/GitVersionCore.Tests/IntegrationTests/SwitchingToGitFlowScenarios.cs b/src/GitVersionCore.Tests/IntegrationTests/SwitchingToGitFlowScenarios.cs index 61da2ebfab..b26e05ca79 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 : TestBase +public class SwitchingToGitFlowScenarios { [Test] public void WhenDevelopBranchedFromMasterWithLegacyVersionTags_DevelopCanUseReachableTag() diff --git a/src/GitVersionCore.Tests/IntegrationTests/VersionBumpingScenarios.cs b/src/GitVersionCore.Tests/IntegrationTests/VersionBumpingScenarios.cs index aad1a5c164..bc583af524 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 : TestBase +public class VersionBumpingScenarios { [Test] public void AppliedPrereleaseTagCausesBump() diff --git a/src/GitVersionCore.Tests/IntegrationTests/VersionInCurrentBranchNameScenarios.cs b/src/GitVersionCore.Tests/IntegrationTests/VersionInCurrentBranchNameScenarios.cs deleted file mode 100644 index a879436ef4..0000000000 --- a/src/GitVersionCore.Tests/IntegrationTests/VersionInCurrentBranchNameScenarios.cs +++ /dev/null @@ -1,88 +0,0 @@ -namespace GitVersionCore.Tests.IntegrationTests -{ - using System.Collections.Generic; - using System.Linq; - - using GitTools.Testing; - - using GitVersion; - - using GitVersionCore.Tests; - - using LibGit2Sharp; - - using NUnit.Framework; - - [TestFixture] - public class VersionInCurrentBranchNameScenarios : TestBase - { - [Test] - public void TakesVersionFromNameOfReleaseBranch() - { - using (var fixture = new BaseGitFlowRepositoryFixture("1.0.0")) - { - fixture.BranchTo("release/2.0.0"); - - fixture.AssertFullSemver("2.0.0-beta.1+0"); - } - } - - [Test] - public void DoesNotTakeVersionFromNameOfNonReleaseBranch() - { - using (var fixture = new BaseGitFlowRepositoryFixture("1.0.0")) - { - fixture.BranchTo("feature/upgrade-power-level-to-9000.0.1"); - - fixture.AssertFullSemver("1.1.0-upgrade-power-level-to-9000-0-1.1+1"); - } - } - - [Test] - public void TakesVersionFromNameOfBranchThatIsReleaseByConfig() - { - var config = new Config - { - Branches = new Dictionary { { "support", new BranchConfig { IsReleaseBranch = true } } } - }; - - using (var fixture = new BaseGitFlowRepositoryFixture("1.0.0")) - { - fixture.BranchTo("support/2.0.0"); - - fixture.AssertFullSemver(config, "2.0.0+1"); - } - } - - [Test] - public void TakesVersionFromNameOfRemoteReleaseBranchInOrigin() - { - using (var fixture = new RemoteRepositoryFixture()) - { - fixture.BranchTo("release/2.0.0"); - fixture.MakeACommit(); - Commands.Fetch((Repository)fixture.LocalRepositoryFixture.Repository, fixture.LocalRepositoryFixture.Repository.Network.Remotes.First().Name, new string[0], new FetchOptions(), null); - - fixture.LocalRepositoryFixture.Checkout("origin/release/2.0.0"); - - fixture.LocalRepositoryFixture.AssertFullSemver("2.0.0-beta.1+1"); - } - } - - [Test] - public void DoesNotTakeVersionFromNameOfRemoteReleaseBranchInCustomRemote() - { - using (var fixture = new RemoteRepositoryFixture()) - { - fixture.LocalRepositoryFixture.Repository.Network.Remotes.Rename("origin", "upstream"); - fixture.BranchTo("release/2.0.0"); - fixture.MakeACommit(); - Commands.Fetch((Repository)fixture.LocalRepositoryFixture.Repository, fixture.LocalRepositoryFixture.Repository.Network.Remotes.First().Name, new string[0], new FetchOptions(), null); - - fixture.LocalRepositoryFixture.Checkout("upstream/release/2.0.0"); - - fixture.LocalRepositoryFixture.AssertFullSemver("0.1.0-beta.1+5"); - } - } - } -} diff --git a/src/GitVersionCore.Tests/IntegrationTests/VersionInMergedBranchNameScenarios.cs b/src/GitVersionCore.Tests/IntegrationTests/VersionInMergedBranchNameScenarios.cs deleted file mode 100644 index f0dad729d8..0000000000 --- a/src/GitVersionCore.Tests/IntegrationTests/VersionInMergedBranchNameScenarios.cs +++ /dev/null @@ -1,100 +0,0 @@ -namespace GitVersionCore.Tests.IntegrationTests -{ - using System.Collections.Generic; - using System.Linq; - - using GitTools.Testing; - - using GitVersion; - - using GitVersionCore.Tests; - - using LibGit2Sharp; - - using NUnit.Framework; - - [TestFixture] - public class VersionInMergedBranchNameScenarios : TestBase - { - [Test] - public void TakesVersionFromNameOfReleaseBranch() - { - using (var fixture = new BaseGitFlowRepositoryFixture("1.0.0")) - { - fixture.CreateAndMergeBranchIntoDevelop("release/2.0.0"); - - fixture.AssertFullSemver("2.1.0-alpha.2"); - } - } - - [Test] - public void DoesNotTakeVersionFromNameOfNonReleaseBranch() - { - using (var fixture = new BaseGitFlowRepositoryFixture("1.0.0")) - { - fixture.CreateAndMergeBranchIntoDevelop("pull-request/improved-by-upgrading-some-lib-to-4.5.6"); - fixture.CreateAndMergeBranchIntoDevelop("hotfix/downgrade-some-lib-to-3.2.1-to-avoid-breaking-changes"); - - fixture.AssertFullSemver("1.1.0-alpha.5"); - } - } - - [Test] - public void TakesVersionFromNameOfBranchThatIsReleaseByConfig() - { - var config = new Config - { - Branches = new Dictionary { { "support", new BranchConfig { IsReleaseBranch = true } } } - }; - - using (var fixture = new BaseGitFlowRepositoryFixture("1.0.0")) - { - fixture.CreateAndMergeBranchIntoDevelop("support/2.0.0"); - - fixture.AssertFullSemver(config, "2.1.0-alpha.2"); - } - } - - [Test] - public void TakesVersionFromNameOfRemoteReleaseBranchInOrigin() - { - using (var fixture = new RemoteRepositoryFixture()) - { - fixture.BranchTo("release/2.0.0"); - fixture.MakeACommit(); - Commands.Fetch((Repository)fixture.LocalRepositoryFixture.Repository, fixture.LocalRepositoryFixture.Repository.Network.Remotes.First().Name, new string[0], new FetchOptions(), null); - - fixture.LocalRepositoryFixture.MergeNoFF("origin/release/2.0.0"); - - fixture.LocalRepositoryFixture.AssertFullSemver("2.0.0+0"); - } - } - - [Test] - public void DoesNotTakeVersionFromNameOfRemoteReleaseBranchInCustomRemote() - { - using (var fixture = new RemoteRepositoryFixture()) - { - fixture.LocalRepositoryFixture.Repository.Network.Remotes.Rename("origin", "upstream"); - fixture.BranchTo("release/2.0.0"); - fixture.MakeACommit(); - Commands.Fetch((Repository)fixture.LocalRepositoryFixture.Repository, fixture.LocalRepositoryFixture.Repository.Network.Remotes.First().Name, new string[0], new FetchOptions(), null); - - fixture.LocalRepositoryFixture.MergeNoFF("upstream/release/2.0.0"); - - fixture.LocalRepositoryFixture.AssertFullSemver("0.1.0+6"); - } - } - } - - internal static class BaseGitFlowRepositoryFixtureExtensions - { - public static void CreateAndMergeBranchIntoDevelop(this BaseGitFlowRepositoryFixture fixture, string branchName) - { - fixture.BranchTo(branchName); - fixture.MakeACommit(); - fixture.Checkout("develop"); - fixture.MergeNoFF(branchName); - } - } -} diff --git a/src/GitVersionCore.Tests/JsonVersionBuilderTests.cs b/src/GitVersionCore.Tests/JsonVersionBuilderTests.cs index 0f5bd9976b..72989d8a99 100644 --- a/src/GitVersionCore.Tests/JsonVersionBuilderTests.cs +++ b/src/GitVersionCore.Tests/JsonVersionBuilderTests.cs @@ -5,7 +5,7 @@ using Shouldly; [TestFixture] -public class JsonVersionBuilderTests : TestBase +public class JsonVersionBuilderTests { [SetUp] public void Setup() @@ -24,7 +24,7 @@ public void Json() Minor = 2, Patch = 0, PreReleaseTag = "unstable4", - BuildMetaData = new SemanticVersionBuildMetaData(5, "feature1", "commitSha", "commitShortSha", DateTimeOffset.Parse("2014-03-06 23:59:59Z")) + BuildMetaData = new SemanticVersionBuildMetaData(5, "feature1", "commitSha",DateTimeOffset.Parse("2014-03-06 23:59:59Z")) }; var config = new TestEffectiveConfiguration(); diff --git a/src/GitVersionCore.Tests/LoggerTest.cs b/src/GitVersionCore.Tests/LoggerTest.cs index e6d0a77278..e4f43f33a1 100644 --- a/src/GitVersionCore.Tests/LoggerTest.cs +++ b/src/GitVersionCore.Tests/LoggerTest.cs @@ -6,7 +6,7 @@ namespace GitVersionCore.Tests { [TestFixture] - public class LoggerTest : TestBase + public class LoggerTest { [Test] [TestCase("http")] diff --git a/src/GitVersionCore.Tests/MergeMessageTests.cs b/src/GitVersionCore.Tests/MergeMessageTests.cs deleted file mode 100644 index 42d9ca6966..0000000000 --- a/src/GitVersionCore.Tests/MergeMessageTests.cs +++ /dev/null @@ -1,222 +0,0 @@ -using GitVersion; -using NUnit.Framework; -using Shouldly; -using System; - -namespace GitVersionCore.Tests -{ - [TestFixture] - public class MergeMessageTests : TestBase - { - private readonly Config _config = new Config { TagPrefix = "[vV]" }; - - [Test] - public void NullMessageStringThrows() - { - // Act / Assert - Should.Throw(() => new MergeMessage(null, _config)); - } - - [TestCase("")] - [TestCase("\t\t ")] - public void EmptyMessageString(string message) - { - // Act - var sut = new MergeMessage(message, _config); - - // Assert - sut.TargetBranch.ShouldBeNull(); - sut.MergedBranch.ShouldBeEmpty(); - sut.IsMergedPullRequest.ShouldBeFalse(); - sut.PullRequestNumber.ShouldBeNull(); - sut.Version.ShouldBeNull(); - } - - [TestCase("")] - [TestCase("\t\t ")] - [TestCase(null)] - public void EmptyTagPrefix(string prefix) - { - // Arrange - var message = "Updated some code."; - var config = new Config { TagPrefix = prefix }; - - // Act - var sut = new MergeMessage(message, config); - - // Assert - sut.TargetBranch.ShouldBeNull(); - sut.MergedBranch.ShouldBeEmpty(); - sut.IsMergedPullRequest.ShouldBeFalse(); - sut.PullRequestNumber.ShouldBeNull(); - sut.Version.ShouldBeNull(); - } - - private static readonly object[] MergeMessages = - { - new object[] { "Merge branch 'feature/one'", "feature/one", null, null }, - new object[] { "Merge branch 'origin/feature/one'", "origin/feature/one", null, null }, - new object[] { "Merge tag 'v4.0.0' into master", "v4.0.0", "master", new SemanticVersion(4) }, - new object[] { "Merge tag 'V4.0.0' into master", "V4.0.0", "master", new SemanticVersion(4) }, - new object[] { "Merge branch 'feature/4.1/one'", "feature/4.1/one", null, new SemanticVersion(4, 1) }, - new object[] { "Merge branch 'origin/4.1/feature/one'", "origin/4.1/feature/one", null, new SemanticVersion(4, 1) }, - new object[] { "Merge tag 'v://10.10.10.10' into master", "v://10.10.10.10", "master", null } - - }; - - [TestCaseSource(nameof(MergeMessages))] - public void ParsesMergeMessage( - string message, - string expectedMergedBranch, - string expectedTargetBranch, - SemanticVersion expectedVersion) - { - // Act - var sut = new MergeMessage(message, _config); - - // Assert - sut.TargetBranch.ShouldBe(expectedTargetBranch); - sut.MergedBranch.ShouldBe(expectedMergedBranch); - sut.IsMergedPullRequest.ShouldBeFalse(); - sut.PullRequestNumber.ShouldBeNull(); - sut.Version.ShouldBe(expectedVersion); - } - - private static readonly object[] GitHubPullPullMergeMessages = - { - new object[] { "Merge pull request #1234 from feature/one", "feature/one", null, null, 1234 }, - new object[] { "Merge pull request #1234 in feature/one", "feature/one", null, null, 1234 }, - new object[] { "Merge pull request #1234 in v4.0.0", "v4.0.0", null, new SemanticVersion(4), 1234 }, - new object[] { "Merge pull request #1234 in V4.0.0", "V4.0.0", null, new SemanticVersion(4), 1234 }, - new object[] { "Merge pull request #1234 from origin/feature/one", "origin/feature/one", null, null, 1234 }, - new object[] { "Merge pull request #1234 in feature/4.1/one", "feature/4.1/one", null, new SemanticVersion(4,1), 1234 }, - new object[] { "Merge pull request #1234 in V://10.10.10.10", "V://10.10.10.10", null, null, 1234 }, - - - //TODO: Investigate successful github merge messages that may be invalid - // Should an empty PR number be valid? - new object[] { "Merge pull request # from feature/one", "feature/one", null, null, 0 }, - // The branch name appears to be incorrect - new object[] { "Merge pull request #1234 from feature/one into dev", "feature/one into dev", "dev", null, 1234 }, - }; - - [TestCaseSource(nameof(GitHubPullPullMergeMessages))] - public void ParsesGitHubPullMergeMessage( - string message, - string expectedMergedBranch, - string expectedTargetBranch, - SemanticVersion expectedVersion, - int? expectedPullRequestNumber) - { - // Act - var sut = new MergeMessage(message, _config); - - // Assert - sut.TargetBranch.ShouldBe(expectedTargetBranch); - sut.MergedBranch.ShouldBe(expectedMergedBranch); - sut.IsMergedPullRequest.ShouldBeTrue(); - sut.PullRequestNumber.ShouldBe(expectedPullRequestNumber); - sut.Version.ShouldBe(expectedVersion); - } - - private static readonly object[] BitBucketPullMergeMessages = - { - new object[] { "Merge pull request #1234 from feature/one from feature/two to dev", "feature/two", null, null, 1234 }, - new object[] { "Merge pull request #1234 in feature/one from feature/two to dev", "feature/two", null, null, 1234 }, - new object[] { "Merge pull request #1234 in v4.0.0 from v4.1.0 to dev", "v4.1.0", null, new SemanticVersion(4,1), 1234 }, - new object[] { "Merge pull request #1234 in V4.0.0 from V4.1.0 to dev", "V4.1.0", null, new SemanticVersion(4,1), 1234 }, - new object[] { "Merge pull request #1234 from origin/feature/one from origin/feature/4.2/two to dev", "origin/feature/4.2/two", null, new SemanticVersion(4,2), 1234 }, - new object[] { "Merge pull request #1234 in feature/4.1/one from feature/4.2/two to dev", "feature/4.2/two", null, new SemanticVersion(4,2), 1234 }, - new object[] { "Merge pull request #1234 in feature/4.1/one from feature/4.2/two to dev into master", "feature/4.2/two", "master", new SemanticVersion(4,2), 1234 }, - new object[] { "Merge pull request #1234 in V4.1.0 from V://10.10.10.10 to dev", "V://10.10.10.10", null, null, 1234 }, - //TODO: Investigate successful bitbucket merge messages that may be invalid - // Regex has double 'from/in from' section. Is that correct? - new object[] { "Merge pull request #1234 in feature/4.1/one from feature/4.2/two to dev", "feature/4.2/two", null, new SemanticVersion(4,2), 1234 }, - new object[] { "Merge pull request #1234 from feature/one from v4.0.0 to master", "v4.0.0", null, new SemanticVersion(4), 1234 }, - // target branch is not resolved from targetbranch group - new object[] { "Merge pull request #1234 from feature/one from feature/two to master" , "feature/two", null, null, 1234 }, - // Should an empty PR number be valid? - new object[] { "Merge pull request # in feature/one from feature/two to master" , "feature/two", null, null, 0 } - }; - - [TestCaseSource(nameof(BitBucketPullMergeMessages))] - public void ParsesBitBucketPullMergeMessage( - string message, - string expectedMergedBranch, - string expectedTargetBranch, - SemanticVersion expectedVersion, - int? expectedPullRequestNumber) - { - // Act - var sut = new MergeMessage(message, _config); - - // Assert - sut.TargetBranch.ShouldBe(expectedTargetBranch); - sut.MergedBranch.ShouldBe(expectedMergedBranch); - sut.IsMergedPullRequest.ShouldBeTrue(); - sut.PullRequestNumber.ShouldBe(expectedPullRequestNumber); - sut.Version.ShouldBe(expectedVersion); - } - - private static readonly object[] SmartGitMergeMessages = - { - new object[] { "Finish feature/one", "feature/one", null, null }, - new object[] { "Finish origin/feature/one", "origin/feature/one", null, null }, - new object[] { "Finish v4.0.0", "v4.0.0", null, new SemanticVersion(4) }, - new object[] { "Finish feature/4.1/one", "feature/4.1/one", null, new SemanticVersion(4, 1) }, - new object[] { "Finish origin/4.1/feature/one", "origin/4.1/feature/one", null, new SemanticVersion(4, 1) }, - new object[] { "Finish V://10.10.10.10", "V://10.10.10.10", null, null }, - - //TODO: Investigate successful smart git merge messages that may be invalid - // The branch name appears to be incorrect - new object[] { "Finish V4.0.0 into master", "V4.0.0 into master", "master", new SemanticVersion(4) } - }; - - [TestCaseSource(nameof(SmartGitMergeMessages))] - public void ParsesSmartGitMergeMessage( - string message, - string expectedMergedBranch, - string expectedTargetBranch, - SemanticVersion expectedVersion) - { - // Act - var sut = new MergeMessage(message, _config); - - // Assert - sut.TargetBranch.ShouldBe(expectedTargetBranch); - sut.MergedBranch.ShouldBe(expectedMergedBranch); - sut.IsMergedPullRequest.ShouldBeFalse(); - sut.PullRequestNumber.ShouldBeNull(); - sut.Version.ShouldBe(expectedVersion); - } - - private static readonly object[] RemoteTrackingMergeMessages = - { - new object[] { "Merge remote-tracking branch 'feature/one' into master", "feature/one", "master", null }, - new object[] { "Merge remote-tracking branch 'origin/feature/one' into dev", "origin/feature/one", "dev", null }, - new object[] { "Merge remote-tracking branch 'v4.0.0' into master", "v4.0.0", "master", new SemanticVersion(4) }, - new object[] { "Merge remote-tracking branch 'V4.0.0' into master", "V4.0.0", "master", new SemanticVersion(4) }, - new object[] { "Merge remote-tracking branch 'feature/4.1/one' into dev", "feature/4.1/one", "dev", new SemanticVersion(4, 1) }, - new object[] { "Merge remote-tracking branch 'origin/4.1/feature/one' into master", "origin/4.1/feature/one", "master", new SemanticVersion(4, 1) }, - new object[] { "Merge remote-tracking branch 'v://10.10.10.10' into master", "v://10.10.10.10", "master", null } - }; - - [TestCaseSource(nameof(RemoteTrackingMergeMessages))] - public void ParsesRemoteTrackingMergeMessage( - string message, - string expectedMergedBranch, - string expectedTargetBranch, - SemanticVersion expectedVersion) - { - // Act - var sut = new MergeMessage(message, _config); - - // Assert - sut.TargetBranch.ShouldBe(expectedTargetBranch); - sut.MergedBranch.ShouldBe(expectedMergedBranch); - sut.IsMergedPullRequest.ShouldBeFalse(); - sut.PullRequestNumber.ShouldBeNull(); - sut.Version.ShouldBe(expectedVersion); - } - } -} diff --git a/src/GitVersionCore.Tests/Mocks/MockQueryableCommitLog.cs b/src/GitVersionCore.Tests/Mocks/MockQueryableCommitLog.cs index b8a57127ba..d9241619b7 100644 --- a/src/GitVersionCore.Tests/Mocks/MockQueryableCommitLog.cs +++ b/src/GitVersionCore.Tests/Mocks/MockQueryableCommitLog.cs @@ -36,7 +36,14 @@ 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 fa04ecf06e..e32b4f5e04 100644 --- a/src/GitVersionCore.Tests/Mocks/MockThreadSleep.cs +++ b/src/GitVersionCore.Tests/Mocks/MockThreadSleep.cs @@ -1,21 +1,20 @@ using System; using GitVersion.Helpers; -using System.Threading.Tasks; public class MockThreadSleep : IThreadSleep { - private Func Validator; - - public MockThreadSleep(Func validator = null) + private Action Validator; + + public MockThreadSleep(Action validator = null) { this.Validator = validator; } - public async Task SleepAsync(int milliseconds) + public void Sleep(int milliseconds) { if (Validator != null) { - await Validator(milliseconds); + Validator(milliseconds); } } } diff --git a/src/GitVersionCore.Tests/OperationWithExponentialBackoffTests.cs b/src/GitVersionCore.Tests/OperationWithExponentialBackoffTests.cs index 9f1b84634f..0e8ad200fd 100644 --- a/src/GitVersionCore.Tests/OperationWithExponentialBackoffTests.cs +++ b/src/GitVersionCore.Tests/OperationWithExponentialBackoffTests.cs @@ -3,11 +3,9 @@ using GitVersion.Helpers; using NUnit.Framework; using Shouldly; -using System.Threading.Tasks; -using GitVersionCore.Tests; [TestFixture] -public class OperationWithExponentialBackoffTests : TestBase +public class OperationWithExponentialBackoffTests { [Test] public void RetryOperationThrowsWhenNegativeMaxRetries() @@ -24,7 +22,7 @@ public void RetryOperationThrowsWhenThreadSleepIsNull() } [Test] - public async Task OperationIsNotRetriedOnInvalidException() + public void OperationIsNotRetriedOnInvalidException() { Action operation = () => { @@ -32,12 +30,12 @@ public async Task OperationIsNotRetriedOnInvalidException() }; var retryOperation = new OperationWithExponentialBackoff(new MockThreadSleep(), operation); - Task action = retryOperation.ExecuteAsync(); - await action.ShouldThrowAsync(); + Action action = () => retryOperation.Execute(); + action.ShouldThrow(); } [Test] - public async Task OperationIsRetriedOnIOException() + public void OperationIsRetriedOnIOException() { var operationCount = 0; @@ -51,13 +49,13 @@ public async Task OperationIsRetriedOnIOException() }; var retryOperation = new OperationWithExponentialBackoff(new MockThreadSleep(), operation); - await retryOperation.ExecuteAsync(); + retryOperation.Execute(); operationCount.ShouldBe(2); } [Test] - public async Task OperationIsRetriedAMaximumNumberOfTimesAsync() + public void OperationIsRetriedAMaximumNumberOfTimes() { const int numberOfRetries = 3; var operationCount = 0; @@ -69,14 +67,14 @@ public async Task OperationIsRetriedAMaximumNumberOfTimesAsync() }; var retryOperation = new OperationWithExponentialBackoff(new MockThreadSleep(), operation, numberOfRetries); - Task action = retryOperation.ExecuteAsync(); - await action.ShouldThrowAsync(); + Action action = () => retryOperation.Execute(); + action.ShouldThrow(); operationCount.ShouldBe(numberOfRetries + 1); } [Test] - public async Task OperationDelayDoublesBetweenRetries() + public void OperationDelayDoublesBetweenRetries() { const int numberOfRetries = 3; var expectedSleepMSec = 500; @@ -87,28 +85,22 @@ public async Task OperationDelayDoublesBetweenRetries() throw new IOException(); }; - Func validator = (u) => + Action validator = u => { - return Task.Run(() => - { - sleepCount++; - u.ShouldBe(expectedSleepMSec); - expectedSleepMSec *= 2; - }); - + sleepCount++; + u.ShouldBe(expectedSleepMSec); + expectedSleepMSec *= 2; }; var retryOperation = new OperationWithExponentialBackoff(new MockThreadSleep(validator), operation, numberOfRetries); - Task action = retryOperation.ExecuteAsync(); - await action.ShouldThrowAsync(); - - // action.ShouldThrow(); + Action action = () => retryOperation.Execute(); + action.ShouldThrow(); sleepCount.ShouldBe(numberOfRetries); } [Test] - public async Task TotalSleepTimeForSixRetriesIsAboutThirtySecondsAsync() + public void TotalSleepTimeForSixRetriesIsAboutThirtySeconds() { const int numberOfRetries = 6; int totalSleep = 0; @@ -118,21 +110,14 @@ public async Task TotalSleepTimeForSixRetriesIsAboutThirtySecondsAsync() throw new IOException(); }; - Func validator = (u) => + Action validator = u => { - return Task.Run(() => - { - totalSleep += u; - }); - + totalSleep += u; }; var retryOperation = new OperationWithExponentialBackoff(new MockThreadSleep(validator), operation, numberOfRetries); - - Task action = retryOperation.ExecuteAsync(); - await action.ShouldThrowAsync(); - // Action action = () => retryOperation.ExecuteAsync(); - // action.ShouldThrow(); + Action action = () => retryOperation.Execute(); + 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 a44cb3e04c..498d91c998 100644 --- a/src/GitVersionCore.Tests/SemanticVersionTests.cs +++ b/src/GitVersionCore.Tests/SemanticVersionTests.cs @@ -1,10 +1,9 @@ using GitVersion; -using GitVersionCore.Tests; using NUnit.Framework; using Shouldly; [TestFixture] -public class SemanticVersionTests : TestBase +public class SemanticVersionTests { [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 deleted file mode 100644 index 53381cf9cc..0000000000 --- a/src/GitVersionCore.Tests/TestBase.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace GitVersionCore.Tests -{ - public class TestBase - { - static TestBase() - { - ModuleInitializer.Initialize(); - } - - } -} diff --git a/src/GitVersionCore.Tests/TestableVersionVariables.cs b/src/GitVersionCore.Tests/TestableVersionVariables.cs index 33fb8d330e..5f2ba8e64d 100644 --- a/src/GitVersionCore.Tests/TestableVersionVariables.cs +++ b/src/GitVersionCore.Tests/TestableVersionVariables.cs @@ -4,7 +4,7 @@ class TestableVersionVariables : VersionVariables { - public TestableVersionVariables(string major = "", string minor = "", string patch = "", string buildMetaData = "", string buildMetaDataPadded = "", string fullBuildMetaData = "", string branchName = "", string sha = "", string shortSha = "", string majorMinorPatch = "", string semVer = "", string legacySemVer = "", string legacySemVerPadded = "", string fullSemVer = "", string assemblySemVer = "", string assemblySemFileVer = "", string preReleaseTag = "", string preReleaseTagWithDash = "", string preReleaseLabel = "", string preReleaseNumber = "", string informationalVersion = "", string commitDate = "", string nugetVersion = "", string nugetVersionV2 = "", string nugetPreReleaseTag = "", string nugetPreReleaseTagV2 = "", string commitsSinceVersionSource = "", string commitsSinceVersionSourcePadded = "") : base(major, minor, patch, buildMetaData, buildMetaDataPadded, fullBuildMetaData, branchName, sha, shortSha, majorMinorPatch, semVer, legacySemVer, legacySemVerPadded, fullSemVer, assemblySemVer, assemblySemFileVer, preReleaseTag, preReleaseTagWithDash, preReleaseLabel, preReleaseNumber, informationalVersion, commitDate, nugetVersion, nugetVersionV2, nugetPreReleaseTag, nugetPreReleaseTagV2, commitsSinceVersionSource, commitsSinceVersionSourcePadded) + public TestableVersionVariables(string major = "", string minor = "", string patch = "", string buildMetaData = "", string buildMetaDataPadded = "", string fullBuildMetaData = "", string branchName = "", string sha = "", string majorMinorPatch = "", string semVer = "", string legacySemVer = "", string legacySemVerPadded = "", string fullSemVer = "", string assemblySemVer = "", string assemblySemFileVer = "", string preReleaseTag = "", string preReleaseTagWithDash = "", string preReleaseLabel = "", string preReleaseNumber = "", string informationalVersion = "", string commitDate = "", string nugetVersion = "", string nugetVersionV2 = "", string nugetPreReleaseTag = "", string nugetPreReleaseTagV2 = "", string commitsSinceVersionSource = "", string commitsSinceVersionSourcePadded = "") : base(major, minor, patch, buildMetaData, buildMetaDataPadded, fullBuildMetaData, branchName, sha, majorMinorPatch, semVer, legacySemVer, legacySemVerPadded, fullSemVer, assemblySemVer, assemblySemFileVer, preReleaseTag, preReleaseTagWithDash, preReleaseLabel, preReleaseNumber, informationalVersion, commitDate, nugetVersion, nugetVersionV2, nugetPreReleaseTag, nugetPreReleaseTagV2, commitsSinceVersionSource, commitsSinceVersionSourcePadded) { } } diff --git a/src/GitVersionCore.Tests/VariableProviderTests.cs b/src/GitVersionCore.Tests/VariableProviderTests.cs index a5eb1ea1a5..cebf0d6862 100644 --- a/src/GitVersionCore.Tests/VariableProviderTests.cs +++ b/src/GitVersionCore.Tests/VariableProviderTests.cs @@ -5,9 +5,8 @@ using Shouldly; [TestFixture] -public class VariableProviderTests : TestBase -{ - +public class VariableProviderTests +{ [SetUp] public void Setup() { @@ -29,7 +28,6 @@ public void ProvidesVariablesInContinuousDeliveryModeForPreRelease() }; semVer.BuildMetaData.Sha = "commitSha"; - semVer.BuildMetaData.ShortSha = "commitShortSha"; semVer.BuildMetaData.CommitDate = DateTimeOffset.Parse("2014-03-06 23:59:59Z"); @@ -55,7 +53,6 @@ public void ProvidesVariablesInContinuousDeliveryModeForPreReleaseWithPadding() }; semVer.BuildMetaData.Sha = "commitSha"; - semVer.BuildMetaData.ShortSha = "commitShortSha"; semVer.BuildMetaData.CommitDate = DateTimeOffset.Parse("2014-03-06 23:59:59Z"); @@ -81,7 +78,6 @@ public void ProvidesVariablesInContinuousDeploymentModeForPreRelease() }; semVer.BuildMetaData.Sha = "commitSha"; - semVer.BuildMetaData.ShortSha = "commitShortSha"; semVer.BuildMetaData.CommitDate = DateTimeOffset.Parse("2014-03-06 23:59:59Z"); var config = new TestEffectiveConfiguration(versioningMode: VersioningMode.ContinuousDeployment); @@ -105,7 +101,6 @@ public void ProvidesVariablesInContinuousDeliveryModeForStable() }; semVer.BuildMetaData.Sha = "commitSha"; - semVer.BuildMetaData.ShortSha = "commitShortSha"; semVer.BuildMetaData.CommitDate = DateTimeOffset.Parse("2014-03-06 23:59:59Z"); var config = new TestEffectiveConfiguration(); @@ -129,7 +124,6 @@ public void ProvidesVariablesInContinuousDeploymentModeForStable() }; semVer.BuildMetaData.Sha = "commitSha"; - semVer.BuildMetaData.ShortSha = "commitShortSha"; semVer.BuildMetaData.CommitDate = DateTimeOffset.Parse("2014-03-06 23:59:59Z"); var config = new TestEffectiveConfiguration(versioningMode: VersioningMode.ContinuousDeployment); @@ -154,7 +148,6 @@ public void ProvidesVariablesInContinuousDeploymentModeForStableWhenCurrentCommi CommitsSinceTag = 5, CommitsSinceVersionSource = 5, Sha = "commitSha", - ShortSha = "commitShortSha", CommitDate = DateTimeOffset.Parse("2014-03-06 23:59:59Z") } }; @@ -180,7 +173,6 @@ public void ProvidesVariablesInContinuousDeploymentModeWithTagNamePattern() semVer.BuildMetaData.Branch = "pull/2/merge"; semVer.BuildMetaData.Sha = "commitSha"; - semVer.BuildMetaData.ShortSha = "commitShortSha"; semVer.BuildMetaData.CommitDate = DateTimeOffset.Parse("2014-03-06 23:59:59Z"); var config = new TestEffectiveConfiguration(versioningMode: VersioningMode.ContinuousDeployment, tagNumberPattern: @"[/-](?\d+)[-/]"); @@ -202,7 +194,6 @@ public void ProvidesVariablesInContinuousDeploymentModeWithTagSetToUseBranchName semVer.BuildMetaData.Branch = "feature"; semVer.BuildMetaData.Sha = "commitSha"; - semVer.BuildMetaData.ShortSha = "commitShortSha"; semVer.BuildMetaData.CommitDate = DateTimeOffset.Parse("2014-03-06 23:59:59Z"); var config = new TestEffectiveConfiguration(versioningMode: VersioningMode.ContinuousDeployment, tag: "useBranchName"); diff --git a/src/GitVersionCore.Tests/VersionCalculation/BaseVersionCalculatorTests.cs b/src/GitVersionCore.Tests/VersionCalculation/BaseVersionCalculatorTests.cs index dd53f77941..7a7057b058 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 : TestBase + public class BaseVersionCalculatorTests { [Test] public void ChoosesHighestVersionReturnedFromStrategies() diff --git a/src/GitVersionCore.Tests/VersionCalculation/NextVersionCalculatorTests.cs b/src/GitVersionCore.Tests/VersionCalculation/NextVersionCalculatorTests.cs index ffdcd5308b..b3b947b796 100644 --- a/src/GitVersionCore.Tests/VersionCalculation/NextVersionCalculatorTests.cs +++ b/src/GitVersionCore.Tests/VersionCalculation/NextVersionCalculatorTests.cs @@ -1,7 +1,8 @@ -namespace GitVersionCore.Tests.VersionCalculation +namespace GitVersionCore.Tests.VersionCalculation { using System; using System.Collections.Generic; + using GitTools; using GitTools.Testing; using GitVersion; using GitVersion.VersionCalculation; @@ -9,13 +10,13 @@ namespace GitVersionCore.Tests.VersionCalculation using NUnit.Framework; using Shouldly; - public class NextVersionCalculatorTests : TestBase + public class NextVersionCalculatorTests { [Test] public void ShouldIncrementVersionBasedOnConfig() { var baseCalculator = new TestBaseVersionCalculator(true, new SemanticVersion(1), new MockCommit()); - var semanticVersionBuildMetaData = new SemanticVersionBuildMetaData(1, "master", "b1a34edbd80e141f7cc046c074f109be7d022074", "b1a34e", DateTimeOffset.Now); + var semanticVersionBuildMetaData = new SemanticVersionBuildMetaData(1, "master", "b1a34e", DateTimeOffset.Now); var sut = new NextVersionCalculator(baseCalculator, new TestMetaDataCalculator(semanticVersionBuildMetaData)); var config = new Config(); var context = new GitVersionContextBuilder().WithConfig(config).Build(); @@ -29,7 +30,7 @@ public void ShouldIncrementVersionBasedOnConfig() public void DoesNotIncrementWhenBaseVersionSaysNotTo() { var baseCalculator = new TestBaseVersionCalculator(false, new SemanticVersion(1), new MockCommit()); - var semanticVersionBuildMetaData = new SemanticVersionBuildMetaData(1, "master", "b1a34edbd80e141f7cc046c074f109be7d022074", "b1a34e", DateTimeOffset.Now); + var semanticVersionBuildMetaData = new SemanticVersionBuildMetaData(1, "master", "b1a34e", DateTimeOffset.Now); var sut = new NextVersionCalculator(baseCalculator, new TestMetaDataCalculator(semanticVersionBuildMetaData)); var config = new Config(); var context = new GitVersionContextBuilder().WithConfig(config).Build(); @@ -43,7 +44,7 @@ public void DoesNotIncrementWhenBaseVersionSaysNotTo() public void AppliesBranchPreReleaseTag() { var baseCalculator = new TestBaseVersionCalculator(false, new SemanticVersion(1), new MockCommit()); - var semanticVersionBuildMetaData = new SemanticVersionBuildMetaData(2, "develop", "b1a34edbd80e141f7cc046c074f109be7d022074", "b1a34e", DateTimeOffset.Now); + var semanticVersionBuildMetaData = new SemanticVersionBuildMetaData(2, "develop", "b1a34e", DateTimeOffset.Now); var sut = new NextVersionCalculator(baseCalculator, new TestMetaDataCalculator(semanticVersionBuildMetaData)); var context = new GitVersionContextBuilder() .WithDevelopBranch() @@ -151,4 +152,4 @@ public void PreReleaseNumberShouldBeScopeToPreReleaseLabelInContinuousDelivery() } } } -} +} \ No newline at end of file diff --git a/src/GitVersionCore.Tests/VersionCalculation/Strategies/ConfigNextVersionBaseVersionStrategyTests.cs b/src/GitVersionCore.Tests/VersionCalculation/Strategies/ConfigNextVersionBaseVersionStrategyTests.cs index e0a6f8e6cd..1938c10d3d 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 : TestBase + public class ConfigNextVersionBaseVersionStrategyTests { [Test] public void ShouldNotBeIncremented() diff --git a/src/GitVersionCore.Tests/VersionCalculation/Strategies/MergeMessageBaseVersionStrategyTests.cs b/src/GitVersionCore.Tests/VersionCalculation/Strategies/MergeMessageBaseVersionStrategyTests.cs index 099fc536ba..18d0892aaa 100644 --- a/src/GitVersionCore.Tests/VersionCalculation/Strategies/MergeMessageBaseVersionStrategyTests.cs +++ b/src/GitVersionCore.Tests/VersionCalculation/Strategies/MergeMessageBaseVersionStrategyTests.cs @@ -1,16 +1,14 @@ -namespace GitVersionCore.Tests.VersionCalculation.Strategies +namespace GitVersionCore.Tests.VersionCalculation.Strategies { using System.Collections.Generic; using System.Linq; - - using GitVersion; using GitVersion.VersionCalculation.BaseVersionCalculators; using LibGit2Sharp; using NUnit.Framework; using Shouldly; [TestFixture] - public class MergeMessageBaseVersionStrategyTests : TestBase + public class MergeMessageBaseVersionStrategyTests { [Test] public void ShouldNotAllowIncrementOfVersion() @@ -21,7 +19,7 @@ public void ShouldNotAllowIncrementOfVersion() { Head = new MockBranch("master") { new MockCommit { - MessageEx = "Merge branch 'release-0.1.5'", + MessageEx = "Merge branch 'hotfix-0.1.5'", ParentsEx = GetParents(true) } } }).Build(); @@ -32,24 +30,38 @@ public void ShouldNotAllowIncrementOfVersion() baseVersion.ShouldIncrement.ShouldBe(false); } + [TestCase("Merge branch 'hotfix-0.1.5'", false, null)] + [TestCase("Merge branch 'develop' of github.com:Particular/NServiceBus into develop", true, null)] + [TestCase("Merge branch '4.0.3'", true, "4.0.3")] //TODO: possible make it a config option to support this [TestCase("Merge branch 'release-10.10.50'", true, "10.10.50")] + [TestCase("Merge branch 's'", true, null)] // Must start with a number + [TestCase("Merge tag '10.10.50'", true, "10.10.50")] [TestCase("Merge branch 'release-0.2.0'", true, "0.2.0")] [TestCase("Merge branch 'Release-0.2.0'", true, "0.2.0")] [TestCase("Merge branch 'Release/0.2.0'", true, "0.2.0")] - [TestCase("Merge branch 'releases-0.2.0'", true, "0.2.0")] - [TestCase("Merge branch 'Releases-0.2.0'", true, "0.2.0")] - [TestCase("Merge branch 'Releases/0.2.0'", true, "0.2.0")] - [TestCase("Merge branch 'release-4.6.6' into support-4.6", true, "4.6.6")] - [TestCase("Merge branch 'release-10.10.50'", true, "10.10.50")] - [TestCase("Merge branch 'release-0.1.5'\n\nRelates to: TicketId", true, "0.1.5")] + [TestCase("Merge branch 'hotfix-4.6.6' into support-4.6", true, "4.6.6")] + [TestCase("Merge branch 'hotfix-10.10.50'", true, "10.10.50")] + [TestCase("Merge branch 'Hotfix-10.10.50'", true, "10.10.50")] + [TestCase("Merge branch 'Hotfix/10.10.50'", true, "10.10.50")] + [TestCase("Merge branch 'hotfix-0.1.5'", true, "0.1.5")] + [TestCase("Merge branch 'hotfix-4.2.2' into support-4.2", true, "4.2.2")] + [TestCase("Merge branch 'somebranch' into release-3.0.0", true, null)] + [TestCase("Merge branch 'hotfix-0.1.5'\n\nRelates to: TicketId", true, "0.1.5")] + [TestCase("Merge branch 'alpha-0.1.5'", true, "0.1.5")] + [TestCase("Merge pull request #165 from Particular/release-1.0.0", true, "1.0.0")] + [TestCase("Merge pull request #95 from Particular/issue-94", false, null)] + [TestCase("Merge pull request #165 in Particular/release-1.0.0", true, "1.0.0")] + [TestCase("Merge pull request #95 in Particular/issue-94", true, null)] + [TestCase("Merge pull request #95 in Particular/issue-94", false, null)] + [TestCase("Merge pull request #64 from arledesma/feature-VS2013_3rd_party_test_framework_support", true, null)] + [TestCase("Merge pull request #500 in FOO/bar from Particular/release-1.0.0 to develop)", true, "1.0.0")] + [TestCase("Merge pull request #500 in FOO/bar from feature/new-service to develop)", true, null)] [TestCase("Finish Release-0.12.0", true, "0.12.0")] //Support Syntevo SmartGit/Hg's Gitflow merge commit messages for finishing a 'Release' branch + [TestCase("Finish 0.14.1", true, "0.14.1")] //Support Syntevo SmartGit/Hg's Gitflow merge commit messages for finishing a 'Hotfix' branch [TestCase("Merge branch 'Release-v0.2.0'", true, "0.2.0")] [TestCase("Merge branch 'Release-v2.2'", true, "2.2.0")] [TestCase("Merge remote-tracking branch 'origin/release/0.8.0' into develop/master", true, "0.8.0")] - [TestCase("Merge remote-tracking branch 'refs/remotes/origin/release/2.0.0'", true, "2.0.0")] - [TestCase("Merge release/5.1.0 to master", true, "5.1.0")] // Team Foundation Server 2017 default merge message (en-US) - [TestCase("Zusammengeführter PR \"9\": release/5.1.0 mit master mergen", true, "5.1.0")] // Team Foundation Server 2017 default merge message (de-DE) - public void TakesVersionFromMergeOfReleaseBranch(string message, bool isMergeCommit, string expectedVersion) + public void AssertMergeMessage(string message, bool isMergeCommit, string expectedVersion) { var parents = GetParents(isMergeCommit); AssertMergeMessage(message, expectedVersion, parents); @@ -62,56 +74,6 @@ public void TakesVersionFromMergeOfReleaseBranch(string message, bool isMergeCom AssertMergeMessage(message + "\n ", expectedVersion, parents); } - [TestCase("Merge branch 'hotfix-0.1.5'", false)] - [TestCase("Merge branch 'develop' of github.com:Particular/NServiceBus into develop", true)] - [TestCase("Merge branch '4.0.3'", true)] - [TestCase("Merge branch 's'", true)] - [TestCase("Merge tag '10.10.50'", true)] - [TestCase("Merge branch 'hotfix-4.6.6' into support-4.6", true)] - [TestCase("Merge branch 'hotfix-10.10.50'", true)] - [TestCase("Merge branch 'Hotfix-10.10.50'", true)] - [TestCase("Merge branch 'Hotfix/10.10.50'", true)] - [TestCase("Merge branch 'hotfix-0.1.5'", true)] - [TestCase("Merge branch 'hotfix-4.2.2' into support-4.2", true)] - [TestCase("Merge branch 'somebranch' into release-3.0.0", true)] - [TestCase("Merge branch 'hotfix-0.1.5'\n\nRelates to: TicketId", true)] - [TestCase("Merge branch 'alpha-0.1.5'", true)] - [TestCase("Merge pull request #95 from Particular/issue-94", false)] - [TestCase("Merge pull request #95 in Particular/issue-94", true)] - [TestCase("Merge pull request #95 in Particular/issue-94", false)] - [TestCase("Merge pull request #64 from arledesma/feature-VS2013_3rd_party_test_framework_support", true)] - [TestCase("Merge pull request #500 in FOO/bar from Particular/release-1.0.0 to develop)", true)] - [TestCase("Merge pull request #500 in FOO/bar from feature/new-service to develop)", true)] - [TestCase("Finish 0.14.1", true)] // Don't support Syntevo SmartGit/Hg's Gitflow merge commit messages for finishing a 'Hotfix' branch - public void ShouldNotTakeVersionFromMergeOfNonReleaseBranch(string message, bool isMergeCommit) - { - var parents = GetParents(isMergeCommit); - AssertMergeMessage(message, null, parents); - AssertMergeMessage(message + " ", null, parents); - AssertMergeMessage(message + "\r ", null, parents); - AssertMergeMessage(message + "\r", null, parents); - AssertMergeMessage(message + "\r\n", null, parents); - AssertMergeMessage(message + "\r\n ", null, parents); - AssertMergeMessage(message + "\n", null, parents); - AssertMergeMessage(message + "\n ", null, parents); - } - - [TestCase("Merge pull request #165 from Particular/release-1.0.0", true)] - [TestCase("Merge pull request #165 in Particular/release-1.0.0", true)] - [TestCase("Merge pull request #500 in FOO/bar from Particular/release-1.0.0 to develop)", true)] - public void ShouldNotTakeVersionFromMergeOfReleaseBranchWithRemoteOtherThanOrigin(string message, bool isMergeCommit) - { - var parents = GetParents(isMergeCommit); - AssertMergeMessage(message, null, parents); - AssertMergeMessage(message + " ", null, parents); - AssertMergeMessage(message + "\r ", null, parents); - AssertMergeMessage(message + "\r", null, parents); - AssertMergeMessage(message + "\r\n", null, parents); - AssertMergeMessage(message + "\r\n ", null, parents); - AssertMergeMessage(message + "\n", null, parents); - AssertMergeMessage(message + "\n ", null, parents); - } - [TestCase(@"Merge pull request #1 in FOO/bar from feature/ISSUE-1 to develop * commit '38560a7eed06e8d3f3f1aaf091befcdf8bf50fea': @@ -127,26 +89,14 @@ Another commit message [TestCase(@"Merge branch 'master' of http://172.16.3.10:8082/r/asu_tk/p_sd")] [TestCase(@"Merge branch 'master' of http://212.248.89.56:8082/r/asu_tk/p_sd")] [TestCase(@"Merge branch 'DEMO' of http://10.10.10.121/gitlab/mtolland/orcid into DEMO")] - public void ShouldNotTakeVersionFromUnrelatedMerge(string commitMessage) + public void MergeMessagesThatIsNotRelatedToGitVersion(string commitMessage) { var parents = GetParents(true); AssertMergeMessage(commitMessage, null, parents); } - [TestCase("Merge branch 'support/0.2.0'", "support", "0.2.0")] - [TestCase("Merge branch 'support/0.2.0'", null, null)] - [TestCase("Merge branch 'release/2.0.0'", null, "2.0.0")] - public void TakesVersionFromMergeOfConfiguredReleaseBranch(string message, string releaseBranch, string expectedVersion) - { - var config = new Config(); - if (releaseBranch != null) config.Branches[releaseBranch] = new BranchConfig { IsReleaseBranch = true }; - var parents = GetParents(true); - - AssertMergeMessage(message, expectedVersion, parents, config); - } - - static void AssertMergeMessage(string message, string expectedVersion, List parents, Config config = null) + static void AssertMergeMessage(string message, string expectedVersion, List parents) { var commit = new MockCommit { @@ -155,7 +105,6 @@ static void AssertMergeMessage(string message, string expectedVersion, List GetParents(bool isMergeCommit) }; } } -} +} \ No newline at end of file diff --git a/src/GitVersionCore.Tests/VersionCalculation/Strategies/VersionInBranchNameBaseVersionStrategyTests.cs b/src/GitVersionCore.Tests/VersionCalculation/Strategies/VersionInBranchNameBaseVersionStrategyTests.cs index a4e96e9847..01afaa0ea8 100644 --- a/src/GitVersionCore.Tests/VersionCalculation/Strategies/VersionInBranchNameBaseVersionStrategyTests.cs +++ b/src/GitVersionCore.Tests/VersionCalculation/Strategies/VersionInBranchNameBaseVersionStrategyTests.cs @@ -1,6 +1,5 @@ -namespace GitVersionCore.Tests.VersionCalculation.Strategies +namespace GitVersionCore.Tests.VersionCalculation.Strategies { - using System.Collections.Generic; using System.Linq; using GitTools.Testing; using GitVersion; @@ -10,11 +9,15 @@ namespace GitVersionCore.Tests.VersionCalculation.Strategies using Shouldly; [TestFixture] - public class VersionInBranchNameBaseVersionStrategyTests : TestBase + public class VersionInBranchNameBaseVersionStrategyTests { + [Test] [TestCase("release-2.0.0", "2.0.0")] - [TestCase("release/3.0.0", "3.0.0")] - public void CanTakeVersionFromNameOfReleaseBranch(string branchName, string expectedBaseVersion) + [TestCase("release/2.0.0", "2.0.0")] + [TestCase("hotfix-2.0.0", "2.0.0")] + [TestCase("hotfix/2.0.0", "2.0.0")] + [TestCase("custom/JIRA-123", null)] + public void CanTakeVersionFromBranchName(string branchName, string expectedBaseVersion) { using (var fixture = new EmptyRepositoryFixture()) { @@ -23,68 +26,12 @@ public void CanTakeVersionFromNameOfReleaseBranch(string branchName, string expe var sut = new VersionInBranchNameBaseVersionStrategy(); var gitVersionContext = new GitVersionContext(fixture.Repository, branch, new Config().ApplyDefaults()); - var baseVersion = sut.GetVersions(gitVersionContext).Single(); + var baseVersion = sut.GetVersions(gitVersionContext).SingleOrDefault(); - baseVersion.SemanticVersion.ToString().ShouldBe(expectedBaseVersion); - } - } - - [TestCase("hotfix-2.0.0")] - [TestCase("hotfix/2.0.0")] - [TestCase("custom/JIRA-123")] - [TestCase("hotfix/downgrade-to-gitversion-3.6.5-to-fix-miscalculated-version")] - public void ShouldNotTakeVersionFromNameOfNonReleaseBranch(string branchName) - { - using (var fixture = new EmptyRepositoryFixture()) - { - fixture.Repository.MakeACommit(); - var branch = fixture.Repository.CreateBranch(branchName); - var sut = new VersionInBranchNameBaseVersionStrategy(); - - var gitVersionContext = new GitVersionContext(fixture.Repository, branch, new Config().ApplyDefaults()); - var baseVersions = sut.GetVersions(gitVersionContext); - - baseVersions.ShouldBeEmpty(); - } - } - - [TestCase("support/lts-2.0.0", "2.0.0")] - [TestCase("support-3.0.0-lts", "3.0.0")] - public void CanTakeVersionFromNameOfConfiguredReleaseBranch(string branchName, string expectedBaseVersion) - { - using (var fixture = new EmptyRepositoryFixture()) - { - fixture.Repository.MakeACommit(); - var branch = fixture.Repository.CreateBranch(branchName); - var sut = new VersionInBranchNameBaseVersionStrategy(); - var branchConfigs = new Dictionary { { "support", new BranchConfig { IsReleaseBranch = true } } }; - var config = new Config { Branches = branchConfigs }.ApplyDefaults(); - - var gitVersionContext = new GitVersionContext(fixture.Repository, branch, config); - var baseVersion = sut.GetVersions(gitVersionContext).Single(); - - baseVersion.SemanticVersion.ToString().ShouldBe(expectedBaseVersion); - } - } - - [TestCase("release-2.0.0", "2.0.0")] - [TestCase("release/3.0.0", "3.0.0")] - public void CanTakeVersionFromNameOfRemoteReleaseBranch(string branchName, string expectedBaseVersion) - { - using (var fixture = new RemoteRepositoryFixture()) - { - var branch = fixture.Repository.CreateBranch(branchName); - Commands.Checkout(fixture.Repository, branch); - fixture.MakeACommit(); - - Commands.Fetch((Repository)fixture.LocalRepositoryFixture.Repository, fixture.LocalRepositoryFixture.Repository.Network.Remotes.First().Name, new string[0], new FetchOptions(), null); - fixture.LocalRepositoryFixture.Checkout($"origin/{branchName}"); - - var sut = new VersionInBranchNameBaseVersionStrategy(); - var gitVersionContext = new GitVersionContext(fixture.Repository, branch, new Config().ApplyDefaults()); - var baseVersion = sut.GetVersions(gitVersionContext).Single(); - - baseVersion.SemanticVersion.ToString().ShouldBe(expectedBaseVersion); + if (expectedBaseVersion == null) + baseVersion.ShouldBe(null); + else + baseVersion.SemanticVersion.ToString().ShouldBe(expectedBaseVersion); } } } diff --git a/src/GitVersionCore.Tests/VersionFilters/MinDateVersionFilterTests.cs b/src/GitVersionCore.Tests/VersionFilters/MinDateVersionFilterTests.cs index a10dda8adf..6733c8ad28 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 : TestBase + public class MinDateVersionFilterTests { [Test] public void VerifyNullGuard() diff --git a/src/GitVersionCore.Tests/VersionFilters/ShaVersionFilterTests.cs b/src/GitVersionCore.Tests/VersionFilters/ShaVersionFilterTests.cs index ce36271a4f..9374fa7b0b 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 : TestBase + public class ShaVersionFilterTests { [Test] public void VerifyNullGuard() diff --git a/src/GitVersionCore.Tests/app.config b/src/GitVersionCore.Tests/app.config new file mode 100644 index 0000000000..c24557fb8a --- /dev/null +++ b/src/GitVersionCore.Tests/app.config @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/GitVersionCore.Tests/packages.config b/src/GitVersionCore.Tests/packages.config new file mode 100644 index 0000000000..0797568c38 --- /dev/null +++ b/src/GitVersionCore.Tests/packages.config @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/GitVersionCore/AssemblyInfo.cs b/src/GitVersionCore/AssemblyInfo.cs index 9067589fbb..e99b097fdb 100644 --- a/src/GitVersionCore/AssemblyInfo.cs +++ b/src/GitVersionCore/AssemblyInfo.cs @@ -1,4 +1,4 @@ -using System.Reflection; +using System.Reflection; using System.Runtime.CompilerServices; [assembly: AssemblyTitle("GitVersionCore")] @@ -10,4 +10,4 @@ [assembly: InternalsVisibleTo("GitVersionCore.Tests")] [assembly: InternalsVisibleTo("GitVersionExe.Tests")] -[assembly: AssemblyInformationalVersion("4.0.0+Branch.master.Sha.e715eb5dd515037d90a257f527e62442cae8c1c5")] +[assembly: AssemblyInformationalVersion("4.0.0-beta.12+1291.Branch.master.Sha.bc74ac2247d8a58053a33316334ada6b771a8455")] diff --git a/src/GitVersionCore/Authentication.cs b/src/GitVersionCore/Authentication.cs index b8d7d4d7ba..df366489de 100644 --- a/src/GitVersionCore/Authentication.cs +++ b/src/GitVersionCore/Authentication.cs @@ -12,4 +12,4 @@ public Authentication() public string Username; public string Password; } -} +} \ No newline at end of file diff --git a/src/GitVersionCore/AuthenticationInfo.cs b/src/GitVersionCore/AuthenticationInfo.cs deleted file mode 100644 index 634dfa991e..0000000000 --- a/src/GitVersionCore/AuthenticationInfo.cs +++ /dev/null @@ -1,27 +0,0 @@ -namespace GitVersion -{ - using LibGit2Sharp; - - public class AuthenticationInfo - { - public string Username { get; set; } - public string Password { get; set; } - public string Token { get; set; } - - public FetchOptions ToFetchOptions() - { - var fetchOptions = new FetchOptions(); - - if (!string.IsNullOrEmpty(Username)) - { - fetchOptions.CredentialsProvider = (url, user, types) => new UsernamePasswordCredentials - { - Username = Username, - Password = Password - }; - } - - return fetchOptions; - } - } -} \ No newline at end of file diff --git a/src/GitVersionCore/BuildServers/AppVeyor.cs b/src/GitVersionCore/BuildServers/AppVeyor.cs index d17a060ac9..619f6d81e2 100644 --- a/src/GitVersionCore/BuildServers/AppVeyor.cs +++ b/src/GitVersionCore/BuildServers/AppVeyor.cs @@ -23,14 +23,7 @@ public override string GenerateSetVersionMessage(VersionVariables variables) 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.ContentLength = bytes.Length; request.ContentType = "application/json"; using (var writeStream = request.GetRequestStream()) @@ -67,6 +60,5 @@ public override string[] GenerateSetParameterMessage(string name, string value) string.Format("Adding Environment Variable. name='GitVersion_{0}' value='{1}']", name, value) }; } - } } \ No newline at end of file diff --git a/src/GitVersionCore/BuildServers/BuildServerList.cs b/src/GitVersionCore/BuildServers/BuildServerList.cs index 98aba5429b..dcd4f6f5a8 100644 --- a/src/GitVersionCore/BuildServers/BuildServerList.cs +++ b/src/GitVersionCore/BuildServers/BuildServerList.cs @@ -15,7 +15,6 @@ public static class BuildServerList new GitLabCi(), new VsoAgent(), new TravisCI(), - new EnvRun(), }; public static IEnumerable GetApplicableBuildServers() diff --git a/src/GitVersionCore/BuildServers/EnvRun.cs b/src/GitVersionCore/BuildServers/EnvRun.cs deleted file mode 100644 index 8032b2779d..0000000000 --- a/src/GitVersionCore/BuildServers/EnvRun.cs +++ /dev/null @@ -1,44 +0,0 @@ -namespace GitVersion -{ - using System; - using System.IO; - - public class EnvRun : BuildServerBase - { - public override bool CanApplyToCurrentContext() - { - string envRunDatabasePath = Environment.GetEnvironmentVariable("ENVRUN_DATABASE"); - if (!string.IsNullOrEmpty(envRunDatabasePath)) - { - if (!File.Exists(envRunDatabasePath)) - { - Logger.WriteError(string.Format("The database file of EnvRun.exe was not found at {0}.", envRunDatabasePath)); - return false; - } - - return true; - } - - return false; - } - - public override string GenerateSetVersionMessage(VersionVariables variables) - { - return variables.FullSemVer; - } - - public override string[] GenerateSetParameterMessage(string name, string value) - { - return new[] - { - string.Format("@@envrun[set name='GitVersion_{0}' value='{1}']", name, value) - }; - } - - public override bool PreventFetch() - { - return true; - } - - } -} \ No newline at end of file diff --git a/src/GitVersionCore/BuildServers/MyGet.cs b/src/GitVersionCore/BuildServers/MyGet.cs index fe7a6b9453..7f652ebc9e 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", StringComparerUtils.IngoreCaseComparison); + && buildRunner.Equals("MyGet", StringComparison.InvariantCultureIgnoreCase); } 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", StringComparerUtils.IngoreCaseComparison)) + if (string.Equals(name, "LegacySemVerPadded", StringComparison.InvariantCultureIgnoreCase)) { messages.Add(string.Format("##myget[buildNumber '{0}']", ServiceMessageEscapeHelper.EscapeValue(value))); } diff --git a/src/GitVersionCore/BuildServers/VsoAgent.cs b/src/GitVersionCore/BuildServers/VsoAgent.cs index 67494b9b03..b629a4d9c9 100644 --- a/src/GitVersionCore/BuildServers/VsoAgent.cs +++ b/src/GitVersionCore/BuildServers/VsoAgent.cs @@ -1,4 +1,4 @@ -namespace GitVersion +namespace GitVersion { using System; using System.Linq; @@ -6,11 +6,9 @@ namespace GitVersion public class VsoAgent : BuildServerBase { - public const string EnvironmentVariableName = "TF_BUILD"; - public override bool CanApplyToCurrentContext() { - return !string.IsNullOrEmpty(Environment.GetEnvironmentVariable(EnvironmentVariableName)); + return !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("TF_BUILD")); } public override string[] GenerateSetParameterMessage(string name, string value) diff --git a/src/GitVersionCore/Configuration/Config.cs b/src/GitVersionCore/Configuration/Config.cs index ab2ac963b2..733b294292 100644 --- a/src/GitVersionCore/Configuration/Config.cs +++ b/src/GitVersionCore/Configuration/Config.cs @@ -1,4 +1,4 @@ -namespace GitVersion +namespace GitVersion { using System; using System.Collections.Generic; @@ -101,7 +101,7 @@ public BranchConfig GetConfigForBranch(string branchName) { if (branchName == null) throw new ArgumentNullException(nameof(branchName)); var matches = Branches - .Where(b => Regex.IsMatch(branchName, b.Value.Regex, RegexOptions.IgnoreCase)); + .Where(b => Regex.IsMatch(branchName, "^" + b.Value.Regex, RegexOptions.IgnoreCase)); try { @@ -135,8 +135,6 @@ T MergeObjects(T target, T source) return target; } - public bool IsReleaseBranch(string branchName) => GetConfigForBranch(branchName)?.IsReleaseBranch ?? false; - [YamlMember(Alias = "ignore")] public IgnoreConfig Ignore { get; set; } @@ -146,4 +144,4 @@ T MergeObjects(T target, T source) [YamlMember(Alias = "commit-date-format")] public string CommitDateFormat { get; set; } } -} +} \ No newline at end of file diff --git a/src/GitVersionCore/Configuration/ConfigSerialiser.cs b/src/GitVersionCore/Configuration/ConfigSerialiser.cs index 271922d36d..a67c0e30a3 100644 --- a/src/GitVersionCore/Configuration/ConfigSerialiser.cs +++ b/src/GitVersionCore/Configuration/ConfigSerialiser.cs @@ -1,4 +1,4 @@ -namespace GitVersion +namespace GitVersion { using System.IO; using YamlDotNet.Serialization; @@ -8,7 +8,7 @@ public class ConfigSerialiser { public static Config Read(TextReader reader) { - var deserializer = new DeserializerBuilder().WithNamingConvention(new HyphenatedNamingConvention()).Build(); + var deserializer = new Deserializer(null, new HyphenatedNamingConvention()); var deserialize = deserializer.Deserialize(reader); if (deserialize == null) { @@ -19,8 +19,8 @@ public static Config Read(TextReader reader) public static void Write(Config config, TextWriter writer) { - var serializer = new SerializerBuilder().WithNamingConvention(new HyphenatedNamingConvention()).Build(); + var serializer = new Serializer(SerializationOptions.None, new HyphenatedNamingConvention()); serializer.Serialize(writer, config); } } -} +} \ No newline at end of file diff --git a/src/GitVersionCore/Configuration/ConfigurationProvider.cs b/src/GitVersionCore/Configuration/ConfigurationProvider.cs index 74d586a538..6c78f4b037 100644 --- a/src/GitVersionCore/Configuration/ConfigurationProvider.cs +++ b/src/GitVersionCore/Configuration/ConfigurationProvider.cs @@ -6,6 +6,7 @@ namespace GitVersion using System.IO; using System.Linq; using System.Text; + using WarningException = System.ComponentModel.WarningException; public class ConfigurationProvider { @@ -14,13 +15,13 @@ public class ConfigurationProvider public const string DefaultConfigFileName = "GitVersion.yml"; public const string ObsoleteConfigFileName = "GitVersionConfig.yaml"; - public const string ReleaseBranchRegex = "^releases?[/-]"; - public const string FeatureBranchRegex = "^features?[/-]"; - public const string PullRequestRegex = @"^(pull|pull\-requests|pr)[/-]"; - public const string HotfixBranchRegex = "^hotfix(es)?[/-]"; - public const string SupportBranchRegex = "^support[/-]"; - public const string DevelopBranchRegex = "^dev(elop)?(ment)?$"; - public const string MasterBranchRegex = "^master$"; + public const string ReleaseBranchRegex = "releases?[/-]"; + public const string FeatureBranchRegex = "features?[/-]"; + public const string PullRequestRegex = @"(pull|pull\-requests|pr)[/-]"; + public const string HotfixBranchRegex = "hotfix(es)?[/-]"; + public const string SupportBranchRegex = "support[/-]"; + public const string DevelopBranchRegex = "dev(elop)?(ment)?$"; + public const string MasterBranchRegex = "master$"; public const string MasterBranchKey = "master"; public const string ReleaseBranchKey = "release"; public const string FeatureBranchKey = "feature"; @@ -220,8 +221,7 @@ public static void ApplyBranchDefaults(Config config, bool isMainline = false) { branchConfig.Regex = string.IsNullOrEmpty(branchConfig.Regex) ? branchRegex : branchConfig.Regex; - branchConfig.SourceBranches = branchConfig.SourceBranches == null || !branchConfig.SourceBranches.Any() - ? sourceBranches : branchConfig.SourceBranches; + branchConfig.SourceBranches = sourceBranches; branchConfig.Tag = branchConfig.Tag ?? defaultTag; branchConfig.TagNumberPattern = branchConfig.TagNumberPattern ?? defaultTagNumberPattern; branchConfig.Increment = branchConfig.Increment ?? defaultIncrementStrategy ?? config.Increment ?? DefaultIncrementStrategy; diff --git a/src/GitVersionCore/Configuration/LegacyConfig.cs b/src/GitVersionCore/Configuration/LegacyConfig.cs index d6cde67898..69d83a7a8f 100644 --- a/src/GitVersionCore/Configuration/LegacyConfig.cs +++ b/src/GitVersionCore/Configuration/LegacyConfig.cs @@ -42,9 +42,7 @@ public Dictionary Branches private T MergeObjects(T target, T source) { - - var typeInfo = typeof(T); - typeInfo.GetProperties() + typeof(T).GetProperties() .Where(prop => prop.CanRead && prop.CanWrite) .Select(_ => new { diff --git a/src/GitVersionCore/Configuration/LegacyConfigNotifier.cs b/src/GitVersionCore/Configuration/LegacyConfigNotifier.cs index 00ba347cc3..e591b9f263 100644 --- a/src/GitVersionCore/Configuration/LegacyConfigNotifier.cs +++ b/src/GitVersionCore/Configuration/LegacyConfigNotifier.cs @@ -17,8 +17,7 @@ public class LegacyConfigNotifier {ConfigurationProvider.ReleaseBranchRegex, ConfigurationProvider.ReleaseBranchKey}, {ConfigurationProvider.SupportBranchRegex, ConfigurationProvider.SupportBranchKey}, {ConfigurationProvider.PullRequestRegex, ConfigurationProvider.PullRequestBranchKey}, - {"dev(elop)?(ment)?$", ConfigurationProvider.DevelopBranchKey }, - {"release[/-]", ConfigurationProvider.ReleaseBranchKey }, + {"release[/-]", ConfigurationProvider.ReleaseBranchKey}, {"hotfix[/-]", ConfigurationProvider.HotfixBranchKey }, {"feature(s)?[/-]", ConfigurationProvider.FeatureBranchKey }, {"feature[/-]", ConfigurationProvider.FeatureBranchKey } @@ -26,8 +25,7 @@ public class LegacyConfigNotifier public static void Notify(StringReader reader) { - var deserializer = new DeserializerBuilder().WithNamingConvention(new NullNamingConvention()).IgnoreUnmatchedProperties().Build(); - + var deserializer = new Deserializer(null, new NullNamingConvention(), ignoreUnmatched: true); var legacyConfig = deserializer.Deserialize(reader); if (legacyConfig == null) return; @@ -61,4 +59,4 @@ public static void Notify(StringReader reader) throw new OldConfigurationException("GitVersion configuration file contains old configuration, please fix the following errors:\r\n" + string.Join("\r\n", issues)); } } -} +} \ No newline at end of file diff --git a/src/GitVersionCore/Exceptions/BugException.cs b/src/GitVersionCore/Exceptions/BugException.cs deleted file mode 100644 index 46651fa053..0000000000 --- a/src/GitVersionCore/Exceptions/BugException.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace GitVersion -{ - using System; - - public class BugException : Exception - { - public BugException(string message) : base(message) - { - } - } -} \ No newline at end of file diff --git a/src/GitVersionCore/Exceptions/GitToolsException.cs b/src/GitVersionCore/Exceptions/GitToolsException.cs deleted file mode 100644 index 5f563b5246..0000000000 --- a/src/GitVersionCore/Exceptions/GitToolsException.cs +++ /dev/null @@ -1,18 +0,0 @@ -namespace GitVersion -{ - using System; - - [Serializable] - public class GitToolsException : Exception - { - public GitToolsException(string messageFormat, params object[] args) - : base(string.Format(messageFormat, args)) - { - } - - public GitToolsException(string message, Exception innerException) - : base(message, innerException) - { - } - } -} \ No newline at end of file diff --git a/src/GitVersionCore/Exceptions/WarningException.cs b/src/GitVersionCore/Exceptions/WarningException.cs deleted file mode 100644 index 362ef336b4..0000000000 --- a/src/GitVersionCore/Exceptions/WarningException.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace GitVersion -{ - using System; - - [Serializable] - public class WarningException : Exception - { - public WarningException(string message) - : base(message) - { - } - } -} \ No newline at end of file diff --git a/src/GitVersionCore/ExecuteCore.cs b/src/GitVersionCore/ExecuteCore.cs index 9610798196..edb5de640f 100644 --- a/src/GitVersionCore/ExecuteCore.cs +++ b/src/GitVersionCore/ExecuteCore.cs @@ -3,6 +3,7 @@ namespace GitVersion using GitVersion.Helpers; using LibGit2Sharp; using System; + using System.ComponentModel; using System.Linq; public class ExecuteCore @@ -60,7 +61,7 @@ public VersionVariables ExecuteGitVersion(string targetUrl, string dynamicReposi { try { - gitVersionCache.WriteVariablesToDiskCache(gitPreparer, cacheKey, versionVariables); + gitVersionCache.WriteVariablesToDiskCache(gitPreparer, cacheKey, versionVariables); } catch (AggregateException e) { @@ -137,4 +138,4 @@ IRepository GetRepository(string gitDirectory) } } } -} +} \ No newline at end of file diff --git a/src/GitVersionCore/Extensions/ExtensionMethods.cs b/src/GitVersionCore/Extensions/ExtensionMethods.cs index db4d4942e8..8e09abf928 100644 --- a/src/GitVersionCore/Extensions/ExtensionMethods.cs +++ b/src/GitVersionCore/Extensions/ExtensionMethods.cs @@ -39,4 +39,4 @@ public static T OnlyOrDefault(this IEnumerable source) return default(T); } } -} +} \ No newline at end of file diff --git a/src/GitVersionCore/Extensions/ReadEmbeddedResourceExtensions.cs b/src/GitVersionCore/Extensions/ReadEmbeddedResourceExtensions.cs index 3cc29a9243..a57e7ef720 100644 --- a/src/GitVersionCore/Extensions/ReadEmbeddedResourceExtensions.cs +++ b/src/GitVersionCore/Extensions/ReadEmbeddedResourceExtensions.cs @@ -24,7 +24,6 @@ public static string ReadAsStringFromEmbeddedResource(this string resourceNam public static Stream ReadFromEmbeddedResource(this string resourceName) { var assembly = typeof(T).Assembly; - return assembly.GetManifestResourceStream(resourceName); } } diff --git a/src/GitVersionCore/FodyWeavers.xml b/src/GitVersionCore/FodyWeavers.xml new file mode 100644 index 0000000000..2ca034c764 --- /dev/null +++ b/src/GitVersionCore/FodyWeavers.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/src/GitVersionCore/GitPreparer.cs b/src/GitVersionCore/GitPreparer.cs index 4e17ed644e..50f0e48de3 100644 --- a/src/GitVersionCore/GitPreparer.cs +++ b/src/GitVersionCore/GitPreparer.cs @@ -3,6 +3,8 @@ namespace GitVersion using System; using System.IO; using System.Linq; + using GitTools.Git; + using GitTools.Logging; using LibGit2Sharp; public class GitPreparer @@ -29,6 +31,9 @@ public GitPreparer(string targetUrl, string dynamicRepositoryLocation, Authentic }; this.noFetch = noFetch; this.targetPath = targetPath.TrimEnd('/', '\\'); + + // GitTools has its own logging. So that it actually outputs something, it needs to be initialized. + LogProvider.SetCurrentLogProvider(new LoggerWrapper()); } public string TargetUrl @@ -78,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, StringComparerUtils.IngoreCaseComparison))) + if (!repo.Network.Remotes.Any(remote => remote.Name.Equals(defaultRemoteName, StringComparison.InvariantCultureIgnoreCase))) { remoteToKeep = repo.Network.Remotes.First().Name; } var duplicateRepos = repo.Network .Remotes - .Where(remote => !remote.Name.Equals(remoteToKeep, StringComparerUtils.IngoreCaseComparison)) + .Where(remote => !remote.Name.Equals(remoteToKeep, StringComparison.InvariantCultureIgnoreCase)) .Select(remote => remote.Name); // remove all remotes that are considered duplicates @@ -261,4 +266,4 @@ static void CloneRepository(string repositoryUrl, string gitDirectory, Authentic } } } -} +} \ No newline at end of file diff --git a/src/GitVersionCore/GitVersionCache.cs b/src/GitVersionCore/GitVersionCache.cs index e2b16dc871..99307c2ab6 100644 --- a/src/GitVersionCore/GitVersionCache.cs +++ b/src/GitVersionCore/GitVersionCache.cs @@ -45,7 +45,7 @@ public void WriteVariablesToDiskCache(GitPreparer gitPreparer, GitVersionCacheKe }; var retryOperation = new OperationWithExponentialBackoff(new ThreadSleep(), writeCacheOperation, maxRetries: 6); - retryOperation.ExecuteAsync().Wait(); + retryOperation.Execute(); } public static string GetCacheDirectory(GitPreparer gitPreparer) diff --git a/src/GitVersionCore/GitVersionCore.csproj b/src/GitVersionCore/GitVersionCore.csproj index b7b2d3f3c3..6115ff8281 100644 --- a/src/GitVersionCore/GitVersionCore.csproj +++ b/src/GitVersionCore/GitVersionCore.csproj @@ -1,48 +1,237 @@ - - + + + + - net461;netstandard2.0 + Debug + AnyCPU + {F9741A0D-B9D7-4557-9A1C-A7252C1071F5} + Library + Properties GitVersion - false - bin\$(Configuration)\GitVersionCore.xml + GitVersionCore + v4.0 + 6 + 512 + $(SolutionDir)..\build\ + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + bin\Debug\GitVersionCore.xml 1591 - - GitVersionCore - GitVersion - Derives SemVer information from a repository following GitFlow or GitHubFlow. This is the Core library which both GitVersion cli and Task use allowing programatic usage of GitVersion. - - $(AssemblyName) - - - NETDESKTOP + + 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 + + + + + + + + + + ..\packages\YamlDotNet.3.8.0\lib\net35\YamlDotNet.dll + True + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + + + + + + + + - - - - - + + 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/Exceptions/GitVersionException.cs b/src/GitVersionCore/GitVersionException.cs similarity index 88% rename from src/GitVersionCore/Exceptions/GitVersionException.cs rename to src/GitVersionCore/GitVersionException.cs index dfbd50332c..b6afb92952 100644 --- a/src/GitVersionCore/Exceptions/GitVersionException.cs +++ b/src/GitVersionCore/GitVersionException.cs @@ -1,7 +1,9 @@ -namespace GitVersion +namespace GitVersion { using System; + using GitTools; + [Serializable] public class GitVersionException : GitToolsException { @@ -16,4 +18,4 @@ public GitVersionException(string message, Exception innerException) { } } -} +} \ No newline at end of file diff --git a/src/GitVersionCore/GitVersionFinder.cs b/src/GitVersionCore/GitVersionFinder.cs index 053f8abf1c..77addc07c1 100644 --- a/src/GitVersionCore/GitVersionFinder.cs +++ b/src/GitVersionCore/GitVersionFinder.cs @@ -1,5 +1,6 @@ namespace GitVersion { + using System.ComponentModel; using System.IO; using GitVersion.VersionCalculation; @@ -20,7 +21,7 @@ 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"); } @@ -46,4 +47,4 @@ void EnsureHeadIsNotDetached(GitVersionContext context) throw new WarningException(message); } } -} +} \ No newline at end of file diff --git a/src/GitVersionCore/Helpers/DeleteHelper.cs b/src/GitVersionCore/Helpers/DeleteHelper.cs index 79312e2443..37888943d4 100644 --- a/src/GitVersionCore/Helpers/DeleteHelper.cs +++ b/src/GitVersionCore/Helpers/DeleteHelper.cs @@ -1,4 +1,4 @@ -namespace GitVersion +namespace GitVersion { using System.IO; @@ -24,4 +24,4 @@ public static void DeleteGitRepository(string directory) Directory.Delete(directory, true); } } -} +} \ No newline at end of file diff --git a/src/GitVersionCore/Helpers/EncodingHelper.cs b/src/GitVersionCore/Helpers/EncodingHelper.cs index 9b6f9e3cd3..392f86e2ac 100644 --- a/src/GitVersionCore/Helpers/EncodingHelper.cs +++ b/src/GitVersionCore/Helpers/EncodingHelper.cs @@ -73,14 +73,13 @@ public static Encoding DetectEncoding(IList bytes) /// An ordered list of encodings and corresponding preambles. private static void ScanEncodings() { - 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(); - + 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(); + var encodingWithLongestPreamble = EncodingsWithPreambles.FirstOrDefault(); MaxPreambleLength = encodingWithLongestPreamble == null ? 0 : encodingWithLongestPreamble.GetPreamble().Length; } diff --git a/src/GitVersionCore/Helpers/FileSystem.cs b/src/GitVersionCore/Helpers/FileSystem.cs index 551ba0c0f8..f3022e816c 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 - ? StringComparerUtils.CaseSensitiveComparison - : StringComparerUtils.IngoreCaseComparison; + ? StringComparison.InvariantCulture + : StringComparison.InvariantCultureIgnoreCase; return string.Equals( Path.GetFullPath(path).TrimEnd('\\').TrimEnd('/'), diff --git a/src/GitVersionCore/Helpers/GitRepositoryHelper.cs b/src/GitVersionCore/Helpers/GitRepositoryHelper.cs deleted file mode 100644 index 137a767bde..0000000000 --- a/src/GitVersionCore/Helpers/GitRepositoryHelper.cs +++ /dev/null @@ -1,306 +0,0 @@ -namespace GitVersion -{ - using System; - using System.Collections.Generic; - using System.Linq; - using LibGit2Sharp; - - public static class GitRepositoryHelper - { - /// - /// Normalisation of a git directory turns all remote branches into local branches, turns pull request refs into a real branch and a few other things. This is designed to be run *only on the build server* which checks out repositories in different ways. - /// It is not recommended to run normalisation against a local repository - /// - public static void NormalizeGitDirectory(string gitDirectory, AuthenticationInfo authentication, bool noFetch, string currentBranch) - { - using (var repo = new Repository(gitDirectory)) - { - // Need to unsure the HEAD does not move, this is essentially a BugCheck - var expectedSha = repo.Head.Tip.Sha; - try - { - var remote = EnsureOnlyOneRemoteIsDefined(repo); - - AddMissingRefSpecs(repo, remote); - - //If noFetch is enabled, then GitVersion will assume that the git repository is normalized before execution, so that fetching from remotes is not required. - if (noFetch) - { - Logger.WriteInfo("Skipping fetching, if GitVersion does not calculate your version as expected you might need to allow fetching or use dynamic repositories"); - } - else - { - Fetch(authentication, remote, repo); - } - - EnsureLocalBranchExistsForCurrentBranch(repo, remote, currentBranch); - CreateOrUpdateLocalBranchesFromRemoteTrackingOnes(repo, remote.Name); - - var headSha = repo.Refs.Head.TargetIdentifier; - - if (!repo.Info.IsHeadDetached) - { - Logger.WriteInfo(string.Format("HEAD points at branch '{0}'.", headSha)); - return; - } - - Logger.WriteInfo(string.Format("HEAD is detached and points at commit '{0}'.", headSha)); - Logger.WriteInfo(string.Format("Local Refs:\r\n" + string.Join(Environment.NewLine, repo.Refs.FromGlob("*").Select(r => string.Format("{0} ({1})", r.CanonicalName, r.TargetIdentifier))))); - - // In order to decide whether a fake branch is required or not, first check to see if any local branches have the same commit SHA of the head SHA. - // If they do, go ahead and checkout that branch - // If no, go ahead and check out a new branch, using the known commit SHA as the pointer - var localBranchesWhereCommitShaIsHead = repo.Branches.Where(b => !b.IsRemote && b.Tip.Sha == headSha).ToList(); - - var matchingCurrentBranch = !string.IsNullOrEmpty(currentBranch) - ? localBranchesWhereCommitShaIsHead.SingleOrDefault(b => b.CanonicalName.Replace("/heads/", "/") == currentBranch.Replace("/heads/", "/")) - : null; - if (matchingCurrentBranch != null) - { - Logger.WriteInfo(string.Format("Checking out local branch '{0}'.", currentBranch)); - Commands.Checkout(repo, matchingCurrentBranch); - } - else if (localBranchesWhereCommitShaIsHead.Count > 1) - { - var branchNames = localBranchesWhereCommitShaIsHead.Select(r => r.CanonicalName); - var csvNames = string.Join(", ", branchNames); - const string moveBranchMsg = "Move one of the branches along a commit to remove warning"; - - Logger.WriteWarning(string.Format("Found more than one local branch pointing at the commit '{0}' ({1}).", headSha, csvNames)); - var master = localBranchesWhereCommitShaIsHead.SingleOrDefault(n => n.FriendlyName == "master"); - if (master != null) - { - Logger.WriteWarning("Because one of the branches is 'master', will build master." + moveBranchMsg); - Commands.Checkout(repo, master); - } - else - { - var branchesWithoutSeparators = localBranchesWhereCommitShaIsHead.Where(b => !b.FriendlyName.Contains('/') && !b.FriendlyName.Contains('-')).ToList(); - if (branchesWithoutSeparators.Count == 1) - { - var branchWithoutSeparator = branchesWithoutSeparators[0]; - Logger.WriteWarning(string.Format("Choosing {0} as it is the only branch without / or - in it. " + moveBranchMsg, branchWithoutSeparator.CanonicalName)); - Commands.Checkout(repo, branchWithoutSeparator); - } - else - { - throw new WarningException("Failed to try and guess branch to use. " + moveBranchMsg); - } - } - } - else if (localBranchesWhereCommitShaIsHead.Count == 0) - { - Logger.WriteInfo(string.Format("No local branch pointing at the commit '{0}'. Fake branch needs to be created.", headSha)); - CreateFakeBranchPointingAtThePullRequestTip(repo, authentication); - } - else - { - Logger.WriteInfo(string.Format("Checking out local branch 'refs/heads/{0}'.", localBranchesWhereCommitShaIsHead[0].FriendlyName)); - Commands.Checkout(repo, repo.Branches[localBranchesWhereCommitShaIsHead[0].FriendlyName]); - } - } - finally - { - if (repo.Head.Tip.Sha != expectedSha) - { - if (Environment.GetEnvironmentVariable("IGNORE_NORMALISATION_GIT_HEAD_MOVE") != "1") - { - // Whoa, HEAD has moved, it shouldn't have. We need to blow up because there is a bug in normalisation - throw new BugException(string.Format(@"GitVersion has a bug, your HEAD has moved after repo normalisation. - -To disable this error set an environmental variable called IGNORE_NORMALISATION_GIT_HEAD_MOVE to 1 - -Please run `git {0}` and submit it along with your build log (with personal info removed) in a new issue at https://github.com/GitTools/GitVersion", - CreateGitLogArgs(100))); - } - } - } - } - } - - public static string CreateGitLogArgs(int? maxCommits) - { - return @"log --graph --format=""%h %cr %d"" --decorate --date=relative --all --remotes=*" + (maxCommits != null ? string.Format(" -n {0}", maxCommits) : null); - } - - public static void Fetch(AuthenticationInfo authentication, Remote remote, Repository repo) - { - Logger.WriteInfo(string.Format("Fetching from remote '{0}' using the following refspecs: {1}.", - remote.Name, string.Join(", ", remote.FetchRefSpecs.Select(r => r.Specification)))); - Commands.Fetch(repo, remote.Name, new string[0], authentication.ToFetchOptions(), null); - } - - static void EnsureLocalBranchExistsForCurrentBranch(Repository repo, Remote remote, string currentBranch) - { - if (string.IsNullOrEmpty(currentBranch)) return; - - var isRef = currentBranch.Contains("refs"); - var isBranch = currentBranch.Contains("refs/heads"); - var localCanonicalName = !isRef ? "refs/heads/" + currentBranch : isBranch ? currentBranch : currentBranch.Replace("refs/", "refs/heads/"); - - var repoTip = repo.Head.Tip; - - // We currently have the rep.Head of the *default* branch, now we need to look up the right one - var originCanonicalName = string.Format("{0}/{1}", remote.Name, currentBranch); - var originBranch = repo.Branches[originCanonicalName]; - if (originBranch != null) - { - repoTip = originBranch.Tip; - } - - var repoTipId = repoTip.Id; - - if (repo.Branches.All(b => b.CanonicalName != localCanonicalName)) - { - Logger.WriteInfo(isBranch ? - string.Format("Creating local branch {0}", localCanonicalName) : - string.Format("Creating local branch {0} pointing at {1}", localCanonicalName, repoTipId)); - repo.Refs.Add(localCanonicalName, repoTipId); - } - else - { - Logger.WriteInfo(isBranch ? - string.Format("Updating local branch {0} to point at {1}", localCanonicalName, repoTip.Sha) : - string.Format("Updating local branch {0} to match ref {1}", localCanonicalName, currentBranch)); - repo.Refs.UpdateTarget(repo.Refs[localCanonicalName], repoTipId); - } - - Commands.Checkout(repo, localCanonicalName); - } - - static void AddMissingRefSpecs(Repository repo, Remote remote) - { - if (remote.FetchRefSpecs.Any(r => r.Source == "refs/heads/*")) - return; - - var allBranchesFetchRefSpec = string.Format("+refs/heads/*:refs/remotes/{0}/*", remote.Name); - - Logger.WriteInfo(string.Format("Adding refspec: {0}", allBranchesFetchRefSpec)); - - repo.Network.Remotes.Update(remote.Name, - r => r.FetchRefSpecs.Add(allBranchesFetchRefSpec)); - } - - static void CreateFakeBranchPointingAtThePullRequestTip(Repository repo, AuthenticationInfo authentication) - { - var remote = repo.Network.Remotes.Single(); - - Logger.WriteInfo("Fetching remote refs to see if there is a pull request ref"); - var remoteTips = (string.IsNullOrEmpty(authentication.Username) ? - GetRemoteTipsForAnonymousUser(repo, remote) : - GetRemoteTipsUsingUsernamePasswordCredentials(repo, remote, authentication.Username, authentication.Password)) - .ToList(); - - Logger.WriteInfo("Remote Refs:\r\n" + string.Join(Environment.NewLine, remoteTips.Select(r => r.CanonicalName))); - - var headTipSha = repo.Head.Tip.Sha; - - var refs = remoteTips.Where(r => r.TargetIdentifier == headTipSha).ToList(); - - if (refs.Count == 0) - { - var message = string.Format("Couldn't find any remote tips from remote '{0}' pointing at the commit '{1}'.", remote.Url, headTipSha); - throw new WarningException(message); - } - - if (refs.Count > 1) - { - var names = string.Join(", ", refs.Select(r => r.CanonicalName)); - var message = string.Format("Found more than one remote tip from remote '{0}' pointing at the commit '{1}'. Unable to determine which one to use ({2}).", remote.Url, headTipSha, names); - throw new WarningException(message); - } - - var reference = refs[0]; - var canonicalName = reference.CanonicalName; - Logger.WriteInfo(string.Format("Found remote tip '{0}' pointing at the commit '{1}'.", canonicalName, headTipSha)); - - if (canonicalName.StartsWith("refs/tags")) - { - Logger.WriteInfo(string.Format("Checking out tag '{0}'", canonicalName)); - Commands.Checkout(repo, reference.Target.Sha); - return; - } - - if (!canonicalName.StartsWith("refs/pull/") && !canonicalName.StartsWith("refs/pull-requests/")) - { - var message = string.Format("Remote tip '{0}' from remote '{1}' doesn't look like a valid pull request.", canonicalName, remote.Url); - throw new WarningException(message); - } - - var fakeBranchName = canonicalName.Replace("refs/pull/", "refs/heads/pull/").Replace("refs/pull-requests/", "refs/heads/pull-requests/"); - - Logger.WriteInfo(string.Format("Creating fake local branch '{0}'.", fakeBranchName)); - repo.Refs.Add(fakeBranchName, new ObjectId(headTipSha)); - - Logger.WriteInfo(string.Format("Checking local branch '{0}' out.", fakeBranchName)); - Commands.Checkout(repo, fakeBranchName); - } - - static IEnumerable GetRemoteTipsUsingUsernamePasswordCredentials(Repository repo, Remote remote, string username, string password) - { - return repo.Network.ListReferences(remote, (url, fromUrl, types) => new UsernamePasswordCredentials - { - Username = username, - Password = password - }).Select(r => r.ResolveToDirectReference()); - } - - static IEnumerable GetRemoteTipsForAnonymousUser(Repository repo, Remote remote) - { - return repo.Network.ListReferences(remote).Select(r => r.ResolveToDirectReference()); - } - - static void CreateOrUpdateLocalBranchesFromRemoteTrackingOnes(Repository repo, string remoteName) - { - var prefix = string.Format("refs/remotes/{0}/", remoteName); - var remoteHeadCanonicalName = string.Format("{0}{1}", prefix, "HEAD"); - - foreach (var remoteTrackingReference in repo.Refs.FromGlob(prefix + "*").Where(r => r.CanonicalName != remoteHeadCanonicalName)) - { - var remoteTrackingReferenceName = remoteTrackingReference.CanonicalName; - var branchName = remoteTrackingReferenceName.Substring(prefix.Length); - var localCanonicalName = "refs/heads/" + branchName; - - // We do not want to touch our current branch - if (branchName == repo.Head.FriendlyName) continue; - - if (repo.Refs.Any(x => x.CanonicalName == localCanonicalName)) - { - var localRef = repo.Refs[localCanonicalName]; - var remotedirectReference = remoteTrackingReference.ResolveToDirectReference(); - if (localRef.ResolveToDirectReference().TargetIdentifier == remotedirectReference.TargetIdentifier) - { - Logger.WriteInfo(string.Format("Skipping update of '{0}' as it already matches the remote ref.", remoteTrackingReference.CanonicalName)); - continue; - } - var remoteRefTipId = remotedirectReference.Target.Id; - Logger.WriteInfo(string.Format("Updating local ref '{0}' to point at {1}.", localRef.CanonicalName, remoteRefTipId)); - repo.Refs.UpdateTarget(localRef, remoteRefTipId); - continue; - } - - Logger.WriteInfo(string.Format("Creating local branch from remote tracking '{0}'.", remoteTrackingReference.CanonicalName)); - repo.Refs.Add(localCanonicalName, new ObjectId(remoteTrackingReference.ResolveToDirectReference().TargetIdentifier), true); - - var branch = repo.Branches[branchName]; - repo.Branches.Update(branch, b => b.TrackedBranch = remoteTrackingReferenceName); - } - } - - public static Remote EnsureOnlyOneRemoteIsDefined(IRepository repo) - { - var remotes = repo.Network.Remotes; - var howMany = remotes.Count(); - - if (howMany == 1) - { - var remote = remotes.Single(); - Logger.WriteInfo(string.Format("One remote found ({0} -> '{1}').", remote.Name, remote.Url)); - return remote; - } - - var message = string.Format("{0} remote(s) have been detected. When being run on a build server, the Git repository is expected to bear one (and no more than one) remote.", howMany); - throw new WarningException(message); - } - } -} diff --git a/src/GitVersionCore/Helpers/IThreadSleep.cs b/src/GitVersionCore/Helpers/IThreadSleep.cs index ca6f90f302..86484d3580 100644 --- a/src/GitVersionCore/Helpers/IThreadSleep.cs +++ b/src/GitVersionCore/Helpers/IThreadSleep.cs @@ -1,9 +1,7 @@ -using System.Threading.Tasks; - -namespace GitVersion.Helpers +namespace GitVersion.Helpers { public interface IThreadSleep { - Task SleepAsync(int milliseconds); + void Sleep(int milliseconds); } } diff --git a/src/GitVersionCore/Helpers/OperationWithExponentialBackoff.cs b/src/GitVersionCore/Helpers/OperationWithExponentialBackoff.cs index 56e48cc5a3..61e6e6fd73 100644 --- a/src/GitVersionCore/Helpers/OperationWithExponentialBackoff.cs +++ b/src/GitVersionCore/Helpers/OperationWithExponentialBackoff.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Threading.Tasks; namespace GitVersion.Helpers { @@ -22,7 +21,7 @@ public OperationWithExponentialBackoff(IThreadSleep threadSleep, Action operatio this.MaxRetries = maxRetries; } - public async Task ExecuteAsync() + public void Execute() { var exceptions = new List(); @@ -48,8 +47,7 @@ public async Task ExecuteAsync() } Logger.WriteInfo(string.Format("Operation failed, retrying in {0} milliseconds.", sleepMSec)); - await ThreadSleep.SleepAsync(sleepMSec); - + ThreadSleep.Sleep(sleepMSec); sleepMSec *= 2; } } diff --git a/src/GitVersionCore/Helpers/ProcessHelper.cs b/src/GitVersionCore/Helpers/ProcessHelper.cs deleted file mode 100644 index 005323b664..0000000000 --- a/src/GitVersionCore/Helpers/ProcessHelper.cs +++ /dev/null @@ -1,212 +0,0 @@ -namespace GitVersion.Helpers -{ - using System; - using System.Collections.Generic; - using System.ComponentModel; - using System.Diagnostics; - using System.IO; - using System.Runtime.InteropServices; - using System.Threading; - - public static class ProcessHelper - { - static volatile object lockObject = new object(); - - // http://social.msdn.microsoft.com/Forums/en/netfxbcl/thread/f6069441-4ab1-4299-ad6a-b8bb9ed36be3 - public static Process Start(ProcessStartInfo startInfo) - { - Process process; - - lock (lockObject) - { - using (new ChangeErrorMode(ErrorModes.FailCriticalErrors | ErrorModes.NoGpFaultErrorBox)) - { - try - { - process = Process.Start(startInfo); - } - catch (Win32Exception exception) - { - switch ((NativeErrorCode)exception.NativeErrorCode) - { - case NativeErrorCode.Success: - // Success is not a failure. - break; - - case NativeErrorCode.FileNotFound: - throw new FileNotFoundException(string.Format("The executable file '{0}' could not be found.", - startInfo.FileName), - startInfo.FileName, - exception); - - case NativeErrorCode.PathNotFound: - throw new DirectoryNotFoundException(string.Format("The path to the executable file '{0}' could not be found.", - startInfo.FileName), - exception); - } - - throw; - } - - try - { - if (process != null) - { - process.PriorityClass = ProcessPriorityClass.Idle; - } - } - catch - { - // NOTE: It seems like in some situations, setting the priority class will throw a Win32Exception - // with the error code set to "Success", which I think we can safely interpret as a success and - // not an exception. - // - // See: https://travis-ci.org/GitTools/GitVersion/jobs/171288284#L2026 - // And: https://msdn.microsoft.com/en-us/library/windows/desktop/ms681382.aspx - // - // There's also the case where the process might be killed before we try to adjust its priority - // class, in which case it will throw an InvalidOperationException. What we ideally should do - // is start the process in a "suspended" state, adjust the priority class, then resume it, but - // that's not possible in pure .NET. - // - // See: https://travis-ci.org/GitTools/GitVersion/jobs/166709203#L2278 - // And: http://www.codeproject.com/Articles/230005/Launch-a-process-suspended - // - // -- @asbjornu - } - } - } - - return process; - } - - // http://csharptest.net/532/using-processstart-to-capture-console-output/ - public static int Run(Action output, Action errorOutput, TextReader input, string exe, string args, string workingDirectory, params KeyValuePair[] environmentalVariables) - { - if (String.IsNullOrEmpty(exe)) - throw new ArgumentNullException("exe"); - if (output == null) - throw new ArgumentNullException("output"); - - workingDirectory = workingDirectory ?? Environment.CurrentDirectory; - - var psi = new ProcessStartInfo - { - UseShellExecute = false, - RedirectStandardError = true, - RedirectStandardOutput = true, - RedirectStandardInput = true, - WindowStyle = ProcessWindowStyle.Hidden, - CreateNoWindow = true, - ErrorDialog = false, - WorkingDirectory = workingDirectory, - FileName = exe, - Arguments = args - }; - foreach (var environmentalVariable in environmentalVariables) - { - if (psi.EnvironmentVariables.ContainsKey(environmentalVariable.Key)) - { - psi.EnvironmentVariables[environmentalVariable.Key] = environmentalVariable.Value; - } - else - { - psi.EnvironmentVariables.Add(environmentalVariable.Key, environmentalVariable.Value); - } - if (psi.EnvironmentVariables.ContainsKey(environmentalVariable.Key) && environmentalVariable.Value == null) - psi.EnvironmentVariables.Remove(environmentalVariable.Key); - } - - using (var process = Start(psi)) - using (var mreOut = new ManualResetEvent(false)) - using (var mreErr = new ManualResetEvent(false)) - { - process.EnableRaisingEvents = true; - process.OutputDataReceived += (o, e) => - { - // ReSharper disable once AccessToDisposedClosure - if (e.Data == null) - mreOut.Set(); - else - output(e.Data); - }; - process.BeginOutputReadLine(); - process.ErrorDataReceived += (o, e) => - { - // ReSharper disable once AccessToDisposedClosure - if (e.Data == null) - mreErr.Set(); - else - errorOutput(e.Data); - }; - process.BeginErrorReadLine(); - - string line; - while (input != null && null != (line = input.ReadLine())) - process.StandardInput.WriteLine(line); - - process.StandardInput.Close(); - process.WaitForExit(); - - mreOut.WaitOne(); - mreErr.WaitOne(); - - return process.ExitCode; - } - } - - /// - /// System error codes. - /// See: https://msdn.microsoft.com/en-us/library/windows/desktop/ms681382.aspx - /// - private enum NativeErrorCode - { - Success = 0x0, - FileNotFound = 0x2, - PathNotFound = 0x3 - } - - [Flags] - public enum ErrorModes - { - Default = 0x0, - FailCriticalErrors = 0x1, - NoGpFaultErrorBox = 0x2, - NoAlignmentFaultExcept = 0x4, - NoOpenFileErrorBox = 0x8000 - } - - public struct ChangeErrorMode : IDisposable - { - readonly int oldMode; - - public ChangeErrorMode(ErrorModes mode) - { - try - { - oldMode = SetErrorMode((int)mode); - } - catch (EntryPointNotFoundException) - { - oldMode = (int)mode; - } - } - - - void IDisposable.Dispose() - { - try - { - SetErrorMode(oldMode); - } - catch (EntryPointNotFoundException) - { - // NOTE: Mono doesn't support DllImport("kernel32.dll") and its SetErrorMode method, obviously. @asbjornu - } - } - - [DllImport("kernel32.dll")] - static extern int SetErrorMode(int newMode); - } - } -} \ No newline at end of file diff --git a/src/GitVersionCore/Helpers/ThreadSleep.cs b/src/GitVersionCore/Helpers/ThreadSleep.cs index 6143521ad0..b20989814e 100644 --- a/src/GitVersionCore/Helpers/ThreadSleep.cs +++ b/src/GitVersionCore/Helpers/ThreadSleep.cs @@ -1,12 +1,12 @@ -namespace GitVersion.Helpers +namespace GitVersion.Helpers { - using System.Threading.Tasks; + using System.Threading; internal class ThreadSleep : IThreadSleep { - public async Task SleepAsync(int milliseconds) + public void Sleep(int milliseconds) { - await Task.Delay(milliseconds); + Thread.Sleep(milliseconds); } } } diff --git a/src/GitVersionCore/LibGitExtensions.cs b/src/GitVersionCore/LibGitExtensions.cs index fc9a32c108..8e339a43c1 100644 --- a/src/GitVersionCore/LibGitExtensions.cs +++ b/src/GitVersionCore/LibGitExtensions.cs @@ -4,29 +4,24 @@ namespace GitVersion using System.Collections.Generic; using System.IO; using System.Linq; - using System.Text; - using GitVersion.Helpers; + using LibGit2Sharp; - public static class LibGitExtensions + static class LibGitExtensions { public static DateTimeOffset When(this Commit commit) { return commit.Committer.When; } + /// + /// Checks if the two branch objects refer to the same branch (have the same friendly name). + /// public static string NameWithoutRemote(this Branch branch) { - return branch.IsRemote - ? branch.FriendlyName.Substring(branch.FriendlyName.IndexOf("/", StringComparison.Ordinal) + 1) - : branch.FriendlyName; - } - - public static string NameWithoutOrigin(this Branch branch) - { - return branch.IsRemote && branch.FriendlyName.StartsWith("origin/") - ? branch.FriendlyName.Substring("origin/".Length) - : branch.FriendlyName; + return branch.IsRemote ? + branch.FriendlyName.Substring(branch.FriendlyName.IndexOf("/", StringComparison.Ordinal) + 1) : + branch.FriendlyName; } /// @@ -132,57 +127,5 @@ public static void CheckoutFilesIfExist(this IRepository repository, params stri } } } - - public static Branch FindBranch(this IRepository repository, string branchName) - { - var exact = repository.Branches.FirstOrDefault(x => x.FriendlyName == branchName); - if (exact != null) - { - return exact; - } - - return repository.Branches.FirstOrDefault(x => x.FriendlyName == "origin/" + branchName); - } - - public static void DumpGraph(this IRepository repository, Action writer = null, int? maxCommits = null) - { - DumpGraph(repository.Info.Path, writer, maxCommits); - } - - - public static void DumpGraph(string workingDirectory, Action writer = null, int? maxCommits = null) - { - var output = new StringBuilder(); - - try - { - ProcessHelper.Run( - o => output.AppendLine(o), - e => output.AppendLineFormat("ERROR: {0}", e), - null, - "git", - GitRepositoryHelper.CreateGitLogArgs(maxCommits), - workingDirectory); - } - catch (FileNotFoundException exception) - { - if (exception.FileName != "git") - { - throw; - } - - output.AppendLine("Could not execute 'git log' due to the following error:"); - output.AppendLine(exception.ToString()); - } - - if (writer != null) - { - writer(output.ToString()); - } - else - { - Console.Write(output.ToString()); - } - } } } diff --git a/src/GitVersionCore/Logger.cs b/src/GitVersionCore/Logger.cs index 89cd78cae1..89c23d3804 100644 --- a/src/GitVersionCore/Logger.cs +++ b/src/GitVersionCore/Logger.cs @@ -26,21 +26,19 @@ public static IDisposable IndentLog(string operationDescription) indent = indent + " "; return new ActionDisposable(() => { - var length = indent.Length - 2; - indent = length > 0 ? indent.Substring(0, length) : indent; + indent = indent.Substring(0, indent.Length - 2); WriteInfo(string.Format(CultureInfo.InvariantCulture, "End: {0} (Took: {1:N}ms)", operationDescription, DateTime.Now.Subtract(start).TotalMilliseconds)); }); } static Action ObscurePassword(Action info) { - void LogAction(string s) + Action logAction = s => { s = ObscurePasswordRegex.Replace(s, "$1$2:*******@"); info(s); - } - - return LogAction; + }; + return logAction; } public static void SetLoggers(Action debug, Action info, Action warn, Action error) @@ -117,4 +115,4 @@ public void Dispose() } } } -} +} \ No newline at end of file diff --git a/src/GitVersionCore/LoggerWrapper.cs b/src/GitVersionCore/LoggerWrapper.cs new file mode 100644 index 0000000000..5c4489dc26 --- /dev/null +++ b/src/GitVersionCore/LoggerWrapper.cs @@ -0,0 +1,84 @@ +namespace GitVersion +{ + using System; + using GitTools.Logging; + + /// + /// Wraps the for use by GitTools. + /// + public class LoggerWrapper : ILogProvider + { + public GitTools.Logging.Logger GetLogger(string name) + { + return Log; + } + + public IDisposable OpenNestedContext(string message) + { + throw new NotImplementedException(); + } + + public IDisposable OpenMappedContext(string key, string value) + { + throw new NotImplementedException(); + } + + private static bool Log(LogLevel loglevel, Func messagefunc, Exception exception, object[] formatparameters) + { + // Create the main message. Careful of string format errors. + string message; + if (messagefunc == null) + { + message = null; + } + else + { + if (formatparameters == null || formatparameters.Length == 0) + { + message = messagefunc(); + } + else + { + try + { + message = string.Format(messagefunc(), formatparameters); + } + catch (FormatException) + { + message = messagefunc(); + Logger.WriteError(string.Format("LoggerWrapper.Log(): Incorrectly formatted string: message: '{0}'; formatparameters: {1}", message, string.Join(";", formatparameters))); + } + } + } + + if (exception != null) + { + // Append the exception to the end of the message. + message = string.IsNullOrEmpty(message) ? exception.ToString() : string.Format("{0}\n{1}", message, exception); + } + + if (!string.IsNullOrEmpty(message)) + { + switch (loglevel) + { + case LogLevel.Trace: + case LogLevel.Debug: + Logger.WriteDebug(message); + break; + case LogLevel.Info: + Logger.WriteInfo(message); + break; + case LogLevel.Warn: + Logger.WriteWarning(message); + break; + case LogLevel.Error: + case LogLevel.Fatal: + Logger.WriteError(message); + break; + } + } + + return true; + } + } +} \ No newline at end of file diff --git a/src/GitVersionCore/MergeMessage.cs b/src/GitVersionCore/MergeMessage.cs index 9c3a03a88b..8fb597da84 100644 --- a/src/GitVersionCore/MergeMessage.cs +++ b/src/GitVersionCore/MergeMessage.cs @@ -1,4 +1,5 @@ -using System; +using System; +using System.Linq; using System.Text.RegularExpressions; namespace GitVersion @@ -18,21 +19,16 @@ class MergeMessage @"^Finish (?.*)", RegexOptions.IgnoreCase | RegexOptions.Compiled); static Regex parseRemoteTrackingMergeMessage = new Regex( - @"^Merge remote-tracking branch '(?.*)'( into (?.*))?", - RegexOptions.IgnoreCase | RegexOptions.Compiled); - static Regex parseTfsMergeMessageEnglishUS = new Regex( - @"^Merge (?.*) to (?.*)", - RegexOptions.IgnoreCase | RegexOptions.Compiled); - // Zusammengeführter PR \"9\": release/5.0.1 mit master mergen - static Regex parseTfsMergeMessageGermanDE = new Regex( - @"^Zusammengeführter PR ""(?\d*)""\: (?.*) mit (?.*) mergen", + @"^Merge remote-tracking branch '(?.*)' into (?.*)", RegexOptions.IgnoreCase | RegexOptions.Compiled); private string mergeMessage; + private Config config; public MergeMessage(string mergeMessage, Config config) { this.mergeMessage = mergeMessage; + this.config = config; var lastIndexOf = mergeMessage.LastIndexOf("into", StringComparison.OrdinalIgnoreCase); if (lastIndexOf != -1) @@ -93,29 +89,12 @@ private string ParseBranch() } match = parseRemoteTrackingMergeMessage.Match(mergeMessage); - if (match.Success) - { + if (match.Success) { var from = match.Groups["SourceBranch"].Value; // TODO We could remove/separate the remote name at this point? return from; } - match = parseTfsMergeMessageEnglishUS.Match(mergeMessage); - if (match.Success) - { - IsMergedPullRequest = true; - var from = match.Groups["SourceBranch"].Value; - return from; - } - - match = parseTfsMergeMessageGermanDE.Match(mergeMessage); - if (match.Success) - { - IsMergedPullRequest = true; - var from = match.Groups["SourceBranch"].Value; - return from; - } - return ""; } diff --git a/src/GitVersionCore/NugetAssets/GitVersion.nuspec b/src/GitVersionCore/NugetAssets/GitVersion.nuspec index ea9871bf95..87e3bebc60 100644 --- a/src/GitVersionCore/NugetAssets/GitVersion.nuspec +++ b/src/GitVersionCore/NugetAssets/GitVersion.nuspec @@ -6,7 +6,7 @@ GitVersion GitTools and Contributors GitTools and Contributors - MIT + http://www.opensource.org/licenses/mit-license.php https://github.com/GitTools/GitVersion https://raw.githubusercontent.com/GitTools/GitVersion/master/docs/img/package_icon.png false diff --git a/src/GitVersionCore/OutputVariables/VariableProvider.cs b/src/GitVersionCore/OutputVariables/VariableProvider.cs index 05a45a2a1e..5781041b9e 100644 --- a/src/GitVersionCore/OutputVariables/VariableProvider.cs +++ b/src/GitVersionCore/OutputVariables/VariableProvider.cs @@ -1,6 +1,7 @@ -namespace GitVersion +namespace GitVersion { using System; + using System.ComponentModel; using System.Text.RegularExpressions; using GitVersion.VersionCalculation; @@ -60,7 +61,6 @@ public static VersionVariables GetVariablesFor(SemanticVersion semanticVersion, semverFormatValues.FullBuildMetaData, semverFormatValues.BranchName, semverFormatValues.Sha, - semverFormatValues.ShortSha, semverFormatValues.MajorMinorPatch, semverFormatValues.SemVer, semverFormatValues.LegacySemVer, @@ -115,4 +115,4 @@ static string CheckAndFormatString(string formatString, T source, string def return formattedString; } } -} +} \ No newline at end of file diff --git a/src/GitVersionCore/OutputVariables/VersionVariables.cs b/src/GitVersionCore/OutputVariables/VersionVariables.cs index 3f528988d1..430736187a 100644 --- a/src/GitVersionCore/OutputVariables/VersionVariables.cs +++ b/src/GitVersionCore/OutputVariables/VersionVariables.cs @@ -1,4 +1,4 @@ -namespace GitVersion +namespace GitVersion { using System; using System.Collections; @@ -6,7 +6,6 @@ namespace GitVersion using System.IO; using System.Linq; using GitVersion.Helpers; - using YamlDotNet.Serialization; @@ -20,7 +19,6 @@ public VersionVariables(string major, string fullBuildMetaData, string branchName, string sha, - string shortSha, string majorMinorPatch, string semVer, string legacySemVer, @@ -49,7 +47,6 @@ public VersionVariables(string major, FullBuildMetaData = fullBuildMetaData; BranchName = branchName; Sha = sha; - ShortSha = shortSha; MajorMinorPatch = majorMinorPatch; SemVer = semVer; LegacySemVer = legacySemVer; @@ -91,7 +88,6 @@ public VersionVariables(string major, public string InformationalVersion { get; private set; } public string BranchName { get; private set; } public string Sha { get; private set; } - public string ShortSha { get; private set; } public string NuGetVersionV2 { get; private set; } public string NuGetVersion { get; private set; } public string NuGetPreReleaseTagV2 { get; private set; } @@ -120,10 +116,7 @@ public static IEnumerable AvailableVariables [ReflectionIgnore] public string this[string variable] { - get - { - return typeof(VersionVariables).GetProperty(variable).GetValue(this, null) as string; - } + get { return (string)typeof(VersionVariables).GetProperty(variable).GetValue(this, null); } } public IEnumerator> GetEnumerator() @@ -144,9 +137,7 @@ IEnumerator IEnumerable.GetEnumerator() public static VersionVariables FromDictionary(IEnumerable> properties) { var type = typeof(VersionVariables); - var constructors = type.GetConstructors(); - - var ctor = constructors.Single(); + var ctor = type.GetConstructors().Single(); var ctorArgs = ctor.GetParameters() .Select(p => properties.Single(v => string.Equals(v.Key, p.Name, StringComparison.CurrentCultureIgnoreCase)).Value) .Cast() @@ -189,4 +180,4 @@ sealed class ReflectionIgnoreAttribute : Attribute { } } -} +} \ No newline at end of file diff --git a/src/GitVersionCore/SearchPath.cs b/src/GitVersionCore/SearchPath.cs index 9910fa1f8f..b8f7cbb1d4 100644 --- a/src/GitVersionCore/SearchPath.cs +++ b/src/GitVersionCore/SearchPath.cs @@ -22,7 +22,11 @@ public static void SetSearchPath(string addinDirectoryPath) static string GetProcessorArchitecture() { - return Environment.Is64BitProcess ? "amd64" : "x86"; + if (Environment.Is64BitProcess) + { + return "amd64"; + } + return "x86"; } } } \ No newline at end of file diff --git a/src/GitVersionCore/SemanticVersion.cs b/src/GitVersionCore/SemanticVersion.cs index ee9005db7a..e98056d7bd 100644 --- a/src/GitVersionCore/SemanticVersion.cs +++ b/src/GitVersionCore/SemanticVersion.cs @@ -1,6 +1,7 @@ namespace GitVersion { using System; + using System.ComponentModel; using System.Text.RegularExpressions; public class SemanticVersion : IFormattable, IComparable @@ -332,4 +333,4 @@ public enum VersionField Minor, Major } -} +} \ No newline at end of file diff --git a/src/GitVersionCore/SemanticVersionBuildMetaData.cs b/src/GitVersionCore/SemanticVersionBuildMetaData.cs index 58f1ef4a5f..6724dd7c17 100644 --- a/src/GitVersionCore/SemanticVersionBuildMetaData.cs +++ b/src/GitVersionCore/SemanticVersionBuildMetaData.cs @@ -15,7 +15,6 @@ public class SemanticVersionBuildMetaData : IFormattable, IEquatable, IEquatable { static LambdaEqualityHelper equalityHelper = @@ -72,7 +71,7 @@ public override int GetHashCode() public static bool operator <=(SemanticVersionPreReleaseTag left, SemanticVersionPreReleaseTag right) { - return StringComparerUtils.IngoreCaseComparer.Compare(left.Name, right.Name) != 1; + return StringComparer.InvariantCultureIgnoreCase.Compare(left.Name, right.Name) != 1; } public static implicit operator string(SemanticVersionPreReleaseTag preReleaseTag) @@ -100,7 +99,7 @@ public static SemanticVersionPreReleaseTag Parse(string preReleaseTag) } var value = match.Groups["name"].Value; - var number = match.Groups["number"].Success ? int.Parse(match.Groups["number"].Value) : (int?)null; + var number = match.Groups["number"].Success ? int.Parse(match.Groups["number"].Value) : (int?) null; if (value.EndsWith("-")) return new SemanticVersionPreReleaseTag(preReleaseTag, null); @@ -118,8 +117,7 @@ public int CompareTo(SemanticVersionPreReleaseTag other) return -1; } - - var nameComparison = StringComparerUtils.IngoreCaseComparer.Compare(Name, other.Name); + var nameComparison = StringComparer.InvariantCultureIgnoreCase.Compare(Name, other.Name); if (nameComparison != 0) return nameComparison; diff --git a/src/GitVersionCore/StringComparerUtils.cs b/src/GitVersionCore/StringComparerUtils.cs deleted file mode 100644 index 8b3e491708..0000000000 --- a/src/GitVersionCore/StringComparerUtils.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; - -namespace GitVersion -{ - public static class StringComparerUtils - { - public static readonly System.StringComparer IngoreCaseComparer = StringComparer.InvariantCultureIgnoreCase; - public static readonly StringComparison IngoreCaseComparison = StringComparison.InvariantCultureIgnoreCase; - public static readonly StringComparison CaseSensitiveComparison = StringComparison.InvariantCulture; - } -} diff --git a/src/GitVersionCore/StringFormatWith.cs b/src/GitVersionCore/StringFormatWith.cs index 6442b6c6d4..693eb5b814 100644 --- a/src/GitVersionCore/StringFormatWith.cs +++ b/src/GitVersionCore/StringFormatWith.cs @@ -85,12 +85,12 @@ static Func CompileDataBinder(Type type, string expr) { body = Expression.PropertyOrField(body, members[i]); } - - var staticOrPublic = BindingFlags.Static | BindingFlags.Public; - var method = GetMethodInfo("ToString", staticOrPublic, new Type[] { body.Type }); + var method = typeof(Convert).GetMethod("ToString", BindingFlags.Static | BindingFlags.Public, + null, new Type[] { body.Type }, null); if (method == null) { - method = GetMethodInfo("ToString", staticOrPublic, new Type[] { typeof(object) }); + method = typeof(Convert).GetMethod("ToString", BindingFlags.Static | BindingFlags.Public, + null, new Type[] { typeof(object) }, null); body = Expression.Call(method, Expression.Convert(body, typeof(object))); } else @@ -100,11 +100,5 @@ static Func CompileDataBinder(Type type, string expr) return Expression.Lambda>(body, param).Compile(); } - - private static MethodInfo GetMethodInfo(string name, BindingFlags bindingFlags, Type[] types) - { - var methodInfo = typeof(Convert).GetMethod(name, bindingFlags, null, types, null); - return methodInfo; - } } } \ No newline at end of file diff --git a/src/GitVersionCore/TemplateManager.cs b/src/GitVersionCore/TemplateManager.cs index ab976a56f2..4a1ff4ae6c 100644 --- a/src/GitVersionCore/TemplateManager.cs +++ b/src/GitVersionCore/TemplateManager.cs @@ -5,7 +5,6 @@ using System.IO; using System.Linq; using GitVersionCore.Extensions; - using System.Reflection; enum TemplateType { @@ -72,10 +71,7 @@ public bool IsSupported(string fileExtension) static IEnumerable GetEmbeddedTemplates(TemplateType templateType, string templateCategory) { - - Assembly assy = typeof(TemplateManager).Assembly; - - foreach (var name in assy.GetManifestResourceNames()) + foreach (var name in typeof(TemplateManager).Assembly.GetManifestResourceNames()) { if (name.Contains(templateType.ToString()) && name.Contains(templateCategory)) { diff --git a/src/GitVersionCore/VersionAssemblyInfoResources/AssemblyInfoFileUpdater.cs b/src/GitVersionCore/VersionAssemblyInfoResources/AssemblyInfoFileUpdater.cs index d217de3d62..5e1456ace1 100644 --- a/src/GitVersionCore/VersionAssemblyInfoResources/AssemblyInfoFileUpdater.cs +++ b/src/GitVersionCore/VersionAssemblyInfoResources/AssemblyInfoFileUpdater.cs @@ -12,13 +12,6 @@ public class AssemblyInfoFileUpdater : IDisposable readonly List restoreBackupTasks = new List(); readonly List cleanupBackupTasks = new List(); - readonly IDictionary assemblyAttributeRegexes = new Dictionary - { - {".cs", new Regex( @"(\s*\[\s*assembly:\s*(?:.*)\s*\]\s*$(\r?\n)?)", RegexOptions.Multiline) }, - {".fs", new Regex( @"(\s*\[\s*\\s*\]\s*$(\r?\n)?)", RegexOptions.Multiline) }, - {".vb", new Regex( @"(\s*\\s*$(\r?\n)?)", RegexOptions.Multiline) }, - }; - ISet assemblyInfoFileNames; string workingDirectory; VersionVariables variables; @@ -27,7 +20,7 @@ public class AssemblyInfoFileUpdater : IDisposable TemplateManager templateManager; public AssemblyInfoFileUpdater(string assemblyInfoFileName, string workingDirectory, VersionVariables variables, IFileSystem fileSystem, bool ensureAssemblyInfo) : - this(new HashSet { assemblyInfoFileName }, workingDirectory, variables, fileSystem, ensureAssemblyInfo) + this(new HashSet { assemblyInfoFileName }, workingDirectory, variables, fileSystem, ensureAssemblyInfo) { } public AssemblyInfoFileUpdater(ISet assemblyInfoFileNames, string workingDirectory, VersionVariables variables, IFileSystem fileSystem, bool ensureAssemblyInfo) @@ -84,15 +77,15 @@ public void Update() if (!string.IsNullOrWhiteSpace(assemblyVersion)) { - fileContents = ReplaceOrInsertAfterLastAssemblyAttributeOrAppend(assemblyVersionRegex, fileContents, assemblyVersionString, assemblyInfoFile.Extension, ref appendedAttributes); + fileContents = ReplaceOrAppend(assemblyVersionRegex, fileContents, assemblyVersionString, assemblyInfoFile.Extension, ref appendedAttributes); } if (!string.IsNullOrWhiteSpace(assemblyFileVersion)) { - fileContents = ReplaceOrInsertAfterLastAssemblyAttributeOrAppend(assemblyFileVersionRegex, fileContents, assemblyFileVersionString, assemblyInfoFile.Extension, ref appendedAttributes); + fileContents = ReplaceOrAppend(assemblyFileVersionRegex, fileContents, assemblyFileVersionString, assemblyInfoFile.Extension, ref appendedAttributes); } - fileContents = ReplaceOrInsertAfterLastAssemblyAttributeOrAppend(assemblyInfoVersionRegex, fileContents, assemblyInfoVersionString, assemblyInfoFile.Extension, ref appendedAttributes); + fileContents = ReplaceOrAppend(assemblyInfoVersionRegex, fileContents, assemblyInfoVersionString, assemblyInfoFile.Extension, ref appendedAttributes); if (appendedAttributes) { @@ -107,32 +100,20 @@ public void Update() } } - string ReplaceOrInsertAfterLastAssemblyAttributeOrAppend(Regex replaceRegex, string inputString, string replaceString, string fileExtension, ref bool appendedAttributes) + string ReplaceOrAppend(Regex replaceRegex, string inputString, string replaceString, string fileExtension, ref bool appendedAttributes) { var assemblyAddFormat = templateManager.GetAddFormatFor(fileExtension); if (replaceRegex.IsMatch(inputString)) { - return replaceRegex.Replace(inputString, replaceString); + inputString = replaceRegex.Replace(inputString, replaceString); } - - Regex assemblyRegex; - if (assemblyAttributeRegexes.TryGetValue(fileExtension, out assemblyRegex)) + else { - var assemblyMatches = assemblyRegex.Matches(inputString); - if (assemblyMatches.Count > 0) - { - var lastMatch = assemblyMatches[assemblyMatches.Count - 1]; - var replacementString = lastMatch.Value; - if (!lastMatch.Value.EndsWith(Environment.NewLine)) replacementString += Environment.NewLine; - replacementString += string.Format(assemblyAddFormat, replaceString); - replacementString += Environment.NewLine; - return inputString.Replace(lastMatch.Value, replacementString); - } + inputString += Environment.NewLine + string.Format(assemblyAddFormat, replaceString); + appendedAttributes = true; } - - inputString += Environment.NewLine + string.Format(assemblyAddFormat, replaceString); - appendedAttributes = true; + return inputString; } diff --git a/src/GitVersionCore/VersionCalculation/BaseVersionCalculators/MergeMessageBaseVersionStrategy.cs b/src/GitVersionCore/VersionCalculation/BaseVersionCalculators/MergeMessageBaseVersionStrategy.cs index dae854251b..e9fac9c84c 100644 --- a/src/GitVersionCore/VersionCalculation/BaseVersionCalculators/MergeMessageBaseVersionStrategy.cs +++ b/src/GitVersionCore/VersionCalculation/BaseVersionCalculators/MergeMessageBaseVersionStrategy.cs @@ -1,8 +1,7 @@ -namespace GitVersion.VersionCalculation.BaseVersionCalculators +namespace GitVersion.VersionCalculation.BaseVersionCalculators { using System.Collections.Generic; using System.Linq; - using System.Text.RegularExpressions; using LibGit2Sharp; /// @@ -19,14 +18,13 @@ public override IEnumerable GetVersions(GitVersionContext context) var baseVersions = commitsPriorToThan .SelectMany(c => { - if (TryParse(c, context, out var mergeMessage) && - mergeMessage.Version != null && - context.FullConfiguration.IsReleaseBranch(TrimRemote(mergeMessage.MergedBranch))) + SemanticVersion semanticVersion; + if (TryParse(c, context, out semanticVersion)) { var shouldIncrement = !context.Configuration.PreventIncrementForMergedBranchVersion; return new[] { - new BaseVersion(context, $"Merge message '{c.Message.Trim()}'", shouldIncrement, mergeMessage.Version, c, null) + new BaseVersion(context, string.Format("Merge message '{0}'", c.Message.Trim()), shouldIncrement, semanticVersion, c, null) }; } return Enumerable.Empty(); @@ -34,13 +32,13 @@ public override IEnumerable GetVersions(GitVersionContext context) return baseVersions; } - static bool TryParse(Commit mergeCommit, GitVersionContext context, out MergeMessage mergeMessage) + static bool TryParse(Commit mergeCommit, GitVersionContext context, out SemanticVersion semanticVersion) { - mergeMessage = Inner(mergeCommit, context); - return mergeMessage != null; + semanticVersion = Inner(mergeCommit, context); + return semanticVersion != null; } - static MergeMessage Inner(Commit mergeCommit, GitVersionContext context) + static SemanticVersion Inner(Commit mergeCommit, GitVersionContext context) { if (mergeCommit.Parents.Count() < 2) { @@ -48,11 +46,7 @@ static MergeMessage Inner(Commit mergeCommit, GitVersionContext context) } var mergeMessage = new MergeMessage(mergeCommit.Message, context.FullConfiguration); - return mergeMessage; + return mergeMessage.Version; } - - static string TrimRemote(string branchName) => branchName - .RegexReplace("^refs/remotes/", string.Empty, RegexOptions.IgnoreCase) - .RegexReplace("^origin/", string.Empty, RegexOptions.IgnoreCase); } -} +} \ No newline at end of file diff --git a/src/GitVersionCore/VersionCalculation/BaseVersionCalculators/VersionInBranchNameBaseVersionStrategy.cs b/src/GitVersionCore/VersionCalculation/BaseVersionCalculators/VersionInBranchNameBaseVersionStrategy.cs index 8bb11d0a51..db2546e06a 100644 --- a/src/GitVersionCore/VersionCalculation/BaseVersionCalculators/VersionInBranchNameBaseVersionStrategy.cs +++ b/src/GitVersionCore/VersionCalculation/BaseVersionCalculators/VersionInBranchNameBaseVersionStrategy.cs @@ -1,8 +1,7 @@ -namespace GitVersion.VersionCalculation.BaseVersionCalculators +namespace GitVersion.VersionCalculation.BaseVersionCalculators { using System; using System.Collections.Generic; - using LibGit2Sharp; /// @@ -16,16 +15,12 @@ public override IEnumerable GetVersions(GitVersionContext context) { var currentBranch = context.CurrentBranch; var tagPrefixRegex = context.Configuration.GitTagPrefix; - return GetVersions(context, tagPrefixRegex, currentBranch); + var repository = context.Repository; + return GetVersions(context, tagPrefixRegex, currentBranch, repository); } - public IEnumerable GetVersions(GitVersionContext context, string tagPrefixRegex, Branch currentBranch) + public IEnumerable GetVersions(GitVersionContext context, string tagPrefixRegex, Branch currentBranch, IRepository repository) { - if (!context.FullConfiguration.IsReleaseBranch(currentBranch.NameWithoutOrigin())) - { - yield break; - } - var branchName = currentBranch.FriendlyName; var versionInBranch = GetVersionInBranch(branchName, tagPrefixRegex); if (versionInBranch != null) @@ -51,4 +46,4 @@ Tuple GetVersionInBranch(string branchName, string tagP return null; } } -} +} \ No newline at end of file diff --git a/src/GitVersionCore/VersionCalculation/DevelopVersionStrategy.cs b/src/GitVersionCore/VersionCalculation/DevelopVersionStrategy.cs index 57ee1edf56..8295c91721 100644 --- a/src/GitVersionCore/VersionCalculation/DevelopVersionStrategy.cs +++ b/src/GitVersionCore/VersionCalculation/DevelopVersionStrategy.cs @@ -4,6 +4,7 @@ namespace GitVersion.VersionCalculation using System.Linq; using System.Text.RegularExpressions; using BaseVersionCalculators; + using GitTools; using LibGit2Sharp; /// @@ -91,8 +92,8 @@ IEnumerable GetReleaseVersion(GitVersionContext context, Branch rel } return releaseVersionStrategy - .GetVersions(context, tagPrefixRegex, releaseBranch) + .GetVersions(context, tagPrefixRegex, releaseBranch, repository) .Select(b => new BaseVersion(context, b.Source, true, b.SemanticVersion, baseSource, b.BranchNameOverride)); } } -} +} \ No newline at end of file diff --git a/src/GitVersionCore/VersionCalculation/MainlineVersionCalculator.cs b/src/GitVersionCore/VersionCalculation/MainlineVersionCalculator.cs index ef9d1a7a03..6039c3e06e 100644 --- a/src/GitVersionCore/VersionCalculation/MainlineVersionCalculator.cs +++ b/src/GitVersionCore/VersionCalculation/MainlineVersionCalculator.cs @@ -1,4 +1,4 @@ -using GitVersion.VersionCalculation.BaseVersionCalculators; +using GitVersion.VersionCalculation.BaseVersionCalculators; using LibGit2Sharp; using System; using System.Collections.Generic; @@ -33,55 +33,67 @@ public SemanticVersion FindMainlineModeVersion(BaseVersion baseVersion, GitVersi // master * * // - var mergeBase = baseVersion.BaseVersionSource; - var mainline = GetMainline(context, baseVersion.BaseVersionSource); - var mainlineTip = mainline.Tip; - - // when the current branch is not mainline, find the effective mainline tip for versioning the branch - if (!context.CurrentBranch.IsSameBranch(mainline)) + var mainlineTip = GetMainlineTip(context); + var commitsNotOnMainline = context.Repository.Commits.QueryBy(new CommitFilter { - mergeBase = FindMergeBaseBeforeForwardMerge(context, baseVersion.BaseVersionSource, mainline, out mainlineTip); - Logger.WriteInfo(string.Format("Current branch ({0}) was branch from {1}", context.CurrentBranch.FriendlyName, mergeBase)); - } - - var mainlineCommitLog = context.Repository.Commits.QueryBy(new CommitFilter + IncludeReachableFrom = context.CurrentBranch, + ExcludeReachableFrom = mainlineTip, + SortBy = CommitSortStrategies.Reverse, + FirstParentOnly = true + }).Where(c => c.Sha != baseVersion.BaseVersionSource.Sha && c.Parents.Count() == 1).ToList(); + var commitLog = context.Repository.Commits.QueryBy(new CommitFilter { - IncludeReachableFrom = mainlineTip, + IncludeReachableFrom = context.CurrentBranch, ExcludeReachableFrom = baseVersion.BaseVersionSource, SortBy = CommitSortStrategies.Reverse, FirstParentOnly = true }) + .Where(c => c.Sha != baseVersion.BaseVersionSource.Sha) + .Except(commitsNotOnMainline) .ToList(); - var directCommits = new List(mainlineCommitLog.Count); + + var directCommits = new List(); // Scans commit log in reverse, aggregating merge commits - foreach (var commit in mainlineCommitLog) + foreach (var commit in commitLog) { directCommits.Add(commit); if (commit.Parents.Count() > 1) { - mainlineVersion = AggregateMergeCommitIncrement(context, commit, directCommits, mainlineVersion, mainline); + mainlineVersion = AggregateMergeCommitIncrement(context, commit, directCommits, mainlineVersion); } } - // This will increment for any direct commits on mainline - mainlineVersion = IncrementForEachCommit(context, directCommits, mainlineVersion, mainline); - mainlineVersion.BuildMetaData = metaDataCalculator.Create(mergeBase, context); - - // branches other than master always get a bump for the act of branching if (context.CurrentBranch.FriendlyName != "master") { - var branchIncrement = FindMessageIncrement(context, null, context.CurrentCommit, mergeBase, mainlineCommitLog); - Logger.WriteInfo(string.Format("Performing {0} increment for current branch ", branchIncrement)); - - mainlineVersion = mainlineVersion.IncrementVersion(branchIncrement); + var mergedHead = context.CurrentCommit; + var findMergeBase = context.Repository.ObjectDatabase.FindMergeBase(context.CurrentCommit, mainlineTip); + Logger.WriteInfo(string.Format("Current branch ({0}) was branch from {1}", context.CurrentBranch.FriendlyName, findMergeBase)); + + var branchIncrement = FindMessageIncrement(context, null, mergedHead, findMergeBase, directCommits); + // This will increment for any direct commits on master + mainlineVersion = IncrementForEachCommit(context, directCommits, mainlineVersion, "master"); + mainlineVersion.BuildMetaData = metaDataCalculator.Create(findMergeBase, context); + // Don't increment if the merge commit is a merge into mainline + // this ensures PR's and forward merges end up correct. + if (mergedHead.Parents.Count() == 1 || mergedHead.Parents.First() != mainlineTip) + { + Logger.WriteInfo(string.Format("Performing {0} increment for current branch ", branchIncrement)); + mainlineVersion = mainlineVersion.IncrementVersion(branchIncrement); + } + } + else + { + // If we are on master, make sure no commits get left behind + mainlineVersion = IncrementForEachCommit(context, directCommits, mainlineVersion); + mainlineVersion.BuildMetaData = metaDataCalculator.Create(baseVersion.BaseVersionSource, context); } return mainlineVersion; } } - SemanticVersion AggregateMergeCommitIncrement(GitVersionContext context, Commit commit, List directCommits, SemanticVersion mainlineVersion, Branch mainline) + SemanticVersion AggregateMergeCommitIncrement(GitVersionContext context, Commit commit, List directCommits, SemanticVersion mainlineVersion) { // Merge commit, process all merged commits as a batch var mergeCommit = commit; @@ -91,7 +103,7 @@ SemanticVersion AggregateMergeCommitIncrement(GitVersionContext context, Commit // If this collection is not empty there has been some direct commits against master // Treat each commit as it's own 'release', we need to do this before we increment the branch - mainlineVersion = IncrementForEachCommit(context, directCommits, mainlineVersion, mainline); + mainlineVersion = IncrementForEachCommit(context, directCommits, mainlineVersion); directCommits.Clear(); // Finally increment for the branch @@ -101,14 +113,25 @@ SemanticVersion AggregateMergeCommitIncrement(GitVersionContext context, Commit return mainlineVersion; } - static Branch GetMainline(GitVersionContext context, Commit baseVersionSource) + static Commit GetMainlineTip(GitVersionContext context) { var mainlineBranchConfigs = context.FullConfiguration.Branches.Where(b => b.Value.IsMainline == true).ToList(); + var seenMainlineTips = new List(); var mainlineBranches = context.Repository.Branches .Where(b => { return mainlineBranchConfigs.Any(c => Regex.IsMatch(b.FriendlyName, c.Value.Regex)); }) + .Where(b => + { + if (seenMainlineTips.Contains(b.Tip.Sha)) + { + Logger.WriteInfo("Multiple possible mainlines pointing at the same commit, dropping " + b.FriendlyName); + return false; + } + seenMainlineTips.Add(b.Tip.Sha); + return true; + }) .Select(b => new { MergeBase = context.Repository.ObjectDatabase.FindMergeBase(b.Tip, context.CurrentCommit), @@ -129,39 +152,7 @@ static Branch GetMainline(GitVersionContext context, Commit baseVersionSource) { var mainlineBranch = possibleMainlineBranches[0]; Logger.WriteInfo("Mainline for current branch is " + mainlineBranch.FriendlyName); - return mainlineBranch; - } - - // prefer current branch, if it is a mainline branch - if (possibleMainlineBranches.Any(context.CurrentBranch.IsSameBranch)) - { - Logger.WriteInfo(string.Format("Choosing {0} as mainline because it is the current branch", context.CurrentBranch.FriendlyName)); - return context.CurrentBranch; - } - - // prefer a branch on which the merge base was a direct commit, if there is such a branch - var firstMatchingCommitBranch = possibleMainlineBranches - .FirstOrDefault(b => - { - var filter = new CommitFilter - { - IncludeReachableFrom = b, - ExcludeReachableFrom = baseVersionSource, - FirstParentOnly = true, - }; - var query = context.Repository.Commits.QueryBy(filter); - - return query.Contains(firstMatchingCommit); - }); - if (firstMatchingCommitBranch != null) - { - var message = string.Format( - "Choosing {0} as mainline because {1}'s merge base was a direct commit to {0}", - firstMatchingCommitBranch.FriendlyName, - context.CurrentBranch.FriendlyName); - Logger.WriteInfo(message); - - return firstMatchingCommitBranch; + return mainlineBranch.Tip; } var chosenMainline = possibleMainlineBranches[0]; @@ -169,85 +160,17 @@ static Branch GetMainline(GitVersionContext context, Commit baseVersionSource) "Multiple mainlines ({0}) have the same merge base for the current branch, choosing {1} because we found that branch first...", string.Join(", ", possibleMainlineBranches.Select(b => b.FriendlyName)), chosenMainline.FriendlyName)); - return chosenMainline; - } - - /// - /// Gets the commit on mainline at which was fully integrated. - /// - /// The collection of commits made directly to mainline, in reverse order. - /// The best possible merge base between and the current commit. - /// The tip of the mainline branch. - /// The commit on mainline at which was merged, if such a commit exists; otherwise, . - /// - /// This method gets the most recent commit on mainline that should be considered for versioning the current branch. - /// - private static Commit GetEffectiveMainlineTip(IEnumerable mainlineCommitLog, Commit mergeBase, Commit mainlineTip) - { - // find the commit that merged mergeBase into mainline - foreach (var commit in mainlineCommitLog) - { - if (commit == mergeBase || commit.Parents.Contains(mergeBase)) - { - Logger.WriteInfo(string.Format("Found branch merge point; choosing {0} as effective mainline tip", commit)); - return commit; - } - } - - return mainlineTip; - } - - /// - /// Gets the best possible merge base between the current commit and that is not the child of a forward merge. - /// - /// The current versioning context. - /// The commit that establishes the contextual base version. - /// The mainline branch. - /// The commit on mainline at which the returned merge base was fully integrated. - /// The best possible merge base between the current commit and that is not the child of a forward merge. - private static Commit FindMergeBaseBeforeForwardMerge(GitVersionContext context, Commit baseVersionSource, Branch mainline, out Commit mainlineTip) - { - var mergeBase = context.Repository.ObjectDatabase.FindMergeBase(context.CurrentCommit, mainline.Tip); - var mainlineCommitLog = context.Repository.Commits - .QueryBy(new CommitFilter - { - IncludeReachableFrom = mainline.Tip, - ExcludeReachableFrom = baseVersionSource, - SortBy = CommitSortStrategies.Reverse, - FirstParentOnly = true - }) - .ToList(); - - // find the mainline commit effective for versioning the current branch - mainlineTip = GetEffectiveMainlineTip(mainlineCommitLog, mergeBase, mainline.Tip); - - // detect forward merge and rewind mainlineTip to before it - if (mergeBase == context.CurrentCommit && !mainlineCommitLog.Contains(mergeBase)) - { - var mainlineTipPrevious = mainlineTip.Parents.First(); - var message = string.Format( - "Detected forward merge at {0}; rewinding mainline to previous commit {1}", - mainlineTip, - mainlineTipPrevious); - - Logger.WriteInfo(message); - - // re-do mergeBase detection before the forward merge - mergeBase = context.Repository.ObjectDatabase.FindMergeBase(context.CurrentCommit, mainlineTipPrevious); - mainlineTip = GetEffectiveMainlineTip(mainlineCommitLog, mergeBase, mainlineTipPrevious); - } - - return mergeBase; + return chosenMainline.Tip; } - private static SemanticVersion IncrementForEachCommit(GitVersionContext context, List directCommits, SemanticVersion mainlineVersion, Branch mainline) + private static SemanticVersion IncrementForEachCommit(GitVersionContext context, List directCommits, SemanticVersion mainlineVersion, string branch = null) { foreach (var directCommit in directCommits) { var directCommitIncrement = IncrementStrategyFinder.GetIncrementForCommits(context, new[] { directCommit - }) ?? IncrementStrategyFinder.FindDefaultIncrementForBranch(context, mainline.FriendlyName); + }) ?? IncrementStrategyFinder.FindDefaultIncrementForBranch(context, branch); mainlineVersion = mainlineVersion.IncrementVersion(directCommitIncrement); Logger.WriteInfo(string.Format("Direct commit on master {0} incremented base versions {1}, now {2}", directCommit.Sha, directCommitIncrement, mainlineVersion)); diff --git a/src/GitVersionCore/VersionCalculation/MetaDataCalculator.cs b/src/GitVersionCore/VersionCalculation/MetaDataCalculator.cs index 7e112a30ea..bc3a88959a 100644 --- a/src/GitVersionCore/VersionCalculation/MetaDataCalculator.cs +++ b/src/GitVersionCore/VersionCalculation/MetaDataCalculator.cs @@ -18,12 +18,10 @@ public SemanticVersionBuildMetaData Create(Commit baseVersionSource, GitVersionC var commitsSinceTag = commitLog.Count(); Logger.WriteInfo(string.Format("{0} commits found between {1} and {2}", commitsSinceTag, baseVersionSource.Sha, context.CurrentCommit.Sha)); - var shortSha = context.Repository.ObjectDatabase.ShortenObjectId(context.CurrentCommit); return new SemanticVersionBuildMetaData( commitsSinceTag, context.CurrentBranch.FriendlyName, context.CurrentCommit.Sha, - shortSha, context.CurrentCommit.When()); } } diff --git a/src/GitVersionCore/WixVersionFileUpdater.cs b/src/GitVersionCore/WixVersionFileUpdater.cs new file mode 100644 index 0000000000..1abe2d86a6 --- /dev/null +++ b/src/GitVersionCore/WixVersionFileUpdater.cs @@ -0,0 +1,65 @@ +namespace GitVersion +{ + using Helpers; + + using System; + using System.Text; + using System.Xml; + + public class WixVersionFileUpdater : IDisposable + { + string workingDirectory; + VersionVariables variables; + IFileSystem fileSystem; + private const string WIX_VERSION_FILE = "GitVersion_WixVersion.wxi "; + + public WixVersionFileUpdater(string workingDirectory, VersionVariables variables, IFileSystem fileSystem) + { + this.workingDirectory = workingDirectory; + this.variables = variables; + this.fileSystem = fileSystem; + } + + public static string GetWixVersionFileName() + { + return WIX_VERSION_FILE; + } + + public void Update() + { + Logger.WriteInfo("Updating GitVersion_WixVersion.wxi"); + + XmlDocument doc = new XmlDocument(); + doc.LoadXml(GetWixFormatFromVersionVariables()); + + XmlDeclaration xmlDecl = doc.CreateXmlDeclaration("1.0", "utf-8", null); + XmlElement root = doc.DocumentElement; + doc.InsertBefore(xmlDecl, root); + + using (var fs = fileSystem.OpenWrite(WIX_VERSION_FILE)) + { + doc.Save(fs); + } + } + + private string GetWixFormatFromVersionVariables() + { + StringBuilder builder = new StringBuilder(); + builder.Append("\n"); + var availableVariables = VersionVariables.AvailableVariables; + foreach (var variable in availableVariables) + { + string value = null; + variables.TryGetValue(variable, out value); + builder.Append(string.Format("\t\n", variable, value)); + } + builder.Append("\n"); + return builder.ToString(); + } + + public void Dispose() + { + Logger.WriteInfo(string.Format("Done writing {0}", WIX_VERSION_FILE)); + } + } +} diff --git a/src/GitVersionCore/app.config b/src/GitVersionCore/app.config new file mode 100644 index 0000000000..b57ccf84c3 --- /dev/null +++ b/src/GitVersionCore/app.config @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/src/GitVersionCore/packages.config b/src/GitVersionCore/packages.config new file mode 100644 index 0000000000..34b78fd67b --- /dev/null +++ b/src/GitVersionCore/packages.config @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/src/GitVersionExe.Tests/ArgumentParserTests.cs b/src/GitVersionExe.Tests/ArgumentParserTests.cs index 195a856e72..29c4417fda 100644 --- a/src/GitVersionExe.Tests/ArgumentParserTests.cs +++ b/src/GitVersionExe.Tests/ArgumentParserTests.cs @@ -3,6 +3,7 @@ using Shouldly; using System; using System.Collections.Generic; +using System.ComponentModel; [TestFixture] public class ArgumentParserTests @@ -357,4 +358,4 @@ public void Check_verbosity_parsing(string command, bool shouldThrow, VerbosityL arguments.Verbosity.ShouldBe(expectedVerbosity); } } -} +} \ No newline at end of file diff --git a/src/GitVersionExe.Tests/AssemblyParallelizable.cs b/src/GitVersionExe.Tests/AssemblyParallelizable.cs deleted file mode 100644 index 9f6f4f451f..0000000000 --- a/src/GitVersionExe.Tests/AssemblyParallelizable.cs +++ /dev/null @@ -1,3 +0,0 @@ -using NUnit.Framework; - -[assembly: Parallelizable(ParallelScope.Fixtures)] \ No newline at end of file diff --git a/src/GitVersionExe.Tests/ExecCmdLineArgumentTest.cs b/src/GitVersionExe.Tests/ExecCmdLineArgumentTest.cs index 8632329336..3f19cb05a7 100644 --- a/src/GitVersionExe.Tests/ExecCmdLineArgumentTest.cs +++ b/src/GitVersionExe.Tests/ExecCmdLineArgumentTest.cs @@ -1,14 +1,13 @@ -using System; +using System; using System.IO; using System.Text; +using GitTools; using GitTools.Testing; using GitVersion; -using GitVersion.Helpers; using NUnit.Framework; using Shouldly; [TestFixture] -[Parallelizable(ParallelScope.None)] public class ExecCmdLineArgumentTest { [Test] @@ -108,4 +107,4 @@ public void WorkingDirectoryDoesNotExistCrashesWithInformativeMessage() var outputString = output.ToString(); outputString.ShouldContain(string.Format("The working directory '{0}' does not exist.", workingDirectory), () => outputString); } -} +} \ No newline at end of file diff --git a/src/GitVersionExe.Tests/ExecutionResults.cs b/src/GitVersionExe.Tests/ExecutionResults.cs index 3610460adc..7158939b67 100644 --- a/src/GitVersionExe.Tests/ExecutionResults.cs +++ b/src/GitVersionExe.Tests/ExecutionResults.cs @@ -1,6 +1,6 @@ -using System.Collections.Generic; +using System.Collections.Generic; +using System.Web.Script.Serialization; using GitVersion; -using Newtonsoft.Json; public class ExecutionResults { @@ -19,8 +19,8 @@ public virtual VersionVariables OutputVariables { get { - var outputVariables = JsonConvert.DeserializeObject>(Output); + var outputVariables = new JavaScriptSerializer().Deserialize>(Output); return VersionVariables.FromDictionary(outputVariables); } } -} +} \ No newline at end of file diff --git a/src/GitVersionExe.Tests/GitVersionExe.Tests.csproj b/src/GitVersionExe.Tests/GitVersionExe.Tests.csproj index d64bb8cf8c..3d15ae4c3d 100644 --- a/src/GitVersionExe.Tests/GitVersionExe.Tests.csproj +++ b/src/GitVersionExe.Tests/GitVersionExe.Tests.csproj @@ -1,36 +1,137 @@ - + + + + - net461 - false - true + Debug + AnyCPU + {75C2BE85-1DAF-4E34-8305-B17AFAA982A6} + Library + Properties + GitVersionExe.Tests + GitVersionExe.Tests + v4.5 + 512 + 6 + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + full + false + bin\Release\ + TRACE + prompt + 4 + true - - - - - - - - all - runtime; build; native; contentfiles; analyzers - - - - + + ..\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\Mono.Cecil.0.9.6.4\lib\net45\Mono.Cecil.dll + True + + + ..\packages\Mono.Cecil.0.9.6.4\lib\net45\Mono.Cecil.Mdb.dll + True + + + ..\packages\Mono.Cecil.0.9.6.4\lib\net45\Mono.Cecil.Pdb.dll + True + + + ..\packages\Mono.Cecil.0.9.6.4\lib\net45\Mono.Cecil.Rocks.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 + + + + + + + + + - - + + {BF905F84-382C-440D-92F5-C61108626D8D} + GitVersionCore.Tests + + + {F9741A0D-B9D7-4557-9A1C-A7252C1071F5} + GitVersionCore + + + {c3578a7b-09a6-4444-9383-0deafa4958bd} + GitVersionExe + + + + Designer + - + + + + + + + + + + + + - + - - + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use 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/GitVersionExe.Tests/GitVersionHelper.cs b/src/GitVersionExe.Tests/GitVersionHelper.cs index 954dab93ce..2ab6652d13 100644 --- a/src/GitVersionExe.Tests/GitVersionHelper.cs +++ b/src/GitVersionExe.Tests/GitVersionHelper.cs @@ -1,9 +1,9 @@ -using System; +using System; using System.Collections.Generic; using System.IO; using System.Text; +using GitTools; using GitVersion; -using GitVersion.Helpers; public static class GitVersionHelper { @@ -40,7 +40,6 @@ static ExecutionResults ExecuteIn(ArgumentBuilder arguments) new KeyValuePair(TeamCity.EnvironmentVariableName, arguments.IsTeamCity ? "8.0.0" : null), new KeyValuePair(AppVeyor.EnvironmentVariableName, null), new KeyValuePair(TravisCI.EnvironmentVariableName, null), - new KeyValuePair(VsoAgent.EnvironmentVariableName, null), }; var exitCode = -1; @@ -83,4 +82,4 @@ static ExecutionResults ExecuteIn(ArgumentBuilder arguments) return new ExecutionResults(exitCode, output.ToString(), logContents); } -} +} \ No newline at end of file diff --git a/src/GitVersionExe.Tests/HelpWriterTests.cs b/src/GitVersionExe.Tests/HelpWriterTests.cs index 1b48500636..ef8e8f4c72 100644 --- a/src/GitVersionExe.Tests/HelpWriterTests.cs +++ b/src/GitVersionExe.Tests/HelpWriterTests.cs @@ -17,7 +17,8 @@ public void AllArgsAreInHelp() { "LogFilePath" , "/l" }, { "DynamicRepositoryLocation" , "/dynamicRepoLocation" }, { "IsHelp", "/?" }, - { "IsVersion", "/version" } + { "IsVersion", "/version" }, + { "UpdateWixVersionFile", "/updatewixversionfile" } }; string helpText = null; diff --git a/src/GitVersionExe.Tests/Helpers/DirectoryHelper.cs b/src/GitVersionExe.Tests/Helpers/DirectoryHelper.cs deleted file mode 100644 index 0b34a20605..0000000000 --- a/src/GitVersionExe.Tests/Helpers/DirectoryHelper.cs +++ /dev/null @@ -1,84 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; - -public static class DirectoryHelper -{ - static Dictionary toRename = new Dictionary - { - {"gitted", ".git"}, - {"gitmodules", ".gitmodules"}, - }; - - public static void CopyFilesRecursively(DirectoryInfo source, DirectoryInfo target) - { - // From http://stackoverflow.com/questions/58744/best-way-to-copy-the-entire-contents-of-a-directory-in-c/58779#58779 - - foreach (var dir in source.GetDirectories()) - { - CopyFilesRecursively(dir, target.CreateSubdirectory(Rename(dir.Name))); - } - foreach (var file in source.GetFiles()) - { - file.CopyTo(Path.Combine(target.FullName, Rename(file.Name))); - } - } - - static string Rename(string name) - { - return toRename.ContainsKey(name) ? toRename[name] : name; - } - - public static void DeleteSubDirectories(string parentPath) - { - var dirs = Directory.GetDirectories(parentPath); - foreach (var dir in dirs) - { - DeleteDirectory(dir); - } - } - - public static void DeleteDirectory(string directoryPath) - { - // From http://stackoverflow.com/questions/329355/cannot-delete-directory-with-directory-deletepath-true/329502#329502 - - if (!Directory.Exists(directoryPath)) - { - Trace.WriteLine( - string.Format("Directory '{0}' is missing and can't be removed.", - directoryPath)); - - return; - } - - var files = Directory.GetFiles(directoryPath); - var dirs = Directory.GetDirectories(directoryPath); - - foreach (var file in files) - { - File.SetAttributes(file, FileAttributes.Normal); - File.Delete(file); - } - - foreach (var dir in dirs) - { - DeleteDirectory(dir); - } - - File.SetAttributes(directoryPath, FileAttributes.Normal); - try - { - Directory.Delete(directoryPath, false); - } - catch (IOException) - { - Trace.WriteLine(string.Format("{0}The directory '{1}' could not be deleted!" + - "{0}Most of the time, this is due to an external process accessing the files in the temporary repositories created during the test runs, and keeping a handle on the directory, thus preventing the deletion of those files." + - "{0}Known and common causes include:" + - "{0}- Windows Search Indexer (go to the Indexing Options, in the Windows Control Panel, and exclude the bin folder of LibGit2Sharp.Tests)" + - "{0}- Antivirus (exclude the bin folder of LibGit2Sharp.Tests from the paths scanned by your real-time antivirus){0}", - Environment.NewLine, Path.GetFullPath(directoryPath))); - } - } -} \ No newline at end of file diff --git a/src/GitVersionExe.Tests/Helpers/PathHelper.cs b/src/GitVersionExe.Tests/Helpers/PathHelper.cs deleted file mode 100644 index b73edfeda1..0000000000 --- a/src/GitVersionExe.Tests/Helpers/PathHelper.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.IO; -using System.Reflection; - -public static class PathHelper -{ - public static string GetCurrentDirectory() - { - return Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); - } - - public static string GetTempPath() - { - return Path.Combine(GetCurrentDirectory(), "TestRepositories", Guid.NewGuid().ToString()); - } -} \ No newline at end of file diff --git a/src/GitVersionExe.Tests/Helpers/TestFileSystem.cs b/src/GitVersionExe.Tests/Helpers/TestFileSystem.cs deleted file mode 100644 index 217957b015..0000000000 --- a/src/GitVersionExe.Tests/Helpers/TestFileSystem.cs +++ /dev/null @@ -1,115 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Text; - -using GitVersion.Helpers; - -public class TestFileSystem : IFileSystem -{ - Dictionary fileSystem = new Dictionary(); - - public void Copy(string @from, string to, bool overwrite) - { - if (fileSystem.ContainsKey(to)) - { - if (overwrite) - fileSystem.Remove(to); - else - throw new IOException("File already exists"); - } - - byte[] source; - if (!fileSystem.TryGetValue(from, out source)) - throw new FileNotFoundException(string.Format("The source file '{0}' was not found", from), from); - - fileSystem.Add(to, source); - } - - public void Move(string @from, string to) - { - Copy(from, to, false); - fileSystem.Remove(from); - } - - public bool Exists(string file) - { - return fileSystem.ContainsKey(file); - } - - public void Delete(string path) - { - fileSystem.Remove(path); - } - - public string ReadAllText(string path) - { - byte[] content; - if (!fileSystem.TryGetValue(path, out content)) - throw new FileNotFoundException(string.Format("The file '{0}' was not found", path), path); - - var encoding = EncodingHelper.DetectEncoding(content) ?? Encoding.UTF8; - return encoding.GetString(content); - } - - public void WriteAllText(string file, string fileContents) - { - var encoding = fileSystem.ContainsKey(file) - ? EncodingHelper.DetectEncoding(fileSystem[file]) ?? Encoding.UTF8 - : Encoding.UTF8; - WriteAllText(file, fileContents, encoding); - } - - public void WriteAllText(string file, string fileContents, Encoding encoding) - { - fileSystem[file] = encoding.GetBytes(fileContents); - } - - public IEnumerable DirectoryGetFiles(string directory, string searchPattern, SearchOption searchOption) - { - throw new NotImplementedException(); - } - - public Stream OpenWrite(string path) - { - return new TestStream(path, this); - } - - public Stream OpenRead(string path) - { - if (fileSystem.ContainsKey(path)) - { - var content = fileSystem[path]; - return new MemoryStream(content); - } - - throw new FileNotFoundException("File not found.", path); - } - - public void CreateDirectory(string path) - { - if (fileSystem.ContainsKey(path)) - { - fileSystem[path] = new byte[0]; - } - else - { - fileSystem.Add(path, new byte[0]); - } - } - - public bool DirectoryExists(string path) - { - return fileSystem.ContainsKey(path); - } - - public long GetLastDirectoryWrite(string path) - { - return 1; - } - - public bool PathsEqual(string path, string otherPath) - { - return path == otherPath; - } -} \ No newline at end of file diff --git a/src/GitVersionExe.Tests/Helpers/TestStream.cs b/src/GitVersionExe.Tests/Helpers/TestStream.cs deleted file mode 100644 index ce23cfa7ec..0000000000 --- a/src/GitVersionExe.Tests/Helpers/TestStream.cs +++ /dev/null @@ -1,76 +0,0 @@ -using System; -using System.IO; -using System.Threading; -using System.Threading.Tasks; - -public class TestStream : Stream -{ - readonly string path; - readonly TestFileSystem testFileSystem; - MemoryStream underlying = new MemoryStream(); - - public TestStream(string path, TestFileSystem testFileSystem) - { - this.path = path; - this.testFileSystem = testFileSystem; - } - - protected override void Dispose(bool disposing) - { - Flush(); - base.Dispose(disposing); - } - - public override void Flush() - { - underlying.Position = 0; - var readToEnd = new StreamReader(underlying).ReadToEnd(); - testFileSystem.WriteAllText(path, readToEnd); - } - - public override long Seek(long offset, SeekOrigin origin) - { - return underlying.Seek(offset, origin); - } - - public override void SetLength(long value) - { - underlying.SetLength(value); - } - - public override int Read(byte[] buffer, int offset, int count) - { - return underlying.Read(buffer, offset, count); - } - - public override void Write(byte[] buffer, int offset, int count) - { - underlying.Write(buffer, offset, count); - } - - public override void WriteByte(byte value) - { - base.WriteByte(value); - } - - public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state) - { - return base.BeginWrite(buffer, offset, count, callback, state); - } - - public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) - { - return base.WriteAsync(buffer, offset, count, cancellationToken); - } - - public override bool CanRead { get { return underlying.CanRead; } } - public override bool CanSeek { get { return underlying.CanSeek; } } - public override bool CanWrite { get { return underlying.CanWrite; } } - public override long Length { get { return underlying.Length; } } - - public override long Position - { - get { return underlying.Position; } - set { underlying.Position = value; } - } -} \ No newline at end of file diff --git a/src/GitVersionExe.Tests/TestEffectiveConfiguration.cs b/src/GitVersionExe.Tests/TestEffectiveConfiguration.cs deleted file mode 100644 index 6b2d03ddfe..0000000000 --- a/src/GitVersionExe.Tests/TestEffectiveConfiguration.cs +++ /dev/null @@ -1,48 +0,0 @@ -namespace GitVersionExe.Tests -{ - using GitVersion; - using GitVersion.VersionFilters; - using System.Collections.Generic; - using System.Linq; - - public class TestEffectiveConfiguration : EffectiveConfiguration - { - public TestEffectiveConfiguration( - AssemblyVersioningScheme assemblyVersioningScheme = AssemblyVersioningScheme.MajorMinorPatch, - AssemblyFileVersioningScheme assemblyFileVersioningScheme = AssemblyFileVersioningScheme.MajorMinorPatch, - string assemblyVersioningFormat = null, - string assemblyFileVersioningFormat = null, - string assemblyInformationalFormat = null, - VersioningMode versioningMode = VersioningMode.ContinuousDelivery, - string gitTagPrefix = "v", - string tag = "", - string nextVersion = null, - string branchPrefixToTrim = "", - bool preventIncrementForMergedBranchVersion = false, - string tagNumberPattern = null, - string continuousDeploymentFallbackTag = "ci", - bool trackMergeTarget = false, - string majorMessage = null, - string minorMessage = null, - string patchMessage = null, - string noBumpMessage = null, - CommitMessageIncrementMode commitMessageMode = CommitMessageIncrementMode.Enabled, - int legacySemVerPadding = 4, - int buildMetaDataPadding = 4, - int commitsSinceVersionSourcePadding = 4, - IEnumerable versionFilters = null, - bool tracksReleaseBranches = false, - bool isRelease = false, - string commitDateFormat = "yyyy-MM-dd") : - base(assemblyVersioningScheme, assemblyFileVersioningScheme, assemblyInformationalFormat, assemblyVersioningFormat, assemblyFileVersioningFormat, versioningMode, gitTagPrefix, tag, nextVersion, IncrementStrategy.Patch, - branchPrefixToTrim, preventIncrementForMergedBranchVersion, tagNumberPattern, continuousDeploymentFallbackTag, - trackMergeTarget, - majorMessage, minorMessage, patchMessage, noBumpMessage, - commitMessageMode, legacySemVerPadding, buildMetaDataPadding, commitsSinceVersionSourcePadding, - versionFilters ?? Enumerable.Empty(), - tracksReleaseBranches, isRelease, commitDateFormat) - - { - } - } -} \ No newline at end of file diff --git a/src/GitVersionExe.Tests/UpdateWixVersionFileTests.cs b/src/GitVersionExe.Tests/UpdateWixVersionFileTests.cs new file mode 100644 index 0000000000..b27c18036d --- /dev/null +++ b/src/GitVersionExe.Tests/UpdateWixVersionFileTests.cs @@ -0,0 +1,102 @@ +namespace GitVersionExe.Tests +{ + using System.IO; + using System.Linq; + using NUnit.Framework; + + using GitVersion; + using GitTools.Testing; + using System.Collections.Generic; + using System.Xml; + + [TestFixture] + class UpdateWixVersionFileTests + { + private string WixVersionFileName; + + [SetUp] + public void Setup() + { + WixVersionFileName = WixVersionFileUpdater.GetWixVersionFileName(); + } + + [Test] + public void WixVersionFileCreationTest() + { + using (var fixture = new EmptyRepositoryFixture()) + { + fixture.MakeATaggedCommit("1.2.3"); + fixture.MakeACommit(); + + GitVersionHelper.ExecuteIn(fixture.RepositoryPath, arguments: " /updatewixversionfile"); + Assert.IsTrue(File.Exists(Path.Combine(fixture.RepositoryPath, WixVersionFileName))); + } + } + + [Test] + public void WixVersionFileVarCountTest() + { + //Make sure we have captured all the version variables by count in the Wix version file + using (var fixture = new EmptyRepositoryFixture()) + { + fixture.MakeATaggedCommit("1.2.3"); + fixture.MakeACommit(); + + var gitVersionExecutionResults = GitVersionHelper.ExecuteIn(fixture.RepositoryPath, arguments: null); + VersionVariables vars = gitVersionExecutionResults.OutputVariables; + + GitVersionHelper.ExecuteIn(fixture.RepositoryPath, arguments: " /updatewixversionfile"); + + var gitVersionVarsInWix = GetGitVersionVarsInWixFile(Path.Combine(fixture.RepositoryPath, WixVersionFileName)); + var gitVersionVars = VersionVariables.AvailableVariables; + + Assert.AreEqual(gitVersionVars.Count(), gitVersionVarsInWix.Count); + } + } + + [Test] + public void WixVersionFileContentTest() + { + using (var fixture = new EmptyRepositoryFixture()) + { + fixture.MakeATaggedCommit("1.2.3"); + fixture.MakeACommit(); + + var gitVersionExecutionResults = GitVersionHelper.ExecuteIn(fixture.RepositoryPath, arguments: null); + VersionVariables vars = gitVersionExecutionResults.OutputVariables; + + GitVersionHelper.ExecuteIn(fixture.RepositoryPath, arguments: " /updatewixversionfile"); + + var gitVersionVarsInWix = GetGitVersionVarsInWixFile(Path.Combine(fixture.RepositoryPath, WixVersionFileName)); + var gitVersionVars = VersionVariables.AvailableVariables; + + foreach (var variable in gitVersionVars) + { + string value = null; + vars.TryGetValue(variable, out value); + //Make sure the variable is present in the Wix file + Assert.IsTrue(gitVersionVarsInWix.ContainsKey(variable)); + //Make sure the values are equal + Assert.AreEqual(value, gitVersionVarsInWix[variable]); + } + } + } + + private Dictionary GetGitVersionVarsInWixFile(string file) + { + var gitVersionVarsInWix = new Dictionary(); + using (var reader = new XmlTextReader(file)) + { + while (reader.Read()) + { + if (reader.Name == "define") + { + string[] component = reader.Value.Split('='); + gitVersionVarsInWix[component[0]] = component[1].TrimStart('"').TrimEnd('"'); + } + } + } + return gitVersionVarsInWix; + } + } +} \ No newline at end of file diff --git a/src/GitVersionExe.Tests/VersionWriterTests.cs b/src/GitVersionExe.Tests/VersionWriterTests.cs index 7834b73342..bc3a4d968b 100644 --- a/src/GitVersionExe.Tests/VersionWriterTests.cs +++ b/src/GitVersionExe.Tests/VersionWriterTests.cs @@ -1,4 +1,4 @@ -namespace GitVersionExe.Tests +namespace GitVersionExe.Tests { using System; using System.IO; @@ -42,7 +42,7 @@ private Assembly GenerateAssembly(Version fileVersion, string prereleaseInfo) var asmDef = AssemblyDefinition.CreateAssembly(definition, "test-asm", ModuleKind.Dll); var constructor = typeof(AssemblyInformationalVersionAttribute).GetConstructor(new[] { typeof(string) }); - var methodReference = asmDef.MainModule.ImportReference(constructor); + var methodReference = asmDef.MainModule.Import(constructor); var customAttribute = new CustomAttribute(methodReference); customAttribute.ConstructorArguments.Add(new CustomAttributeArgument(asmDef.MainModule.TypeSystem.String, fileVersion + prereleaseInfo)); asmDef.CustomAttributes.Add(customAttribute); diff --git a/src/GitVersionExe.Tests/app.config b/src/GitVersionExe.Tests/app.config new file mode 100644 index 0000000000..c24557fb8a --- /dev/null +++ b/src/GitVersionExe.Tests/app.config @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/GitVersionExe.Tests/packages.config b/src/GitVersionExe.Tests/packages.config new file mode 100644 index 0000000000..30641d4d15 --- /dev/null +++ b/src/GitVersionExe.Tests/packages.config @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/src/GitVersionExe/ArgumentParser.cs b/src/GitVersionExe/ArgumentParser.cs index afafc0af8c..ecf83b0faf 100644 --- a/src/GitVersionExe/ArgumentParser.cs +++ b/src/GitVersionExe/ArgumentParser.cs @@ -3,6 +3,7 @@ namespace GitVersion using System; using System.Collections.Generic; using System.Collections.Specialized; + using System.ComponentModel; using System.IO; using System.Linq; @@ -134,7 +135,6 @@ public static Arguments ParseArguments(List commandLineArguments) continue; } - if (name.IsSwitch("execargs")) { EnsureArgumentValueCount(values); @@ -166,6 +166,7 @@ public static Arguments ParseArguments(List commandLineArguments) continue; } + if (name.IsSwitch("updateAssemblyInfo")) { if (value.IsTrue()) @@ -337,6 +338,12 @@ public static Arguments ParseArguments(List commandLineArguments) continue; } + if (name.IsSwitch("updatewixversionfile")) + { + arguments.UpdateWixVersionFile = true; + continue; + } + var couldNotParseMessage = string.Format("Could not parse command line parameter '{0}'.", name); // If we've reached through all argument switches without a match, we can relatively safely assume that the first argument isn't a switch, but the target path. @@ -418,4 +425,4 @@ static NameValueCollection CollectSwitchesAndValuesFromArguments(IList n return switchesAndValues; } } -} +} \ No newline at end of file diff --git a/src/GitVersionExe/Arguments.cs b/src/GitVersionExe/Arguments.cs index fb0871b43b..5158984183 100644 --- a/src/GitVersionExe/Arguments.cs +++ b/src/GitVersionExe/Arguments.cs @@ -27,6 +27,7 @@ public Arguments() public bool Init; public bool Diag; + public bool IsVersion; public bool IsHelp; public string LogFilePath; @@ -43,6 +44,8 @@ public Arguments() public ISet UpdateAssemblyInfoFileName; public bool EnsureAssemblyInfo; + public bool UpdateWixVersionFile; + public bool ShowConfig; public bool NoFetch; public bool NoCache; diff --git a/src/GitVersionExe/AssemblyInfo.cs b/src/GitVersionExe/AssemblyInfo.cs index e75c30ff1b..10f78a2e2a 100644 --- a/src/GitVersionExe/AssemblyInfo.cs +++ b/src/GitVersionExe/AssemblyInfo.cs @@ -1,4 +1,4 @@ -using System.Reflection; +using System.Reflection; using System.Runtime.CompilerServices; [assembly: AssemblyTitle("GitVersion")] @@ -9,4 +9,4 @@ [assembly: InternalsVisibleTo("AcceptanceTests")] [assembly: InternalsVisibleTo("GitVersionExe.Tests")] -[assembly: AssemblyInformationalVersion("4.0.0+Branch.master.Sha.e715eb5dd515037d90a257f527e62442cae8c1c5")] +[assembly: AssemblyInformationalVersion("4.0.0-beta.12+1291.Branch.master.Sha.bc74ac2247d8a58053a33316334ada6b771a8455")] diff --git a/src/GitVersionExe/FodyWeavers.xml b/src/GitVersionExe/FodyWeavers.xml new file mode 100644 index 0000000000..ba2f99a4d5 --- /dev/null +++ b/src/GitVersionExe/FodyWeavers.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/src/GitVersionRubyGem/.gitignore b/src/GitVersionExe/GemAssets/.gitignore similarity index 100% rename from src/GitVersionRubyGem/.gitignore rename to src/GitVersionExe/GemAssets/.gitignore diff --git a/src/GitVersionRubyGem/.rspec b/src/GitVersionExe/GemAssets/.rspec similarity index 100% rename from src/GitVersionRubyGem/.rspec rename to src/GitVersionExe/GemAssets/.rspec diff --git a/src/GitVersionRubyGem/Gemfile b/src/GitVersionExe/GemAssets/Gemfile similarity index 100% rename from src/GitVersionRubyGem/Gemfile rename to src/GitVersionExe/GemAssets/Gemfile diff --git a/src/GitVersionRubyGem/Guardfile b/src/GitVersionExe/GemAssets/Guardfile similarity index 100% rename from src/GitVersionRubyGem/Guardfile rename to src/GitVersionExe/GemAssets/Guardfile diff --git a/src/GitVersionRubyGem/bin/gitversion b/src/GitVersionExe/GemAssets/bin/gitversion similarity index 100% rename from src/GitVersionRubyGem/bin/gitversion rename to src/GitVersionExe/GemAssets/bin/gitversion diff --git a/src/GitVersionExe/GemAssets/gitversion.gemspec b/src/GitVersionExe/GemAssets/gitversion.gemspec new file mode 100644 index 0000000000..1687ecca43 --- /dev/null +++ b/src/GitVersionExe/GemAssets/gitversion.gemspec @@ -0,0 +1,20 @@ +Gem::Specification.new do |spec| + spec.platform = Gem::Platform::RUBY + spec.name = 'gitversion' + spec.licenses = ['MIT'] + spec.version = '$version$' + spec.summary = 'Derives SemVer information from a repository following GitFlow or GitHubFlow.' + spec.description = <<-EOF +Derives SemVer information from a repository following GitFlow or GitHubFlow. +EOF + + spec.authors = ['NServiceBus','Simon Cropp'] + spec.email = 'info@nservicebus.com' + spec.homepage = 'http://github.com/Particular/GitVersion' + spec.rubyforge_project = 'GitVersion' + + spec.files = Dir['bin/**/*', 'lib/**/*', '*.gemspec'].reject { |f| File.directory?(f) } + spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }.reject { |f| f =~ /\.(exe|pdb|dll)$/} + spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) + spec.require_paths = ['lib'] +end diff --git a/src/GitVersionRubyGem/lib/git_version.rb b/src/GitVersionExe/GemAssets/lib/git_version.rb similarity index 100% rename from src/GitVersionRubyGem/lib/git_version.rb rename to src/GitVersionExe/GemAssets/lib/git_version.rb diff --git a/src/GitVersionRubyGem/lib/git_version/parser.rb b/src/GitVersionExe/GemAssets/lib/git_version/parser.rb similarity index 100% rename from src/GitVersionRubyGem/lib/git_version/parser.rb rename to src/GitVersionExe/GemAssets/lib/git_version/parser.rb diff --git a/src/GitVersionRubyGem/spec/lib/git_version/parser_spec.rb b/src/GitVersionExe/GemAssets/spec/lib/git_version/parser_spec.rb similarity index 100% rename from src/GitVersionRubyGem/spec/lib/git_version/parser_spec.rb rename to src/GitVersionExe/GemAssets/spec/lib/git_version/parser_spec.rb diff --git a/src/GitVersionRubyGem/spec/lib/git_version_spec.rb b/src/GitVersionExe/GemAssets/spec/lib/git_version_spec.rb similarity index 100% rename from src/GitVersionRubyGem/spec/lib/git_version_spec.rb rename to src/GitVersionExe/GemAssets/spec/lib/git_version_spec.rb diff --git a/src/GitVersionRubyGem/spec/spec_helper.rb b/src/GitVersionExe/GemAssets/spec/spec_helper.rb similarity index 100% rename from src/GitVersionRubyGem/spec/spec_helper.rb rename to src/GitVersionExe/GemAssets/spec/spec_helper.rb diff --git a/src/GitVersionExe/GitVersion.Tool.csproj b/src/GitVersionExe/GitVersion.Tool.csproj deleted file mode 100644 index 8816195b0b..0000000000 --- a/src/GitVersionExe/GitVersion.Tool.csproj +++ /dev/null @@ -1,15 +0,0 @@ - - - - true - netcoreapp2.1 - dotnet-gitversion - GitVersion.Tool - - GitVersion Tool - Derives SemVer information from a repository following GitFlow or GitHubFlow. This is the .NET Core Global Tool allowing usage of GitVersion from command line. - - - - - diff --git a/src/GitVersionExe/GitVersionExe.csproj b/src/GitVersionExe/GitVersionExe.csproj index a601b1649a..1e6850f761 100644 --- a/src/GitVersionExe/GitVersionExe.csproj +++ b/src/GitVersionExe/GitVersionExe.csproj @@ -1,26 +1,219 @@ - + + + - + Debug + AnyCPU + 8.0.30703 + 2.0 + {C3578A7B-09A6-4444-9383-0DEAFA4958BD} Exe GitVersion GitVersion - net461;netcoreapp2.1 - false - AnyCPU - MIT - bin\$(Configuration)\GitVersion.xml + v4.0 + 6 + 512 + $(SolutionDir)..\build\ + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + false + bin\Debug\GitVersion.xml 1591 - - - NETDESKTOP + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + false + bin\Release\GitVersion.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 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Designer + + + Designer + + + + + Designer + + + + + + Designer + - - + + {f9741a0d-b9d7-4557-9a1c-a7252c1071f5} + GitVersionCore + - + + + + + + + + + + + + + + + + + + + + + + + + + + mono + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $(GitVersion_MajorMinorPatch) + $(GitVersion_MajorMinorPatch).$(GitVersion_PreReleaseTag) + + + + + + + + + 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/GitVersionExe/HelpWriter.cs b/src/GitVersionExe/HelpWriter.cs index ca2f4161d2..b9183c220d 100644 --- a/src/GitVersionExe/HelpWriter.cs +++ b/src/GitVersionExe/HelpWriter.cs @@ -16,7 +16,6 @@ public static void WriteTo(Action writeAction) Assembly assembly = Assembly.GetExecutingAssembly(); VersionWriter.WriteTo(assembly, v => version = v); - string message = "GitVersion " + version + @" Use convention to derive a SemVer product version from a GitFlow or GitHub based repository. @@ -38,7 +37,7 @@ path The directory containing .git. If not defined current directory Currently supported config overrides: tag-prefix /nocache Bypasses the cache, result will not be written to the cache. - # AssemblyInfo updating + # AssemblyInfo updating /updateassemblyinfo Will recursively search for all 'AssemblyInfo.cs' files in the git repo and update them /updateassemblyinfofilename @@ -48,7 +47,13 @@ Specify name of AssemblyInfo file. Can also /updateAssemblyInfo GlobalAssemblyIn it be created with these attributes: AssemblyFileVersion, AssemblyVersion and AssemblyInformationalVersion --- Supports writing version info for: C#, F#, VB -# Remote repository args + + # Create or update Wix version file + /updatewixversionfile + All the GitVersion variables are written to 'GitVersion_WixVersion.wxi'. + The variables can then be referenced in other WiX project files for versioning. + + # Remote repository args /url Url to remote git repository. /b Name of the branch to use on the remote repository, must be used in combination with /url. /u Username in case authentication is required. @@ -58,7 +63,7 @@ Specify name of AssemblyInfo file. Can also /updateAssemblyInfo GlobalAssemblyIn By default dynamic repositories will be cloned to %tmp%. Use this switch to override /nofetch Disables 'git fetch' during version calculation. Might cause GitVersion to not calculate your version as expected. -# Execute build args + # Execute build args /exec Executes target executable making GitVersion variables available as environmental variables /execargs Arguments for the executable specified by /exec /proj Build a msbuild file, GitVersion variables will be passed as msbuild properties @@ -69,7 +74,6 @@ Specify name of AssemblyInfo file. Can also /updateAssemblyInfo GlobalAssemblyIn gitversion init Configuration utility for gitversion "; - writeAction(message); } } diff --git a/nuspec/GitVersion.CommandLine.nuspec b/src/GitVersionExe/NugetAssets/GitVersion.CommandLine.nuspec similarity index 92% rename from nuspec/GitVersion.CommandLine.nuspec rename to src/GitVersionExe/NugetAssets/GitVersion.CommandLine.nuspec index 5fce1a2868..e511d0a845 100644 --- a/nuspec/GitVersion.CommandLine.nuspec +++ b/src/GitVersionExe/NugetAssets/GitVersion.CommandLine.nuspec @@ -6,7 +6,7 @@ GitVersion.CommandLine GitTools and Contributors GitTools and Contributors - MIT + http://www.opensource.org/licenses/mit-license.php https://github.com/GitTools/GitVersion https://raw.githubusercontent.com/GitTools/GitVersion/master/docs/img/package_icon.png false diff --git a/nuspec/GitVersion.Portable.nuspec b/src/GitVersionExe/NugetAssets/GitVersion.Portable.nuspec similarity index 100% rename from nuspec/GitVersion.Portable.nuspec rename to src/GitVersionExe/NugetAssets/GitVersion.Portable.nuspec diff --git a/src/GitVersionExe/NugetAssets/chocolateyInstall.ps1 b/src/GitVersionExe/NugetAssets/chocolateyInstall.ps1 new file mode 100644 index 0000000000..6d0d8b6d79 --- /dev/null +++ b/src/GitVersionExe/NugetAssets/chocolateyInstall.ps1 @@ -0,0 +1 @@ +Generate-BinFile "gfv" "$packageFolder\Tools\GitVersion.exe" \ No newline at end of file diff --git a/nuspec/chocolateyUninstall.ps1 b/src/GitVersionExe/NugetAssets/chocolateyUninstall.ps1 similarity index 51% rename from nuspec/chocolateyUninstall.ps1 rename to src/GitVersionExe/NugetAssets/chocolateyUninstall.ps1 index ddace64230..06198afa27 100644 --- a/nuspec/chocolateyUninstall.ps1 +++ b/src/GitVersionExe/NugetAssets/chocolateyUninstall.ps1 @@ -1,2 +1,2 @@ -Remove-BinFile "gv" "$packageFolder\Tools\GitVersion.exe" -Remove-BinFile "GitVersion" "$packageFolder\Tools\GitVersion.exe" +Remove-BinFile "gfv" "$packageFolder\Tools\GitVersion.exe" +Remove-BinFile "GitVersion" "$packageFolder\Tools\GitVersion.exe" \ No newline at end of file diff --git a/src/GitVersionExe/Program.cs b/src/GitVersionExe/Program.cs index e605eb3dd7..efa7db3beb 100644 --- a/src/GitVersionExe/Program.cs +++ b/src/GitVersionExe/Program.cs @@ -3,6 +3,7 @@ namespace GitVersion using GitVersion.Helpers; using System; using System.Collections.Generic; + using System.ComponentModel; using System.Diagnostics; using System.IO; using System.Linq; @@ -69,21 +70,19 @@ static int VerifyArgumentsAndRun() HelpWriter.Write(); return 0; } - if (arguments.Diag) { arguments.NoCache = true; arguments.Output = OutputType.BuildServer; - } + } ConfigureLogging(arguments); -#if NETDESKTOP + if (arguments.Diag) { Logger.WriteInfo("Dumping commit graph: "); - LibGitExtensions.DumpGraph(arguments.TargetPath, Logger.WriteInfo, 100); + GitTools.LibGitExtensions.DumpGraph(arguments.TargetPath, Logger.WriteInfo, 100); } -#endif if (!Directory.Exists(arguments.TargetPath)) { Logger.WriteWarning(string.Format("The working directory '{0}' does not exist.", arguments.TargetPath)); @@ -131,9 +130,7 @@ static int VerifyArgumentsAndRun() try { -#if NETDESKTOP - LibGitExtensions.DumpGraph(arguments.TargetPath, Logger.WriteInfo, 100); -#endif + GitTools.LibGitExtensions.DumpGraph(arguments.TargetPath, Logger.WriteInfo, 100); } catch (Exception dumpGraphException) { diff --git a/src/GitVersionExe/SpecifiedArgumentRunner.cs b/src/GitVersionExe/SpecifiedArgumentRunner.cs index f4b675a7f4..eb67ec51ba 100644 --- a/src/GitVersionExe/SpecifiedArgumentRunner.cs +++ b/src/GitVersionExe/SpecifiedArgumentRunner.cs @@ -1,9 +1,11 @@ namespace GitVersion { + using GitTools; using GitVersion.Helpers; using System; using System.Collections.Generic; using System.Linq; + using WarningException = System.ComponentModel.WarningException; class SpecifiedArgumentRunner { @@ -54,19 +56,23 @@ public static void Run(Arguments arguments, IFileSystem fileSystem) } } + if (arguments.UpdateWixVersionFile) + { + using (var wixVersionFileUpdater = new WixVersionFileUpdater(targetPath, variables, fileSystem)) + { + wixVersionFileUpdater.Update(); + } + } + using (var assemblyInfoUpdater = new AssemblyInfoFileUpdater(arguments.UpdateAssemblyInfoFileName, targetPath, variables, fileSystem, arguments.EnsureAssemblyInfo)) { if (arguments.UpdateAssemblyInfo) { assemblyInfoUpdater.Update(); } - var execRun = false; - var msbuildRun = false; -#if NETDESKTOP - execRun = RunExecCommandIfNeeded(arguments, targetPath, variables); - msbuildRun = RunMsBuildIfNeeded(arguments, targetPath, variables); -#endif + var execRun = RunExecCommandIfNeeded(arguments, targetPath, variables); + var msbuildRun = RunMsBuildIfNeeded(arguments, targetPath, variables); if (!execRun && !msbuildRun) { assemblyInfoUpdater.CommitChanges(); @@ -80,11 +86,9 @@ public static void Run(Arguments arguments, IFileSystem fileSystem) } } } -#if NETDESKTOP + static bool RunMsBuildIfNeeded(Arguments args, string workingDirectory, VersionVariables variables) { - - if (string.IsNullOrEmpty(args.Proj)) return false; Logger.WriteInfo(string.Format("Launching build tool {0} \"{1}\" {2}", BuildTool, args.Proj, args.ProjArgs)); @@ -99,7 +103,6 @@ static bool RunMsBuildIfNeeded(Arguments args, string workingDirectory, VersionV return true; } - static bool RunExecCommandIfNeeded(Arguments args, string workingDirectory, VersionVariables variables) { if (string.IsNullOrEmpty(args.Exec)) return false; @@ -115,7 +118,7 @@ static bool RunExecCommandIfNeeded(Arguments args, string workingDirectory, Vers return true; } -#endif + static KeyValuePair[] GetEnvironmentalVariables(VersionVariables variables) { return variables @@ -123,4 +126,4 @@ static KeyValuePair[] GetEnvironmentalVariables(VersionVariables .ToArray(); } } -} +} \ No newline at end of file diff --git a/src/GitVersionExe/app.config b/src/GitVersionExe/app.config new file mode 100644 index 0000000000..b57ccf84c3 --- /dev/null +++ b/src/GitVersionExe/app.config @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/src/GitVersionExe/packages.config b/src/GitVersionExe/packages.config new file mode 100644 index 0000000000..62114fb516 --- /dev/null +++ b/src/GitVersionExe/packages.config @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/src/GitVersionRubyGem/credentials b/src/GitVersionRubyGem/credentials deleted file mode 100644 index 902154e301..0000000000 --- a/src/GitVersionRubyGem/credentials +++ /dev/null @@ -1,2 +0,0 @@ ---- -:rubygems_api_key: $api_key$ diff --git a/src/GitVersionRubyGem/gitversion.gemspec b/src/GitVersionRubyGem/gitversion.gemspec deleted file mode 100644 index 3f79d9260d..0000000000 --- a/src/GitVersionRubyGem/gitversion.gemspec +++ /dev/null @@ -1,18 +0,0 @@ -Gem::Specification.new do |spec| - spec.platform = Gem::Platform::RUBY - spec.name = 'gitversion' - spec.licenses = ['MIT'] - spec.version = '$version$' - spec.summary = 'Easy Semantic Versioning (http://semver.org) for projects using Git' - spec.description = <<-EOF - Versioning when using git, solved. GitVersion looks at your git history and works out the semantic version of the commit being built. - EOF - - spec.authors = ['GitTools and Contributors'] - spec.homepage = 'https://github.com/GitTools/GitVersion' - - spec.files = Dir['bin/**/*', 'lib/**/*', '*.gemspec'].reject { |f| File.directory?(f) } - spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }.reject { |f| f =~ /\.(exe|pdb|dll|so|dylib)$/} - spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) - spec.require_paths = ['lib'] - end diff --git a/src/GitVersionTask.Tests/AssemblyParallelizable.cs b/src/GitVersionTask.Tests/AssemblyParallelizable.cs deleted file mode 100644 index 9f6f4f451f..0000000000 --- a/src/GitVersionTask.Tests/AssemblyParallelizable.cs +++ /dev/null @@ -1,3 +0,0 @@ -using NUnit.Framework; - -[assembly: Parallelizable(ParallelScope.Fixtures)] \ No newline at end of file diff --git a/src/GitVersionTask.Tests/FodyWeavers.xml b/src/GitVersionTask.Tests/FodyWeavers.xml new file mode 100644 index 0000000000..dbbeecb671 --- /dev/null +++ b/src/GitVersionTask.Tests/FodyWeavers.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/src/GitVersionTask.Tests/GetVersionTaskTests.cs b/src/GitVersionTask.Tests/GetVersionTaskTests.cs index a3f6d5c7d1..0030d56da0 100644 --- a/src/GitVersionTask.Tests/GetVersionTaskTests.cs +++ b/src/GitVersionTask.Tests/GetVersionTaskTests.cs @@ -6,7 +6,7 @@ using Shouldly; [TestFixture] -public class GetVersionTaskTests : TestBase +public class GetVersionTaskTests { [Test] public void OutputsShouldMatchVariableProvider() diff --git a/src/GitVersionTask.Tests/GitVersionTask.Tests.csproj b/src/GitVersionTask.Tests/GitVersionTask.Tests.csproj index 6446104b18..609219d570 100644 --- a/src/GitVersionTask.Tests/GitVersionTask.Tests.csproj +++ b/src/GitVersionTask.Tests/GitVersionTask.Tests.csproj @@ -1,32 +1,129 @@ - + + + - net461 - false - true + Debug + AnyCPU + 8.0.30703 + 2.0 + {5A86453B-96FB-4B6E-A283-225BB9F753D3} + Library + Properties + GitVersionTask.Tests + GitVersionTask.Tests + v4.5 + 6 + 512 + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + false + 414 + + + 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\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 + + + + + + + + + - - - - - - - all - runtime; build; native; contentfiles; analyzers - - - - - + + + + + + + + + + - + + + Designer + - + - + + {BF905F84-382C-440D-92F5-C61108626D8D} + GitVersionCore.Tests + + + {F9741A0D-B9D7-4557-9A1C-A7252C1071F5} + GitVersionCore + + + {F7AC0E71-3E9A-4F6D-B986-E004825A48E1} + GitVersionTask + - - + + + + + + + + + + + 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/GitVersionTask.Tests/GitVersionTaskDirectoryTests.cs b/src/GitVersionTask.Tests/GitVersionTaskDirectoryTests.cs index c928e6735f..9ba0c96cfc 100644 --- a/src/GitVersionTask.Tests/GitVersionTaskDirectoryTests.cs +++ b/src/GitVersionTask.Tests/GitVersionTaskDirectoryTests.cs @@ -8,7 +8,7 @@ using NUnit.Framework; [TestFixture] -public class GitVersionTaskDirectoryTests : TestBase +public class GitVersionTaskDirectoryTests { ExecuteCore executeCore; string gitDirectory; diff --git a/src/GitVersionTask.Tests/Helpers/DirectoryHelper.cs b/src/GitVersionTask.Tests/Helpers/DirectoryHelper.cs deleted file mode 100644 index 0b34a20605..0000000000 --- a/src/GitVersionTask.Tests/Helpers/DirectoryHelper.cs +++ /dev/null @@ -1,84 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; - -public static class DirectoryHelper -{ - static Dictionary toRename = new Dictionary - { - {"gitted", ".git"}, - {"gitmodules", ".gitmodules"}, - }; - - public static void CopyFilesRecursively(DirectoryInfo source, DirectoryInfo target) - { - // From http://stackoverflow.com/questions/58744/best-way-to-copy-the-entire-contents-of-a-directory-in-c/58779#58779 - - foreach (var dir in source.GetDirectories()) - { - CopyFilesRecursively(dir, target.CreateSubdirectory(Rename(dir.Name))); - } - foreach (var file in source.GetFiles()) - { - file.CopyTo(Path.Combine(target.FullName, Rename(file.Name))); - } - } - - static string Rename(string name) - { - return toRename.ContainsKey(name) ? toRename[name] : name; - } - - public static void DeleteSubDirectories(string parentPath) - { - var dirs = Directory.GetDirectories(parentPath); - foreach (var dir in dirs) - { - DeleteDirectory(dir); - } - } - - public static void DeleteDirectory(string directoryPath) - { - // From http://stackoverflow.com/questions/329355/cannot-delete-directory-with-directory-deletepath-true/329502#329502 - - if (!Directory.Exists(directoryPath)) - { - Trace.WriteLine( - string.Format("Directory '{0}' is missing and can't be removed.", - directoryPath)); - - return; - } - - var files = Directory.GetFiles(directoryPath); - var dirs = Directory.GetDirectories(directoryPath); - - foreach (var file in files) - { - File.SetAttributes(file, FileAttributes.Normal); - File.Delete(file); - } - - foreach (var dir in dirs) - { - DeleteDirectory(dir); - } - - File.SetAttributes(directoryPath, FileAttributes.Normal); - try - { - Directory.Delete(directoryPath, false); - } - catch (IOException) - { - Trace.WriteLine(string.Format("{0}The directory '{1}' could not be deleted!" + - "{0}Most of the time, this is due to an external process accessing the files in the temporary repositories created during the test runs, and keeping a handle on the directory, thus preventing the deletion of those files." + - "{0}Known and common causes include:" + - "{0}- Windows Search Indexer (go to the Indexing Options, in the Windows Control Panel, and exclude the bin folder of LibGit2Sharp.Tests)" + - "{0}- Antivirus (exclude the bin folder of LibGit2Sharp.Tests from the paths scanned by your real-time antivirus){0}", - Environment.NewLine, Path.GetFullPath(directoryPath))); - } - } -} \ No newline at end of file diff --git a/src/GitVersionTask.Tests/Helpers/PathHelper.cs b/src/GitVersionTask.Tests/Helpers/PathHelper.cs deleted file mode 100644 index b73edfeda1..0000000000 --- a/src/GitVersionTask.Tests/Helpers/PathHelper.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.IO; -using System.Reflection; - -public static class PathHelper -{ - public static string GetCurrentDirectory() - { - return Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); - } - - public static string GetTempPath() - { - return Path.Combine(GetCurrentDirectory(), "TestRepositories", Guid.NewGuid().ToString()); - } -} \ No newline at end of file diff --git a/src/GitVersionTask.Tests/Helpers/TestEffectiveConfiguration.cs b/src/GitVersionTask.Tests/Helpers/TestEffectiveConfiguration.cs deleted file mode 100644 index 876de76ac1..0000000000 --- a/src/GitVersionTask.Tests/Helpers/TestEffectiveConfiguration.cs +++ /dev/null @@ -1,47 +0,0 @@ -namespace GitVersionCore.Tests -{ - using GitVersion; - using GitVersion.VersionFilters; - using System.Collections.Generic; - using System.Linq; - - public class TestEffectiveConfiguration : EffectiveConfiguration - { - public TestEffectiveConfiguration( - AssemblyVersioningScheme assemblyVersioningScheme = AssemblyVersioningScheme.MajorMinorPatch, - AssemblyFileVersioningScheme assemblyFileVersioningScheme = AssemblyFileVersioningScheme.MajorMinorPatch, - string assemblyVersioningFormat = null, - string assemblyFileVersioningFormat = null, - string assemblyInformationalFormat = null, - VersioningMode versioningMode = VersioningMode.ContinuousDelivery, - string gitTagPrefix = "v", - string tag = "", - string nextVersion = null, - string branchPrefixToTrim = "", - bool preventIncrementForMergedBranchVersion = false, - string tagNumberPattern = null, - string continuousDeploymentFallbackTag = "ci", - bool trackMergeTarget = false, - string majorMessage = null, - string minorMessage = null, - string patchMessage = null, - string noBumpMessage = null, - CommitMessageIncrementMode commitMessageMode = CommitMessageIncrementMode.Enabled, - int legacySemVerPadding = 4, - int buildMetaDataPadding = 4, - int commitsSinceVersionSourcePadding = 4, - IEnumerable versionFilters = null, - bool tracksReleaseBranches = false, - bool isRelease = false, - string commitDateFormat = "yyyy-MM-dd") : - base(assemblyVersioningScheme, assemblyFileVersioningScheme, assemblyInformationalFormat, assemblyVersioningFormat, assemblyFileVersioningFormat, versioningMode, gitTagPrefix, tag, nextVersion, IncrementStrategy.Patch, - branchPrefixToTrim, preventIncrementForMergedBranchVersion, tagNumberPattern, continuousDeploymentFallbackTag, - trackMergeTarget, - majorMessage, minorMessage, patchMessage, noBumpMessage, - commitMessageMode, legacySemVerPadding, buildMetaDataPadding, commitsSinceVersionSourcePadding, - versionFilters ?? Enumerable.Empty(), - tracksReleaseBranches, isRelease, commitDateFormat) - { - } - } -} \ No newline at end of file diff --git a/src/GitVersionTask.Tests/Helpers/TestFileSystem.cs b/src/GitVersionTask.Tests/Helpers/TestFileSystem.cs deleted file mode 100644 index 217957b015..0000000000 --- a/src/GitVersionTask.Tests/Helpers/TestFileSystem.cs +++ /dev/null @@ -1,115 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Text; - -using GitVersion.Helpers; - -public class TestFileSystem : IFileSystem -{ - Dictionary fileSystem = new Dictionary(); - - public void Copy(string @from, string to, bool overwrite) - { - if (fileSystem.ContainsKey(to)) - { - if (overwrite) - fileSystem.Remove(to); - else - throw new IOException("File already exists"); - } - - byte[] source; - if (!fileSystem.TryGetValue(from, out source)) - throw new FileNotFoundException(string.Format("The source file '{0}' was not found", from), from); - - fileSystem.Add(to, source); - } - - public void Move(string @from, string to) - { - Copy(from, to, false); - fileSystem.Remove(from); - } - - public bool Exists(string file) - { - return fileSystem.ContainsKey(file); - } - - public void Delete(string path) - { - fileSystem.Remove(path); - } - - public string ReadAllText(string path) - { - byte[] content; - if (!fileSystem.TryGetValue(path, out content)) - throw new FileNotFoundException(string.Format("The file '{0}' was not found", path), path); - - var encoding = EncodingHelper.DetectEncoding(content) ?? Encoding.UTF8; - return encoding.GetString(content); - } - - public void WriteAllText(string file, string fileContents) - { - var encoding = fileSystem.ContainsKey(file) - ? EncodingHelper.DetectEncoding(fileSystem[file]) ?? Encoding.UTF8 - : Encoding.UTF8; - WriteAllText(file, fileContents, encoding); - } - - public void WriteAllText(string file, string fileContents, Encoding encoding) - { - fileSystem[file] = encoding.GetBytes(fileContents); - } - - public IEnumerable DirectoryGetFiles(string directory, string searchPattern, SearchOption searchOption) - { - throw new NotImplementedException(); - } - - public Stream OpenWrite(string path) - { - return new TestStream(path, this); - } - - public Stream OpenRead(string path) - { - if (fileSystem.ContainsKey(path)) - { - var content = fileSystem[path]; - return new MemoryStream(content); - } - - throw new FileNotFoundException("File not found.", path); - } - - public void CreateDirectory(string path) - { - if (fileSystem.ContainsKey(path)) - { - fileSystem[path] = new byte[0]; - } - else - { - fileSystem.Add(path, new byte[0]); - } - } - - public bool DirectoryExists(string path) - { - return fileSystem.ContainsKey(path); - } - - public long GetLastDirectoryWrite(string path) - { - return 1; - } - - public bool PathsEqual(string path, string otherPath) - { - return path == otherPath; - } -} \ No newline at end of file diff --git a/src/GitVersionTask.Tests/Helpers/TestStream.cs b/src/GitVersionTask.Tests/Helpers/TestStream.cs deleted file mode 100644 index ce23cfa7ec..0000000000 --- a/src/GitVersionTask.Tests/Helpers/TestStream.cs +++ /dev/null @@ -1,76 +0,0 @@ -using System; -using System.IO; -using System.Threading; -using System.Threading.Tasks; - -public class TestStream : Stream -{ - readonly string path; - readonly TestFileSystem testFileSystem; - MemoryStream underlying = new MemoryStream(); - - public TestStream(string path, TestFileSystem testFileSystem) - { - this.path = path; - this.testFileSystem = testFileSystem; - } - - protected override void Dispose(bool disposing) - { - Flush(); - base.Dispose(disposing); - } - - public override void Flush() - { - underlying.Position = 0; - var readToEnd = new StreamReader(underlying).ReadToEnd(); - testFileSystem.WriteAllText(path, readToEnd); - } - - public override long Seek(long offset, SeekOrigin origin) - { - return underlying.Seek(offset, origin); - } - - public override void SetLength(long value) - { - underlying.SetLength(value); - } - - public override int Read(byte[] buffer, int offset, int count) - { - return underlying.Read(buffer, offset, count); - } - - public override void Write(byte[] buffer, int offset, int count) - { - underlying.Write(buffer, offset, count); - } - - public override void WriteByte(byte value) - { - base.WriteByte(value); - } - - public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state) - { - return base.BeginWrite(buffer, offset, count, callback, state); - } - - public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) - { - return base.WriteAsync(buffer, offset, count, cancellationToken); - } - - public override bool CanRead { get { return underlying.CanRead; } } - public override bool CanSeek { get { return underlying.CanSeek; } } - public override bool CanWrite { get { return underlying.CanWrite; } } - public override long Length { get { return underlying.Length; } } - - public override long Position - { - get { return underlying.Position; } - set { underlying.Position = value; } - } -} \ No newline at end of file diff --git a/src/GitVersionTask.Tests/InvalidFileCheckerTests.cs b/src/GitVersionTask.Tests/InvalidFileCheckerTests.cs index e8877d2f94..bf562a329d 100644 --- a/src/GitVersionTask.Tests/InvalidFileCheckerTests.cs +++ b/src/GitVersionTask.Tests/InvalidFileCheckerTests.cs @@ -1,12 +1,12 @@ -using System; +using System; +using System.ComponentModel; using System.IO; -using GitVersion; using GitVersionTask.Tests.Mocks; using Microsoft.Build.Framework; using NUnit.Framework; [TestFixture] -public class InvalidFileCheckerTests : TestBase +public class InvalidFileCheckerTests { string projectDirectory; string projectFile; @@ -217,4 +217,4 @@ End Class InvalidFileChecker.CheckForInvalidFiles(new ITaskItem[] { new MockTaskItem { ItemSpec = "AssemblyInfo.vb" } }, projectFile); } -} +} \ No newline at end of file diff --git a/src/GitVersionTask.Tests/TestBase.cs b/src/GitVersionTask.Tests/TestBase.cs deleted file mode 100644 index 2d183c187f..0000000000 --- a/src/GitVersionTask.Tests/TestBase.cs +++ /dev/null @@ -1,9 +0,0 @@ -public class TestBase -{ - static TestBase() - { - ModuleInitializer.Initialize(); - } - -} - diff --git a/src/GitVersionTask.Tests/app.config b/src/GitVersionTask.Tests/app.config new file mode 100644 index 0000000000..3d12e16fad --- /dev/null +++ b/src/GitVersionTask.Tests/app.config @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/GitVersionTask.Tests/packages.config b/src/GitVersionTask.Tests/packages.config new file mode 100644 index 0000000000..ea2a6b4fc9 --- /dev/null +++ b/src/GitVersionTask.Tests/packages.config @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/GitVersionTask/AssemblyInfo.cs b/src/GitVersionTask/AssemblyInfo.cs new file mode 100644 index 0000000000..d4fbe64c8f --- /dev/null +++ b/src/GitVersionTask/AssemblyInfo.cs @@ -0,0 +1,7 @@ +using System.Reflection; + +[assembly: AssemblyTitle("GitVersionTask")] +[assembly: AssemblyProduct("GitVersionTask")] +[assembly: AssemblyVersion("4.0.0.0")] +[assembly: AssemblyFileVersion("4.0.0.0")] +[assembly: AssemblyInformationalVersion("4.0.0-beta.12+1291.Branch.master.Sha.bc74ac2247d8a58053a33316334ada6b771a8455")] diff --git a/src/GitVersionTask/FodyWeavers.xml b/src/GitVersionTask/FodyWeavers.xml new file mode 100644 index 0000000000..6c4dacc2ba --- /dev/null +++ b/src/GitVersionTask/FodyWeavers.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/src/GitVersionTask/GenerateGitVersionInformation.cs b/src/GitVersionTask/GenerateGitVersionInformation.cs index d91a7898dc..aa863b9e19 100644 --- a/src/GitVersionTask/GenerateGitVersionInformation.cs +++ b/src/GitVersionTask/GenerateGitVersionInformation.cs @@ -1,6 +1,7 @@ -namespace GitVersionTask +namespace GitVersionTask { using System; + using System.ComponentModel; using System.IO; using GitVersion; using GitVersion.Helpers; diff --git a/src/GitVersionTask/GetVersion.cs b/src/GitVersionTask/GetVersion.cs index 818f43eeed..c699dd2e0d 100644 --- a/src/GitVersionTask/GetVersion.cs +++ b/src/GitVersionTask/GetVersion.cs @@ -1,6 +1,7 @@ -namespace GitVersionTask +namespace GitVersionTask { using System; + using System.ComponentModel; using GitVersion; using Microsoft.Build.Framework; @@ -80,9 +81,6 @@ public GetVersion() [Output] public string Sha { get; set; } - [Output] - public string ShortSha { get; set; } - [Output] public string NuGetVersionV2 { get; set; } @@ -136,4 +134,4 @@ public override bool Execute() } } } -} +} \ No newline at end of file diff --git a/src/GitVersionTask/GitVersionTask.csproj b/src/GitVersionTask/GitVersionTask.csproj index 39f6ddf96e..f994daa49c 100644 --- a/src/GitVersionTask/GitVersionTask.csproj +++ b/src/GitVersionTask/GitVersionTask.csproj @@ -1,55 +1,150 @@  - - - - + + + - net461;netstandard2.0 - false - - GitVersionTask - GitVersionTask - - Stamps an assembly with git information based on SemVer. - - true - build - - NugetAssets\GitVersionTask.nuspec - 0.0.1-alpha-0001 - version=$(PackageVersion);configuration=$(Configuration);utilpackversion=$(PackageVersion_UtilPackNuGetMSBuild);libgit2sharpversion=$(PackageVersion_LibGit2Sharp);yamldotnetversion=$(PackageVersion_YamlDotNet) - - $(AssemblyName) - + Debug + AnyCPU + {F7AC0E71-3E9A-4F6D-B986-E004825A48E1} + Library + Properties + GitVersionTask + GitVersionTask + v4.0 + 6 + 512 + $(SolutionDir)..\build\ + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + false + 1591 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + false + 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 + + + + + + + + + + + + + + ..\packages\YamlDotNet.3.8.0\lib\net35\YamlDotNet.dll + True + - - build\ - + + + + + + + + + + - - - - - All - - - - - all - runtime; build; native; contentfiles; analyzers - + + + + + Designer + + + Designer + - - + + Designer + - - + + {f9741a0d-b9d7-4557-9a1c-a7252c1071f5} + GitVersionCore + - + + + + + + + + + + + mono + + + + + + + + + + + + + + + + + + + + + + + + + + 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/GitVersionTask/InvalidFileChecker.cs b/src/GitVersionTask/InvalidFileChecker.cs index d20be03e56..8717977ece 100644 --- a/src/GitVersionTask/InvalidFileChecker.cs +++ b/src/GitVersionTask/InvalidFileChecker.cs @@ -1,9 +1,9 @@ using System; using System.Collections.Generic; +using System.ComponentModel; using System.IO; using System.Linq; using System.Text.RegularExpressions; -using GitVersion; using Microsoft.Build.Framework; public static class InvalidFileChecker @@ -104,4 +104,4 @@ static IEnumerable GetInvalidFiles(IEnumerable compileFiles, .Where(compileFile => compileFile.Contains("AssemblyInfo")) .Where(s => FileContainsVersionAttribute(s, projectFile)); } -} +} \ No newline at end of file diff --git a/src/GitVersionTask/NugetAssets/GitVersionTask.nuspec b/src/GitVersionTask/NugetAssets/GitVersionTask.nuspec index b3436fdce8..2e053e86cc 100644 --- a/src/GitVersionTask/NugetAssets/GitVersionTask.nuspec +++ b/src/GitVersionTask/NugetAssets/GitVersionTask.nuspec @@ -1,38 +1,19 @@ - - - + + + GitVersionTask - 1.0.0 + $version$ GitVersionTask GitTools and Contributors GitTools and Contributors - false - true - MIT + http://www.opensource.org/licenses/mit-license.php https://github.com/GitTools/GitVersion https://raw.githubusercontent.com/GitTools/GitVersion/master/docs/img/package_icon.png + false Stamps an assembly with git information based on SemVer. - https://github.com/GitTools/GitVersion/releases - Copyright GitTools 2019. + en-AU Git Versioning GitVersion GitFlowVersion GitFlow GitHubFlow SemVer - - - - - - - - - - - - - + true + https://github.com/GitTools/GitVersion/releases - - - - - - diff --git a/src/GitVersionTask/NugetAssets/build/GitVersionTask.targets b/src/GitVersionTask/NugetAssets/build/GitVersionTask.targets index d816d04563..7247e6a4c2 100644 --- a/src/GitVersionTask/NugetAssets/build/GitVersionTask.targets +++ b/src/GitVersionTask/NugetAssets/build/GitVersionTask.targets @@ -1,13 +1,156 @@ - - + + - false - true + True + + $(MSBuildProjectDirectory)\..\ + $(SolutionDir) + $(MSBuildProjectDirectory) + $(SolutionDir)\GitVersionTask.targets + $(SolutionDir)\GitVersionTask.targets + + $(MSBuildProjectDirectory)\obj\$(Configuration)\ + false + + + false + true + + + false + false + true + + + false + true + + + true + false + + + false + true + + $(GetPackageVersionDependsOn);GetVersion + + $(MSBuildThisFileDirectory) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $(GitVersion_FullSemVer) + $(GitVersion_MajorMinorPatch) + $(GitVersion_NuGetPreReleaseTag) + $(GitVersion_PreReleaseTag) + $(GitVersion_NuGetVersion) + $(GitVersion_FullSemVer) + $(GitVersion_InformationalVersion) + $(GitVersion_AssemblySemVer) + $(GitVersion_AssemblySemFileVer) + + + - - - - + + + + False + + + False + + + False + + diff --git a/src/GitVersionTask/NugetAssets/build/Infrastructure.props b/src/GitVersionTask/NugetAssets/build/Infrastructure.props deleted file mode 100644 index e5ff8092e1..0000000000 --- a/src/GitVersionTask/NugetAssets/build/Infrastructure.props +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - $(MSBuildThisFileDirectory)functionality/ - $(GitVersionTaskBuildTools_FunctionalityDir)GitVersionBuild.targets - $(GitVersionTaskBuildTools_FunctionalityDir)GitVersionMultiTargetBuild.targets - $(GitVersionTaskBuildTools_FunctionalityDir)obj/ - - - - $(PackageVersion_UtilPackNuGetMSBuild) - $(MSBuildThisFileDirectory)../../../utilpack.nuget.msbuild/$(UtilPackVersion)/build/UtilPack.NuGet.MSBuild.props - $([System.IO.Path]::GetFullPath('$(UtilPackNuGetMSBuildPropsPath)')) - - - - - - true - - - - - .NETFramework - 4.6.1 - - - $(UtilPackTaskFactoryParametersXML) - true - GitVersionTask.dll - - - - - - - - - - diff --git a/src/GitVersionTask/NugetAssets/build/functionality/GitVersionBuild.targets b/src/GitVersionTask/NugetAssets/build/functionality/GitVersionBuild.targets deleted file mode 100644 index 95d8e40022..0000000000 --- a/src/GitVersionTask/NugetAssets/build/functionality/GitVersionBuild.targets +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - $(GitVersion_FullSemVer) - $(GitVersion_MajorMinorPatch) - $(GitVersion_NuGetPreReleaseTag) - $(GitVersion_PreReleaseTag) - $(GitVersion_NuGetVersion) - $(GitVersion_FullSemVer) - $(GitVersion_InformationalVersion) - $(GitVersion_AssemblySemVer) - $(GitVersion_AssemblySemFileVer) - - - - - - - - False - - - False - - - False - - - - diff --git a/src/GitVersionTask/NugetAssets/build/functionality/GitVersionCommon.props b/src/GitVersionTask/NugetAssets/build/functionality/GitVersionCommon.props deleted file mode 100644 index 36b320e5a5..0000000000 --- a/src/GitVersionTask/NugetAssets/build/functionality/GitVersionCommon.props +++ /dev/null @@ -1,82 +0,0 @@ - - - - $(MSBuildProjectDirectory)\..\ - $(SolutionDir) - $(MSBuildProjectDirectory) - $(SolutionDir)\GitVersionTask.targets - $(SolutionDir)\GitVersionTask.targets - - false - $(MSBuildProjectDirectory)\obj\$(Configuration)\ - - - false - true - - - false - false - true - - - false - true - - false - true - - - $(MarkupCompilePass1DependsOn);GetVersion - - $(GetPackageVersionDependsOn);GetVersion - - - true - false - - - - - $(UtilPackTaskFactoryParametersXML) - - - - - $(UtilPackTaskFactoryParametersXML) - - - - - $(UtilPackTaskFactoryParametersXML) - - - - - $(UtilPackTaskFactoryParametersXML) - - - - True - - - \ No newline at end of file diff --git a/src/GitVersionTask/NugetAssets/build/functionality/GitVersionMultiTargetBuild.targets b/src/GitVersionTask/NugetAssets/buildMultiTargeting/GitVersionTask.targets similarity index 52% rename from src/GitVersionTask/NugetAssets/build/functionality/GitVersionMultiTargetBuild.targets rename to src/GitVersionTask/NugetAssets/buildMultiTargeting/GitVersionTask.targets index 379ff192cb..ffd55b4cc2 100644 --- a/src/GitVersionTask/NugetAssets/build/functionality/GitVersionMultiTargetBuild.targets +++ b/src/GitVersionTask/NugetAssets/buildMultiTargeting/GitVersionTask.targets @@ -1,12 +1,63 @@  - + + True + + + $(MSBuildProjectDirectory)\..\ + $(SolutionDir) + $(MSBuildProjectDirectory) + $(SolutionDir)\GitVersionTask.targets + $(SolutionDir)\GitVersionTask.targets + + false + + + false + true + + + false + false + true + + + false + true + + false + true + + $(GetPackageVersionDependsOn);GetVersion + + + true + false + + $(MSBuildThisFileDirectory)..\build\ + + + + + + + + + diff --git a/src/GitVersionTask/UpdateAssemblyInfo.cs b/src/GitVersionTask/UpdateAssemblyInfo.cs index 27ccab47d1..f6972f9139 100644 --- a/src/GitVersionTask/UpdateAssemblyInfo.cs +++ b/src/GitVersionTask/UpdateAssemblyInfo.cs @@ -1,8 +1,8 @@ -namespace GitVersionTask +namespace GitVersionTask { using System; + using System.ComponentModel; using System.IO; - using GitVersion; using GitVersion.Helpers; using Microsoft.Build.Framework; @@ -114,4 +114,4 @@ string GetFileExtension() } } } -} +} \ No newline at end of file diff --git a/src/GitVersionTask/UtilPack.Version.props b/src/GitVersionTask/UtilPack.Version.props deleted file mode 100644 index 109fbf9d1e..0000000000 --- a/src/GitVersionTask/UtilPack.Version.props +++ /dev/null @@ -1,6 +0,0 @@ - - - 2.9.1 - - - diff --git a/src/GitVersionTask/WriteVersionInfoToBuildLog.cs b/src/GitVersionTask/WriteVersionInfoToBuildLog.cs index fcc1f8998d..32715053a5 100644 --- a/src/GitVersionTask/WriteVersionInfoToBuildLog.cs +++ b/src/GitVersionTask/WriteVersionInfoToBuildLog.cs @@ -1,8 +1,11 @@ -namespace GitVersionTask +namespace GitVersionTask { using System; using System.Collections.Generic; + using System.ComponentModel; + using GitVersion; + using Microsoft.Build.Framework; public class WriteVersionInfoToBuildLog : GitVersionTaskBase @@ -68,4 +71,4 @@ void WriteIntegrationParameters(IEnumerable applicableBuildServers } } } -} +} \ No newline at end of file diff --git a/src/GitVersionTask/app.config b/src/GitVersionTask/app.config new file mode 100644 index 0000000000..b57ccf84c3 --- /dev/null +++ b/src/GitVersionTask/app.config @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/src/GitVersionTask/key.snk b/src/GitVersionTask/key.snk deleted file mode 100644 index 17a1bfef71..0000000000 Binary files a/src/GitVersionTask/key.snk and /dev/null differ diff --git a/src/GitVersionTask/packages.config b/src/GitVersionTask/packages.config new file mode 100644 index 0000000000..d94e9e5e27 --- /dev/null +++ b/src/GitVersionTask/packages.config @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/src/GitVersionTfsTask/BuildTs.ps1 b/src/GitVersionTfsTask/BuildTs.ps1 new file mode 100644 index 0000000000..dc938531c3 --- /dev/null +++ b/src/GitVersionTfsTask/BuildTs.ps1 @@ -0,0 +1,16 @@ +param ( +) + +$scriptpath = $MyInvocation.MyCommand.Path +$dir = Split-Path $scriptpath +Push-Location $dir +Write-Host $dir +Try +{ + & npm install + & node_modules/.bin/tsc +} +Finally +{ + Pop-Location +} diff --git a/src/GitVersionTfsTask/Create-Vsix.ps1 b/src/GitVersionTfsTask/Create-Vsix.ps1 new file mode 100644 index 0000000000..3adea9af82 --- /dev/null +++ b/src/GitVersionTfsTask/Create-Vsix.ps1 @@ -0,0 +1,13 @@ +param ( +[string] $taskFolder +) + +Push-Location $taskFolder +Try +{ + & tfx extension create --manifest-globs manifest.json +} +Finally +{ + Pop-Location +} diff --git a/src/GitVersionTfsTask/GitVersion.ts b/src/GitVersionTfsTask/GitVersion.ts index 8c4e2f00c4..bd5b129df5 100644 --- a/src/GitVersionTfsTask/GitVersion.ts +++ b/src/GitVersionTfsTask/GitVersion.ts @@ -1,107 +1,80 @@ -import tl = require('azure-pipelines-task-lib/task'); -import { IExecOptions, ToolRunner } from 'azure-pipelines-task-lib/toolrunner'; +import tl = require('vsts-task-lib/task'); +import { IExecOptions, ToolRunner } from 'vsts-task-lib/toolrunner'; import path = require('path'); +import q = require('q'); import os = require('os'); -import { ArgumentParser } from 'argparse'; -export class GitVersionTask { +var updateAssemblyInfo = tl.getBoolInput('updateAssemblyInfo'); +var updateAssemblyInfoFilename = tl.getInput('updateAssemblyInfoFilename'); +var additionalArguments = tl.getInput('additionalArguments'); +var gitVersionPath = tl.getInput('gitVersionPath'); +var preferBundledVersion = tl.getBoolInput('preferBundledVersion'); - public static async execute() { - try { +var currentDirectory = __dirname; - const updateAssemblyInfo = tl.getBoolInput('updateAssemblyInfo'); - const updateAssemblyInfoFilename = tl.getInput('updateAssemblyInfoFilename'); - const additionalArguments = tl.getInput('additionalArguments'); - const targetPath = tl.getInput('targetPath'); - const preferBundledVersion = tl.getBoolInput('preferBundledVersion'); +var sourcesDirectory = tl.getVariable("Build.SourcesDirectory") - const currentDirectory = __dirname; - const workingDirectory = !targetPath - ? tl.getVariable("Build.SourcesDirectory") - : path.join(tl.getVariable("Build.SourcesDirectory"), targetPath); - - let gitVersionPath = tl.getInput('gitVersionPath'); - if (!gitVersionPath) { - gitVersionPath = tl.which("GitVersion.exe"); - if (preferBundledVersion || !gitVersionPath) { - gitVersionPath = path.join(currentDirectory, "GitVersion.exe"); - } - } - - const execOptions: IExecOptions = { - cwd: undefined, - env: undefined, - silent: undefined, - failOnStdErr: undefined, - ignoreReturnCode: undefined, - errStream: undefined, - outStream: undefined, - windowsVerbatimArguments: undefined - }; - - let toolRunner: ToolRunner; - - const parser = new ArgumentParser(); - parser.addArgument( - [ '-r', '--runtime'], - { - help: '[mono|netcore]', - defaultValue: 'mono' - } - ); - - const args = parser.parseArgs(); - switch (args.runtime) { - case 'netcore': - gitVersionPath = path.join(currentDirectory, "netcore", "GitVersion.dll"); - toolRunner = tl.tool("dotnet"); - toolRunner.arg(gitVersionPath); - break; - - case 'mono': - default: - const isWin32 = os.platform() == "win32"; - if (isWin32) { - toolRunner = tl.tool(gitVersionPath); - } else { - toolRunner = tl.tool("mono"); - toolRunner.arg(gitVersionPath); - } - - break; - } - - toolRunner.arg([ - workingDirectory, - "/output", - "buildserver", - "/nofetch"]); - - if (updateAssemblyInfo) { - toolRunner.arg("/updateassemblyinfo"); - if (updateAssemblyInfoFilename) { - toolRunner.arg(updateAssemblyInfoFilename); - } else { - toolRunner.arg("true"); - } - } +if (!gitVersionPath) { + gitVersionPath = tl.which("GitVersion.exe"); + if (preferBundledVersion || !gitVersionPath) { + gitVersionPath = path.join(currentDirectory, "GitVersion.exe"); + } +} - if (additionalArguments) { - toolRunner.line(additionalArguments); - } +(async function execute() { + try { + + var execOptions: IExecOptions = { + cwd: undefined, + env: undefined, + silent: undefined, + failOnStdErr: undefined, + ignoreReturnCode: undefined, + errStream: undefined, + outStream: undefined, + windowsVerbatimArguments: undefined + }; + + var toolRunner: ToolRunner; + + var isWin32 = os.platform() == "win32"; + + if (isWin32) { + toolRunner = tl.tool(gitVersionPath); + } else { + toolRunner = tl.tool("mono"); + toolRunner.arg(gitVersionPath); + } - const result = await toolRunner.exec(execOptions); - if (result) { - tl.setResult(tl.TaskResult.Failed, "An error occured during GitVersion execution") + toolRunner.arg([ + sourcesDirectory, + "/output", + "buildserver", + "/nofetch" + ]); + + if (updateAssemblyInfo) { + toolRunner.arg("/updateassemblyinfo") + if (updateAssemblyInfoFilename) { + toolRunner.arg(updateAssemblyInfoFilename); } else { - tl.setResult(tl.TaskResult.Succeeded, "GitVersion executed successfully") + toolRunner.arg("true"); } } - catch (err) { - tl.debug(err.stack); - tl.setResult(tl.TaskResult.Failed, err); + + if (additionalArguments) { + toolRunner.line(additionalArguments); } - } -} -GitVersionTask.execute(); + var result = await toolRunner.exec(execOptions); + if (result) { + tl.setResult(tl.TaskResult.Failed, "An error occured during GitVersion execution") + } else { + tl.setResult(tl.TaskResult.Succeeded, "GitVersion executed successfully") + } + } + catch (err) { + tl.debug(err.stack) + tl.setResult(tl.TaskResult.Failed, err); + } +})(); diff --git a/src/GitVersionTfsTask/GitVersionNetCoreTask/icon.png b/src/GitVersionTfsTask/GitVersionNetCoreTask/icon.png deleted file mode 100644 index e9efbda62e..0000000000 Binary files a/src/GitVersionTfsTask/GitVersionNetCoreTask/icon.png and /dev/null differ diff --git a/src/GitVersionTfsTask/GitVersionNetCoreTask/task.json b/src/GitVersionTfsTask/GitVersionNetCoreTask/task.json deleted file mode 100644 index bb1ef6b1ec..0000000000 --- a/src/GitVersionTfsTask/GitVersionNetCoreTask/task.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "id": "ce526674-dbd1-4023-ad6d-2a6b9742ee31", - "name": "GitVersionNetCore", - "friendlyName": "GitVersion .NET Core Task", - "description": "Easy Semantic Versioning (http://semver.org) for projects using Git", - "author": "GitVersion Contributors", - "helpMarkDown": "See the [documentation](http://gitversion.readthedocs.org/en/latest/) for help", - "category": "Build", - "demands": [], - "version": { - "Major": "4", - "Minor": "0", - "Patch": "1" - }, - "minimumAgentVersion": "1.83.0", - "groups": [ - { - "name": "additional", - "displayName": "Additional Options", - "isExpanded": false - } - ], - "instanceNameFormat": "GitVersion", - "inputs": [ - { - "name": "updateAssemblyInfo", - "type": "boolean", - "label": "Update AssemblyInfo files", - "defaultValue": "false", - "required": false, - "helpMarkDown": "Whether to update versions in the AssemblyInfo files" - }, - { - "name": "updateAssemblyInfoFilename", - "type": "string", - "label": "Update Assembly File", - "defaultValue": "", - "required": false, - "helpMarkDown": "Update versions in specified file", - "groupName": "additional" - }, - { - "name": "additionalArguments", - "type": "string", - "label": "Additional GitVersion.dll arguments", - "defaultValue": "", - "required": false, - "helpMarkDown": "Additional arguments to send to GitVersion.dll", - "groupName": "additional" - } - ], - "execution": { - "Node": { - "target": "GitVersion.js", - "argumentFormat": "--runtime netcore", - "workingDirectory": "." - } - } -} \ No newline at end of file diff --git a/src/GitVersionTfsTask/GitVersionTask/icon.png b/src/GitVersionTfsTask/GitVersionTask/icon.png deleted file mode 100644 index e9efbda62e..0000000000 Binary files a/src/GitVersionTfsTask/GitVersionTask/icon.png and /dev/null differ diff --git a/src/GitVersionTfsTask/Update-GitVersionTfsTaskVersion.ps1 b/src/GitVersionTfsTask/Update-GitVersionTfsTaskVersion.ps1 new file mode 100644 index 0000000000..d7a65ce22c --- /dev/null +++ b/src/GitVersionTfsTask/Update-GitVersionTfsTaskVersion.ps1 @@ -0,0 +1,27 @@ +param ( +[string] $filePath, +[string] $version +) + +if ([string]::IsNullOrWhiteSpace($filePath)) { + throw "File path needs to be provided." +} + +if ([string]::IsNullOrWhiteSpace($version)) { + throw "Version number needs to be provided." +} + +Write-Host "Set version in '$filePath' to $version" + +$ver = [Version]$version + +# Get the task.json as a powershell object +$task = Get-Content -Raw -Path $filePath | ConvertFrom-Json + +$task.version.Major = $ver.Major +$task.version.Minor = $ver.Minor +$task.version.Patch = $ver.Build + +# get this as a string again + +ConvertTo-Json $task -Depth 100 | Set-Content -Path $filePath \ No newline at end of file diff --git a/src/GitVersionTfsTask/images/build-task.png b/src/GitVersionTfsTask/build-task.png similarity index 100% rename from src/GitVersionTfsTask/images/build-task.png rename to src/GitVersionTfsTask/build-task.png diff --git a/src/GitVersionTfsTask/images/builds.png b/src/GitVersionTfsTask/builds.png similarity index 100% rename from src/GitVersionTfsTask/images/builds.png rename to src/GitVersionTfsTask/builds.png diff --git a/src/GitVersionTfsTask/images/extension-icon.png b/src/GitVersionTfsTask/extension-icon.png similarity index 100% rename from src/GitVersionTfsTask/images/extension-icon.png rename to src/GitVersionTfsTask/extension-icon.png diff --git a/src/GitVersionTfsTask/icon.png b/src/GitVersionTfsTask/icon.png new file mode 100644 index 0000000000..fe52c661cb Binary files /dev/null and b/src/GitVersionTfsTask/icon.png differ diff --git a/src/GitVersionTfsTask/vss-extension.mono.json b/src/GitVersionTfsTask/manifest.json similarity index 78% rename from src/GitVersionTfsTask/vss-extension.mono.json rename to src/GitVersionTfsTask/manifest.json index 4175439009..719be4aecd 100644 --- a/src/GitVersionTfsTask/vss-extension.mono.json +++ b/src/GitVersionTfsTask/manifest.json @@ -7,17 +7,22 @@ "author": "GitVersion Contributors", "version": "$version$", "description": "Build task for easy semantic versioning for projects using Git.", - "targets": [{ - "id": "Microsoft.VisualStudio.Services" - }], + "targets": [ + { + "id": "Microsoft.VisualStudio.Services" + } + ], "files": [ - { "path": "GitVersionTask" } + { + "path": "GitVersionTask" + } ], "categories": [ "Build and release" ], - "icons": { - "default": "images/extension-icon.png" + "icons": + { + "default": "extension-icon.png" }, "tags": [ "semver", @@ -36,18 +41,16 @@ "license": { "uri": "https://github.com/GitTools/GitVersion/blob/master/LICENSE" }, - "repository": { - "uri": "https://github.com/GitTools/GitVersion" - }, "support": { "uri": "https://github.com/GitTools/GitVersion/issues" } }, - "screenshots": [{ - "path": "images/builds.png" + "screenshots": [ + { + "path": "img/builds.png" }, { - "path": "images/build-task.png" + "path": "img/build-task.png" } ], "content": { @@ -65,5 +68,6 @@ "properties": { "name": "GitVersionTask" } - }] + } + ] } diff --git a/src/GitVersionTfsTask/package-lock.json b/src/GitVersionTfsTask/package-lock.json deleted file mode 100644 index f39878a19a..0000000000 --- a/src/GitVersionTfsTask/package-lock.json +++ /dev/null @@ -1,1794 +0,0 @@ -{ - "name": "gitversion", - "version": "1.0.0", - "lockfileVersion": 1, - "requires": true, - "dependencies": { - "@types/argparse": { - "version": "1.0.35", - "resolved": "https://registry.npmjs.org/@types/argparse/-/argparse-1.0.35.tgz", - "integrity": "sha512-+4KNdOqes4Bq0fu5dQCTUVpNQl10ui1JWdXG6S6AvRqHM4K5K1/6SBJ0Qz7PT+K85AcJ0UC7ZDuTz+aL3n6tWw==", - "dev": true - }, - "@types/minimatch": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz", - "integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==", - "dev": true - }, - "@types/node": { - "version": "10.11.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.11.0.tgz", - "integrity": "sha512-R4Dvw6KjSYn/SpvjRchBOwXr14vVVcFXCtnM3f0aLvlJS8a599rrcEoihcP2/+Z/f75E5GNPd4aWM7j1yei9og==", - "dev": true - }, - "@types/q": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/@types/q/-/q-1.5.1.tgz", - "integrity": "sha512-eqz8c/0kwNi/OEHQfvIuJVLTst3in0e7uTKeuY+WL/zfKn0xVujOTp42bS/vUUokhK5P2BppLd9JXMOMHcgbjA==", - "dev": true - }, - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true - }, - "app-root-path": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/app-root-path/-/app-root-path-1.0.0.tgz", - "integrity": "sha1-LHKZF0vGHLhv46SnmOAeSTt9U30=", - "dev": true - }, - "arch": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/arch/-/arch-2.1.1.tgz", - "integrity": "sha512-BLM56aPo9vLLFVa8+/+pJLnrZ7QGGTVHWsCwieAWT9o9K8UeGaQbzZbGoabWLOo2ksBCztoXdqBZBplqLDDCSg==", - "dev": true - }, - "archiver": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/archiver/-/archiver-2.0.3.tgz", - "integrity": "sha1-tDYLtYSvFDeZGUJxbyHXxSPR270=", - "dev": true, - "requires": { - "archiver-utils": "^1.3.0", - "async": "^2.0.0", - "buffer-crc32": "^0.2.1", - "glob": "^7.0.0", - "lodash": "^4.8.0", - "readable-stream": "^2.0.0", - "tar-stream": "^1.5.0", - "walkdir": "^0.0.11", - "zip-stream": "^1.2.0" - }, - "dependencies": { - "async": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/async/-/async-2.6.1.tgz", - "integrity": "sha512-fNEiL2+AZt6AlAw/29Cr0UDe4sRAHCpEHh54WMz+Bb7QfNcFw4h3loofyJpLeQs4Yx7yuqu/2dLgM5hKOs6HlQ==", - "dev": true, - "requires": { - "lodash": "^4.17.10" - } - } - } - }, - "archiver-utils": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/archiver-utils/-/archiver-utils-1.3.0.tgz", - "integrity": "sha1-5QtMCccL89aA4y/xt5lOn52JUXQ=", - "dev": true, - "requires": { - "glob": "^7.0.0", - "graceful-fs": "^4.1.0", - "lazystream": "^1.0.0", - "lodash": "^4.8.0", - "normalize-path": "^2.0.0", - "readable-stream": "^2.0.0" - } - }, - "argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dev": true, - "requires": { - "sprintf-js": "~1.0.2" - } - }, - "array-find-index": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz", - "integrity": "sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E=", - "dev": true - }, - "arrify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", - "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", - "dev": true - }, - "async": { - "version": "1.5.2", - "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", - "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", - "dev": true - }, - "azure-pipelines-task-lib": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/azure-pipelines-task-lib/-/azure-pipelines-task-lib-2.7.1.tgz", - "integrity": "sha512-4kEB7is8jA6LerqBimzkYK5sH1Hwo+PZwF51kvS6wfJC8DZfaYQKGCD72aSan0N3MgKHP1HtEEsJn6raUY+Itw==", - "requires": { - "minimatch": "3.0.4", - "mockery": "^1.7.0", - "q": "^1.1.2", - "semver": "^5.1.0", - "shelljs": "^0.3.0", - "uuid": "^3.0.1" - } - }, - "balanced-match": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" - }, - "base64-js": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.0.tgz", - "integrity": "sha512-ccav/yGvoa80BQDljCxsmmQ3Xvx60/UpBIij5QN21W3wBi/hhIC9OoO+KLpu9IJTS9j4DRVJ3aDDF9cMSoa2lw==", - "dev": true - }, - "bl": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/bl/-/bl-1.2.2.tgz", - "integrity": "sha512-e8tQYnZodmebYDWGH7KMRvtzKXaJHx3BbilrgZCfvyLUYdKpK1t5PSPmpkny/SgiTSCnjfLW7v5rlONXVFkQEA==", - "dev": true, - "requires": { - "readable-stream": "^2.3.5", - "safe-buffer": "^5.1.1" - } - }, - "brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "requires": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.2.1.tgz", - "integrity": "sha512-c+Ko0loDaFfuPWiL02ls9Xd3GO3cPVmUobQ6t3rXNUk304u6hGq+8N/kFi+QEIKhzK3uwolVhLzszmfLmMLnqg==", - "dev": true, - "requires": { - "base64-js": "^1.0.2", - "ieee754": "^1.1.4" - } - }, - "buffer-alloc": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/buffer-alloc/-/buffer-alloc-1.2.0.tgz", - "integrity": "sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow==", - "dev": true, - "requires": { - "buffer-alloc-unsafe": "^1.1.0", - "buffer-fill": "^1.0.0" - } - }, - "buffer-alloc-unsafe": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz", - "integrity": "sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg==", - "dev": true - }, - "buffer-crc32": { - "version": "0.2.13", - "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", - "integrity": "sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI=", - "dev": true - }, - "buffer-fill": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/buffer-fill/-/buffer-fill-1.0.0.tgz", - "integrity": "sha1-+PeLdniYiO858gXNY39o5wISKyw=", - "dev": true - }, - "builtin-modules": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", - "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", - "dev": true - }, - "camelcase": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", - "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", - "dev": true - }, - "camelcase-keys": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-4.2.0.tgz", - "integrity": "sha1-oqpfsa9oh1glnDLBQUJteJI7m3c=", - "dev": true, - "requires": { - "camelcase": "^4.1.0", - "map-obj": "^2.0.0", - "quick-lru": "^1.0.0" - } - }, - "clipboardy": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/clipboardy/-/clipboardy-1.2.3.tgz", - "integrity": "sha512-2WNImOvCRe6r63Gk9pShfkwXsVtKCroMAevIbiae021mS850UkWPbevxsBz3tnvjZIEGvlwaqCPsw+4ulzNgJA==", - "dev": true, - "requires": { - "arch": "^2.1.0", - "execa": "^0.8.0" - } - }, - "cliui": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-4.1.0.tgz", - "integrity": "sha512-4FG+RSG9DL7uEwRUZXZn3SS34DiDPfzP0VOiEwtUWlE+AR2EIg+hSyvrIgUUfhdgR/UkAeW2QHgeP+hWrXs7jQ==", - "dev": true, - "requires": { - "string-width": "^2.1.1", - "strip-ansi": "^4.0.0", - "wrap-ansi": "^2.0.0" - } - }, - "code-point-at": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", - "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", - "dev": true - }, - "colors": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/colors/-/colors-1.3.2.tgz", - "integrity": "sha512-rhP0JSBGYvpcNQj4s5AdShMeE5ahMop96cTeDl/v9qQQm2fYClE2QXZRi8wLzc+GmXSxdIqqbOIAhyObEXDbfQ==", - "dev": true - }, - "compress-commons": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/compress-commons/-/compress-commons-1.2.2.tgz", - "integrity": "sha1-UkqfEJA/OoEzibAiXSfEi7dRiQ8=", - "dev": true, - "requires": { - "buffer-crc32": "^0.2.1", - "crc32-stream": "^2.0.0", - "normalize-path": "^2.0.0", - "readable-stream": "^2.0.0" - } - }, - "concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" - }, - "copy-node-modules": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/copy-node-modules/-/copy-node-modules-1.0.8.tgz", - "integrity": "sha512-s+Ps727ZZIQd1FzkgLfggxNLyymBGh62oDtq3f0Sj7jcm7/eEzfbKjGUGN//g3V2DlbLU5PIUsxX8Ag3o9gvqw==", - "dev": true, - "requires": { - "async": "^2.0.0-rc.4", - "graceful-fs": "^4.1.11", - "jsonfile": "^2.3.0", - "lodash.flatten": "^4.4.0", - "lodash.uniqwith": "^4.5.0", - "mkdirp": "^0.5.1", - "ncp": "^2.0.0", - "semver": "^5.1.0", - "yargs": "^11.0.0" - }, - "dependencies": { - "async": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/async/-/async-2.6.1.tgz", - "integrity": "sha512-fNEiL2+AZt6AlAw/29Cr0UDe4sRAHCpEHh54WMz+Bb7QfNcFw4h3loofyJpLeQs4Yx7yuqu/2dLgM5hKOs6HlQ==", - "dev": true, - "requires": { - "lodash": "^4.17.10" - } - }, - "ncp": { - "version": "2.0.0", - "resolved": "http://registry.npmjs.org/ncp/-/ncp-2.0.0.tgz", - "integrity": "sha1-GVoh1sRuNh0vsSgbo4uR6d9727M=", - "dev": true - } - } - }, - "core-js": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.3.0.tgz", - "integrity": "sha1-+rg/uwstjchfpjbEudNMdUIMbWU=", - "dev": true - }, - "core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", - "dev": true - }, - "crc": { - "version": "3.8.0", - "resolved": "https://registry.npmjs.org/crc/-/crc-3.8.0.tgz", - "integrity": "sha512-iX3mfgcTMIq3ZKLIsVFAbv7+Mc10kxabAGQb8HvjA1o3T1PIYprbakQ65d3I+2HGHt6nSKkM9PYjgoJO2KcFBQ==", - "dev": true, - "requires": { - "buffer": "^5.1.0" - } - }, - "crc32-stream": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/crc32-stream/-/crc32-stream-2.0.0.tgz", - "integrity": "sha1-483TtN8xaN10494/u8t7KX/pCPQ=", - "dev": true, - "requires": { - "crc": "^3.4.4", - "readable-stream": "^2.0.0" - } - }, - "cross-spawn": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", - "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", - "dev": true, - "requires": { - "lru-cache": "^4.0.1", - "shebang-command": "^1.2.0", - "which": "^1.2.9" - } - }, - "currently-unhandled": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/currently-unhandled/-/currently-unhandled-0.4.1.tgz", - "integrity": "sha1-mI3zP+qxke95mmE2nddsF635V+o=", - "dev": true, - "requires": { - "array-find-index": "^1.0.1" - } - }, - "cycle": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/cycle/-/cycle-1.0.3.tgz", - "integrity": "sha1-IegLK+hYD5i0aPN5QwZisEbDStI=", - "dev": true - }, - "dateformat": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-1.0.11.tgz", - "integrity": "sha1-8ny+56ASu/uC6gUVYtOXf2CT27E=", - "dev": true, - "requires": { - "get-stdin": "*", - "meow": "*" - } - }, - "decamelize": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", - "dev": true - }, - "decamelize-keys": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/decamelize-keys/-/decamelize-keys-1.1.0.tgz", - "integrity": "sha1-0XGoeTMlKAfrPLYdwcFEXQeN8tk=", - "dev": true, - "requires": { - "decamelize": "^1.1.0", - "map-obj": "^1.0.0" - }, - "dependencies": { - "map-obj": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", - "integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=", - "dev": true - } - } - }, - "deep-equal": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-1.0.1.tgz", - "integrity": "sha1-9dJgKStmDghO/0zbyfCK0yR0SLU=", - "dev": true - }, - "define-properties": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", - "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", - "dev": true, - "requires": { - "object-keys": "^1.0.12" - } - }, - "end-of-stream": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz", - "integrity": "sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q==", - "dev": true, - "requires": { - "once": "^1.4.0" - } - }, - "error-ex": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", - "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", - "dev": true, - "requires": { - "is-arrayish": "^0.2.1" - } - }, - "es-abstract": { - "version": "1.12.0", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.12.0.tgz", - "integrity": "sha512-C8Fx/0jFmV5IPoMOFPA9P9G5NtqW+4cOPit3MIuvR2t7Ag2K15EJTpxnHAYTzL+aYQJIESYeXZmDBfOBE1HcpA==", - "dev": true, - "requires": { - "es-to-primitive": "^1.1.1", - "function-bind": "^1.1.1", - "has": "^1.0.1", - "is-callable": "^1.1.3", - "is-regex": "^1.0.4" - } - }, - "es-to-primitive": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.0.tgz", - "integrity": "sha512-qZryBOJjV//LaxLTV6UC//WewneB3LcXOL9NP++ozKVXsIIIpm/2c13UDiD9Jp2eThsecw9m3jPqDwTyobcdbg==", - "dev": true, - "requires": { - "is-callable": "^1.1.4", - "is-date-object": "^1.0.1", - "is-symbol": "^1.0.2" - } - }, - "es6-promise": { - "version": "3.0.2", - "resolved": "http://registry.npmjs.org/es6-promise/-/es6-promise-3.0.2.tgz", - "integrity": "sha1-AQ1YWEI6XxGJeWZfRkhqlcbuK7Y=", - "dev": true - }, - "execa": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-0.8.0.tgz", - "integrity": "sha1-2NdrvBtVIX7RkP1t1J08d07PyNo=", - "dev": true, - "requires": { - "cross-spawn": "^5.0.1", - "get-stream": "^3.0.0", - "is-stream": "^1.1.0", - "npm-run-path": "^2.0.0", - "p-finally": "^1.0.0", - "signal-exit": "^3.0.0", - "strip-eof": "^1.0.0" - } - }, - "eyes": { - "version": "0.1.8", - "resolved": "https://registry.npmjs.org/eyes/-/eyes-0.1.8.tgz", - "integrity": "sha1-Ys8SAjTGg3hdkCNIqADvPgzCC8A=", - "dev": true - }, - "find-up": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", - "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", - "dev": true, - "requires": { - "locate-path": "^2.0.0" - } - }, - "fs-constants": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", - "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==", - "dev": true - }, - "fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", - "dev": true - }, - "function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", - "dev": true - }, - "get-caller-file": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz", - "integrity": "sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w==", - "dev": true - }, - "get-stdin": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-6.0.0.tgz", - "integrity": "sha512-jp4tHawyV7+fkkSKyvjuLZswblUtz+SQKzSWnBbii16BuZksJlU1wuBYXY75r+duh/llF1ur6oNwi+2ZzjKZ7g==", - "dev": true - }, - "get-stream": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", - "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", - "dev": true - }, - "glob": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", - "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "graceful-fs": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", - "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", - "dev": true - }, - "has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "dev": true, - "requires": { - "function-bind": "^1.1.1" - } - }, - "has-symbols": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.0.tgz", - "integrity": "sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q=", - "dev": true - }, - "hosted-git-info": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.7.1.tgz", - "integrity": "sha512-7T/BxH19zbcCTa8XkMlbK5lTo1WtgkFi3GvdWEyNuc4Vex7/9Dqbnpsf4JMydcfj9HCg4zUWFTL3Za6lapg5/w==", - "dev": true - }, - "i": { - "version": "0.3.6", - "resolved": "https://registry.npmjs.org/i/-/i-0.3.6.tgz", - "integrity": "sha1-2WyScyB28HJxG2sQ/X1PZa2O4j0=", - "dev": true - }, - "ieee754": { - "version": "1.1.12", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.12.tgz", - "integrity": "sha512-GguP+DRY+pJ3soyIiGPTvdiVXjZ+DbXOxGpXn3eMvNW4x4irjqXm4wHKscC+TfxSJ0yw/S1F24tqdMNsMZTiLA==", - "dev": true - }, - "immediate": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz", - "integrity": "sha1-nbHb0Pr43m++D13V5Wu2BigN5ps=", - "dev": true - }, - "indent-string": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-3.2.0.tgz", - "integrity": "sha1-Sl/W0nzDMvN+VBmlBNu4NxBckok=", - "dev": true - }, - "inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "dev": true, - "requires": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", - "dev": true - }, - "invert-kv": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", - "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=", - "dev": true - }, - "is-arrayish": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", - "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", - "dev": true - }, - "is-builtin-module": { - "version": "1.0.0", - "resolved": "http://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz", - "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=", - "dev": true, - "requires": { - "builtin-modules": "^1.0.0" - } - }, - "is-callable": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz", - "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==", - "dev": true - }, - "is-date-object": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz", - "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - }, - "is-plain-obj": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", - "integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4=", - "dev": true - }, - "is-regex": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz", - "integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=", - "dev": true, - "requires": { - "has": "^1.0.1" - } - }, - "is-stream": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", - "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", - "dev": true - }, - "is-symbol": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.2.tgz", - "integrity": "sha512-HS8bZ9ox60yCJLH9snBpIwv9pYUAkcuLhSA1oero1UB5y9aiQpRA8y2ex945AOtCZL1lJDeIk3G5LthswI46Lw==", - "dev": true, - "requires": { - "has-symbols": "^1.0.0" - } - }, - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true - }, - "isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", - "dev": true - }, - "isstream": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", - "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", - "dev": true - }, - "json-in-place": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json-in-place/-/json-in-place-1.0.1.tgz", - "integrity": "sha1-ih7NJaac4ZAFUs1xUr2TdU3k4fA=", - "dev": true, - "requires": { - "json-lexer": "1.1.1" - } - }, - "json-lexer": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/json-lexer/-/json-lexer-1.1.1.tgz", - "integrity": "sha1-vT7V1+Vgudma0iNPKMpwb7N3t9Q=", - "dev": true - }, - "json-parse-better-errors": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", - "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", - "dev": true - }, - "jsonfile": { - "version": "2.4.0", - "resolved": "http://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz", - "integrity": "sha1-NzaitCi4e72gzIO1P6PWM6NcKug=", - "dev": true, - "requires": { - "graceful-fs": "^4.1.6" - } - }, - "jszip": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/jszip/-/jszip-3.1.5.tgz", - "integrity": "sha512-5W8NUaFRFRqTOL7ZDDrx5qWHJyBXy6velVudIzQUSoqAAYqzSh2Z7/m0Rf1QbmQJccegD0r+YZxBjzqoBiEeJQ==", - "dev": true, - "requires": { - "core-js": "~2.3.0", - "es6-promise": "~3.0.2", - "lie": "~3.1.0", - "pako": "~1.0.2", - "readable-stream": "~2.0.6" - }, - "dependencies": { - "process-nextick-args": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", - "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=", - "dev": true - }, - "readable-stream": { - "version": "2.0.6", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.0.6.tgz", - "integrity": "sha1-j5A0HmilPMySh4jaz80Rs265t44=", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", - "isarray": "~1.0.0", - "process-nextick-args": "~1.0.6", - "string_decoder": "~0.10.x", - "util-deprecate": "~1.0.1" - } - }, - "string_decoder": { - "version": "0.10.31", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", - "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", - "dev": true - } - } - }, - "lazystream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/lazystream/-/lazystream-1.0.0.tgz", - "integrity": "sha1-9plf4PggOS9hOWvolGJAe7dxaOQ=", - "dev": true, - "requires": { - "readable-stream": "^2.0.5" - } - }, - "lcid": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", - "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", - "dev": true, - "requires": { - "invert-kv": "^1.0.0" - } - }, - "lie": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/lie/-/lie-3.1.1.tgz", - "integrity": "sha1-mkNrLMd0bKWd56QfpGmz77dr2H4=", - "dev": true, - "requires": { - "immediate": "~3.0.5" - } - }, - "load-json-file": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", - "integrity": "sha1-L19Fq5HjMhYjT9U62rZo607AmTs=", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "parse-json": "^4.0.0", - "pify": "^3.0.0", - "strip-bom": "^3.0.0" - } - }, - "locate-path": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", - "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", - "dev": true, - "requires": { - "p-locate": "^2.0.0", - "path-exists": "^3.0.0" - } - }, - "lodash": { - "version": "4.17.11", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", - "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", - "dev": true - }, - "lodash.flatten": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/lodash.flatten/-/lodash.flatten-4.4.0.tgz", - "integrity": "sha1-8xwiIlqWMtK7+OSt2+8kCqdlph8=", - "dev": true - }, - "lodash.uniqwith": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/lodash.uniqwith/-/lodash.uniqwith-4.5.0.tgz", - "integrity": "sha1-egy/ZfQ7WShiWp1NDcVLGMrcfvM=", - "dev": true - }, - "loud-rejection": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/loud-rejection/-/loud-rejection-1.6.0.tgz", - "integrity": "sha1-W0b4AUft7leIcPCG0Eghz5mOVR8=", - "dev": true, - "requires": { - "currently-unhandled": "^0.4.1", - "signal-exit": "^3.0.0" - } - }, - "lru-cache": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.3.tgz", - "integrity": "sha512-fFEhvcgzuIoJVUF8fYr5KR0YqxD238zgObTps31YdADwPPAp82a4M8TrckkWyx7ekNlf9aBcVn81cFwwXngrJA==", - "dev": true, - "requires": { - "pseudomap": "^1.0.2", - "yallist": "^2.1.2" - } - }, - "map-obj": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-2.0.0.tgz", - "integrity": "sha1-plzSkIepJZi4eRJXpSPgISIqwfk=", - "dev": true - }, - "mem": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/mem/-/mem-1.1.0.tgz", - "integrity": "sha1-Xt1StIXKHZAP5kiVUFOZoN+kX3Y=", - "dev": true, - "requires": { - "mimic-fn": "^1.0.0" - } - }, - "meow": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/meow/-/meow-5.0.0.tgz", - "integrity": "sha512-CbTqYU17ABaLefO8vCU153ZZlprKYWDljcndKKDCFcYQITzWCXZAVk4QMFZPgvzrnUQ3uItnIE/LoUOwrT15Ig==", - "dev": true, - "requires": { - "camelcase-keys": "^4.0.0", - "decamelize-keys": "^1.0.0", - "loud-rejection": "^1.0.0", - "minimist-options": "^3.0.1", - "normalize-package-data": "^2.3.4", - "read-pkg-up": "^3.0.0", - "redent": "^2.0.0", - "trim-newlines": "^2.0.0", - "yargs-parser": "^10.0.0" - } - }, - "mimic-fn": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", - "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==", - "dev": true - }, - "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "minimist": { - "version": "1.2.0", - "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", - "dev": true - }, - "minimist-options": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/minimist-options/-/minimist-options-3.0.2.tgz", - "integrity": "sha512-FyBrT/d0d4+uiZRbqznPXqw3IpZZG3gl3wKWiX784FycUKVwBt0uLBFkQrtE4tZOrgo78nZp2jnKz3L65T5LdQ==", - "dev": true, - "requires": { - "arrify": "^1.0.1", - "is-plain-obj": "^1.1.0" - } - }, - "mkdirp": { - "version": "0.5.1", - "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", - "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", - "dev": true, - "requires": { - "minimist": "0.0.8" - }, - "dependencies": { - "minimist": { - "version": "0.0.8", - "resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", - "dev": true - } - } - }, - "mockery": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/mockery/-/mockery-1.7.0.tgz", - "integrity": "sha1-9O3g2HUMHJcnwnLqLGBiniyaHE8=" - }, - "mute-stream": { - "version": "0.0.7", - "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz", - "integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=", - "dev": true - }, - "ncp": { - "version": "0.4.2", - "resolved": "http://registry.npmjs.org/ncp/-/ncp-0.4.2.tgz", - "integrity": "sha1-q8xsvT7C7Spyn/bnwfqPAXhKhXQ=", - "dev": true - }, - "normalize-package-data": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz", - "integrity": "sha512-9jjUFbTPfEy3R/ad/2oNbKtW9Hgovl5O1FvFWKkKblNXoN/Oou6+9+KKohPK13Yc3/TyunyWhJp6gvRNR/PPAw==", - "dev": true, - "requires": { - "hosted-git-info": "^2.1.4", - "is-builtin-module": "^1.0.0", - "semver": "2 || 3 || 4 || 5", - "validate-npm-package-license": "^3.0.1" - } - }, - "normalize-path": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", - "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", - "dev": true, - "requires": { - "remove-trailing-separator": "^1.0.1" - } - }, - "npm-run-path": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", - "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", - "dev": true, - "requires": { - "path-key": "^2.0.0" - } - }, - "number-is-nan": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", - "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", - "dev": true - }, - "object-keys": { - "version": "1.0.12", - "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.0.12.tgz", - "integrity": "sha512-FTMyFUm2wBcGHnH2eXmz7tC6IwlqQZ6mVZ+6dm6vZ4IQIHjs6FdNsQBuKGPuUUUY6NfJw2PshC08Tn6LzLDOag==", - "dev": true - }, - "object.getownpropertydescriptors": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz", - "integrity": "sha1-h1jIRvW0B62rDyNuCYbxSwUcqhY=", - "dev": true, - "requires": { - "define-properties": "^1.1.2", - "es-abstract": "^1.5.1" - } - }, - "once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "dev": true, - "requires": { - "wrappy": "1" - } - }, - "onecolor": { - "version": "2.5.0", - "resolved": "http://registry.npmjs.org/onecolor/-/onecolor-2.5.0.tgz", - "integrity": "sha1-Ila2UdyAfBAfAK7b1JklxXpEMcE=", - "dev": true - }, - "os-homedir": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", - "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", - "dev": true - }, - "os-locale": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-2.1.0.tgz", - "integrity": "sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA==", - "dev": true, - "requires": { - "execa": "^0.7.0", - "lcid": "^1.0.0", - "mem": "^1.1.0" - }, - "dependencies": { - "execa": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz", - "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", - "dev": true, - "requires": { - "cross-spawn": "^5.0.1", - "get-stream": "^3.0.0", - "is-stream": "^1.1.0", - "npm-run-path": "^2.0.0", - "p-finally": "^1.0.0", - "signal-exit": "^3.0.0", - "strip-eof": "^1.0.0" - } - } - } - }, - "os-tmpdir": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", - "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", - "dev": true - }, - "p-finally": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", - "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", - "dev": true - }, - "p-limit": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", - "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", - "dev": true, - "requires": { - "p-try": "^1.0.0" - } - }, - "p-locate": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", - "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", - "dev": true, - "requires": { - "p-limit": "^1.1.0" - } - }, - "p-try": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", - "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", - "dev": true - }, - "pako": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.6.tgz", - "integrity": "sha512-lQe48YPsMJAig+yngZ87Lus+NF+3mtu7DVOBu6b/gHO1YpKwIj5AWjZ/TOS7i46HD/UixzWb1zeWDZfGZ3iYcg==", - "dev": true - }, - "parse-json": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", - "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", - "dev": true, - "requires": { - "error-ex": "^1.3.1", - "json-parse-better-errors": "^1.0.1" - } - }, - "path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", - "dev": true - }, - "path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", - "dev": true - }, - "path-key": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", - "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", - "dev": true - }, - "path-type": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz", - "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", - "dev": true, - "requires": { - "pify": "^3.0.0" - } - }, - "pify": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", - "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", - "dev": true - }, - "pkginfo": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/pkginfo/-/pkginfo-0.4.1.tgz", - "integrity": "sha1-tUGO8EOd5UJfxJlQQtztFPsqhP8=", - "dev": true - }, - "process-nextick-args": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", - "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", - "dev": true - }, - "prompt": { - "version": "0.2.14", - "resolved": "https://registry.npmjs.org/prompt/-/prompt-0.2.14.tgz", - "integrity": "sha1-V3VPZPVD/XsIRXB8gY7OYY8F/9w=", - "dev": true, - "requires": { - "pkginfo": "0.x.x", - "read": "1.0.x", - "revalidator": "0.1.x", - "utile": "0.2.x", - "winston": "0.8.x" - } - }, - "pseudomap": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", - "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", - "dev": true - }, - "q": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/q/-/q-1.5.1.tgz", - "integrity": "sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc=" - }, - "quick-lru": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-1.1.0.tgz", - "integrity": "sha1-Q2CxfGETatOAeDl/8RQW4Ybc+7g=", - "dev": true - }, - "read": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/read/-/read-1.0.7.tgz", - "integrity": "sha1-s9oZvQUkMal2cdRKQmNK33ELQMQ=", - "dev": true, - "requires": { - "mute-stream": "~0.0.4" - } - }, - "read-pkg": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz", - "integrity": "sha1-nLxoaXj+5l0WwA4rGcI3/Pbjg4k=", - "dev": true, - "requires": { - "load-json-file": "^4.0.0", - "normalize-package-data": "^2.3.2", - "path-type": "^3.0.0" - } - }, - "read-pkg-up": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-3.0.0.tgz", - "integrity": "sha1-PtSWaF26D4/hGNBpHcUfSh/5bwc=", - "dev": true, - "requires": { - "find-up": "^2.0.0", - "read-pkg": "^3.0.0" - } - }, - "readable-stream": { - "version": "2.3.6", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", - "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "redent": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/redent/-/redent-2.0.0.tgz", - "integrity": "sha1-wbIAe0LVfrE4kHmzyDM2OdXhzKo=", - "dev": true, - "requires": { - "indent-string": "^3.0.0", - "strip-indent": "^2.0.0" - } - }, - "remove-trailing-separator": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", - "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=", - "dev": true - }, - "require-directory": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", - "dev": true - }, - "require-main-filename": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz", - "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=", - "dev": true - }, - "revalidator": { - "version": "0.1.8", - "resolved": "https://registry.npmjs.org/revalidator/-/revalidator-0.1.8.tgz", - "integrity": "sha1-/s5hv6DBtSoga9axgZgYS91SOjs=", - "dev": true - }, - "rimraf": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", - "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", - "dev": true, - "requires": { - "glob": "^7.0.5" - } - }, - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true - }, - "sax": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", - "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==", - "dev": true - }, - "semver": { - "version": "5.5.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.1.tgz", - "integrity": "sha512-PqpAxfrEhlSUWge8dwIp4tZnQ25DIOthpiaHNIthsjEFQD6EvqUKUDM7L8O2rShkFccYo1VjJR0coWfNkCubRw==" - }, - "set-blocking": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", - "dev": true - }, - "shebang-command": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", - "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", - "dev": true, - "requires": { - "shebang-regex": "^1.0.0" - } - }, - "shebang-regex": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", - "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", - "dev": true - }, - "shelljs": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.3.0.tgz", - "integrity": "sha1-NZbmMHp4FUT1kfN9phg2DzHbV7E=" - }, - "signal-exit": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", - "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", - "dev": true - }, - "spdx-correct": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.0.1.tgz", - "integrity": "sha512-hxSPZbRZvSDuOvADntOElzJpenIR7wXJkuoUcUtS0erbgt2fgeaoPIYretfKpslMhfFDY4k0MZ2F5CUzhBsSvQ==", - "dev": true, - "requires": { - "spdx-expression-parse": "^3.0.0", - "spdx-license-ids": "^3.0.0" - } - }, - "spdx-exceptions": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.1.0.tgz", - "integrity": "sha512-4K1NsmrlCU1JJgUrtgEeTVyfx8VaYea9J9LvARxhbHtVtohPs/gFGG5yy49beySjlIMhhXZ4QqujIZEfS4l6Cg==", - "dev": true - }, - "spdx-expression-parse": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz", - "integrity": "sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg==", - "dev": true, - "requires": { - "spdx-exceptions": "^2.1.0", - "spdx-license-ids": "^3.0.0" - } - }, - "spdx-license-ids": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.1.tgz", - "integrity": "sha512-TfOfPcYGBB5sDuPn3deByxPhmfegAhpDYKSOXZQN81Oyrrif8ZCodOLzK3AesELnCx03kikhyDwh0pfvvQvF8w==", - "dev": true - }, - "sprintf-js": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", - "dev": true - }, - "stack-trace": { - "version": "0.0.10", - "resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz", - "integrity": "sha1-VHxws0fo0ytOEI6hoqFZ5f3eGcA=", - "dev": true - }, - "string-width": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", - "dev": true, - "requires": { - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" - } - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, - "requires": { - "ansi-regex": "^3.0.0" - } - }, - "strip-bom": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", - "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", - "dev": true - }, - "strip-eof": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", - "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", - "dev": true - }, - "strip-indent": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-2.0.0.tgz", - "integrity": "sha1-XvjbKV0B5u1sv3qrlpmNeCJSe2g=", - "dev": true - }, - "tar-stream": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-1.6.2.tgz", - "integrity": "sha512-rzS0heiNf8Xn7/mpdSVVSMAWAoy9bfb1WOTYC78Z0UQKeKa/CWS8FOq0lKGNa8DWKAn9gxjCvMLYc5PGXYlK2A==", - "dev": true, - "requires": { - "bl": "^1.0.0", - "buffer-alloc": "^1.2.0", - "end-of-stream": "^1.0.0", - "fs-constants": "^1.0.0", - "readable-stream": "^2.3.0", - "to-buffer": "^1.1.1", - "xtend": "^4.0.0" - } - }, - "tfx-cli": { - "version": "0.6.3", - "resolved": "https://registry.npmjs.org/tfx-cli/-/tfx-cli-0.6.3.tgz", - "integrity": "sha512-58sLayoikjA2jXrnv9pYsbkkLEwaips9qS6r+sPulVUywiom5PFnaNVRkD7bPSBIxZt1nwa/NbITVTZIzLvtRw==", - "dev": true, - "requires": { - "app-root-path": "1.0.0", - "archiver": "2.0.3", - "async": "^1.4.0", - "clipboardy": "~1.2.3", - "colors": "~1.3.0", - "glob": "7.1.2", - "json-in-place": "^1.0.1", - "jszip": "~3.1.5", - "lodash": "~4.17.0", - "minimist": "^1.1.2", - "mkdirp": "^0.5.1", - "onecolor": "^2.5.0", - "os-homedir": "^1.0.1", - "prompt": "^0.2.14", - "read": "^1.0.6", - "shelljs": "^0.5.1", - "tmp": "0.0.26", - "tracer": "0.7.4", - "util.promisify": "^1.0.0", - "uuid": "^3.0.1", - "validator": "^3.43.0", - "vso-node-api": "^5.0.0", - "winreg": "0.0.12", - "xml2js": "^0.4.16" - }, - "dependencies": { - "shelljs": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.5.3.tgz", - "integrity": "sha1-xUmCuZbHbvDB5rWfvcWCX1txMRM=", - "dev": true - } - } - }, - "tinytim": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/tinytim/-/tinytim-0.1.1.tgz", - "integrity": "sha1-yWih5VWa2VUyJO92J7qzTjyu+Kg=", - "dev": true - }, - "tmp": { - "version": "0.0.26", - "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.26.tgz", - "integrity": "sha1-nvqCDOKhD4H4l5VVus4/FVJs4fI=", - "dev": true, - "requires": { - "os-tmpdir": "~1.0.0" - } - }, - "to-buffer": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/to-buffer/-/to-buffer-1.1.1.tgz", - "integrity": "sha512-lx9B5iv7msuFYE3dytT+KE5tap+rNYw+K4jVkb9R/asAb+pbBSM17jtunHplhBe6RRJdZx3Pn2Jph24O32mOVg==", - "dev": true - }, - "tracer": { - "version": "0.7.4", - "resolved": "https://registry.npmjs.org/tracer/-/tracer-0.7.4.tgz", - "integrity": "sha1-d/oEN8+Ct2vNvNRLhHRHcuWeUlk=", - "dev": true, - "requires": { - "colors": "1.0.3", - "dateformat": "1.0.11", - "tinytim": "0.1.1" - }, - "dependencies": { - "colors": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/colors/-/colors-1.0.3.tgz", - "integrity": "sha1-BDP0TYCWgP3rYO0mDxsMJi6CpAs=", - "dev": true - } - } - }, - "trim-newlines": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-2.0.0.tgz", - "integrity": "sha1-tAPQuRvlDDMd/EuC7s6yLD3hbSA=", - "dev": true - }, - "tunnel": { - "version": "0.0.4", - "resolved": "http://registry.npmjs.org/tunnel/-/tunnel-0.0.4.tgz", - "integrity": "sha1-LTeFoVjBdMmhbcLARuxfxfF0IhM=", - "dev": true - }, - "typescript": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.0.3.tgz", - "integrity": "sha512-kk80vLW9iGtjMnIv11qyxLqZm20UklzuR2tL0QAnDIygIUIemcZMxlMWudl9OOt76H3ntVzcTiddQ1/pAAJMYg==", - "dev": true - }, - "underscore": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.9.1.tgz", - "integrity": "sha512-5/4etnCkd9c8gwgowi5/om/mYO5ajCaOgdzj/oW+0eQV9WxKBDZw5+ycmKmeaTXjInS/W0BzpGLo2xR2aBwZdg==", - "dev": true - }, - "util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", - "dev": true - }, - "util.promisify": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/util.promisify/-/util.promisify-1.0.0.tgz", - "integrity": "sha512-i+6qA2MPhvoKLuxnJNpXAGhg7HphQOSUq2LKMZD0m15EiskXUkMvKdF4Uui0WYeCUGea+o2cw/ZuwehtfsrNkA==", - "dev": true, - "requires": { - "define-properties": "^1.1.2", - "object.getownpropertydescriptors": "^2.0.3" - } - }, - "utile": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/utile/-/utile-0.2.1.tgz", - "integrity": "sha1-kwyI6ZCY1iIINMNWy9mncFItkNc=", - "dev": true, - "requires": { - "async": "~0.2.9", - "deep-equal": "*", - "i": "0.3.x", - "mkdirp": "0.x.x", - "ncp": "0.4.x", - "rimraf": "2.x.x" - }, - "dependencies": { - "async": { - "version": "0.2.10", - "resolved": "https://registry.npmjs.org/async/-/async-0.2.10.tgz", - "integrity": "sha1-trvgsGdLnXGXCMo43owjfLUmw9E=", - "dev": true - } - } - }, - "uuid": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", - "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==" - }, - "validate-npm-package-license": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", - "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", - "dev": true, - "requires": { - "spdx-correct": "^3.0.0", - "spdx-expression-parse": "^3.0.0" - } - }, - "validator": { - "version": "3.43.0", - "resolved": "http://registry.npmjs.org/validator/-/validator-3.43.0.tgz", - "integrity": "sha1-lkZLmS1BloM9l6GUv0Cxn/VLrgU=", - "dev": true - }, - "vso-node-api": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/vso-node-api/-/vso-node-api-5.1.2.tgz", - "integrity": "sha1-gXtm/+1uEcvXH5O5FvSxicljQls=", - "dev": true, - "requires": { - "q": "^1.0.1", - "tunnel": "0.0.4", - "underscore": "^1.8.3" - } - }, - "walkdir": { - "version": "0.0.11", - "resolved": "https://registry.npmjs.org/walkdir/-/walkdir-0.0.11.tgz", - "integrity": "sha1-oW0CXrkxvQO1LzCMrtD0D86+lTI=", - "dev": true - }, - "which": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", - "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", - "dev": true, - "requires": { - "isexe": "^2.0.0" - } - }, - "which-module": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", - "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", - "dev": true - }, - "winreg": { - "version": "0.0.12", - "resolved": "https://registry.npmjs.org/winreg/-/winreg-0.0.12.tgz", - "integrity": "sha1-BxBVVLoanQiXklHRKUdb/64wBrc=", - "dev": true - }, - "winston": { - "version": "0.8.3", - "resolved": "http://registry.npmjs.org/winston/-/winston-0.8.3.tgz", - "integrity": "sha1-ZLar9M0Brcrv1QCTk7HY6L7BnbA=", - "dev": true, - "requires": { - "async": "0.2.x", - "colors": "0.6.x", - "cycle": "1.0.x", - "eyes": "0.1.x", - "isstream": "0.1.x", - "pkginfo": "0.3.x", - "stack-trace": "0.0.x" - }, - "dependencies": { - "async": { - "version": "0.2.10", - "resolved": "https://registry.npmjs.org/async/-/async-0.2.10.tgz", - "integrity": "sha1-trvgsGdLnXGXCMo43owjfLUmw9E=", - "dev": true - }, - "colors": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/colors/-/colors-0.6.2.tgz", - "integrity": "sha1-JCP+ZnisDF2uiFLl0OW+CMmXq8w=", - "dev": true - }, - "pkginfo": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/pkginfo/-/pkginfo-0.3.1.tgz", - "integrity": "sha1-Wyn2qB9wcXFC4J52W76rl7T4HiE=", - "dev": true - } - } - }, - "wrap-ansi": { - "version": "2.1.0", - "resolved": "http://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", - "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", - "dev": true, - "requires": { - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1" - }, - "dependencies": { - "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", - "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", - "dev": true, - "requires": { - "number-is-nan": "^1.0.0" - } - }, - "string-width": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", - "dev": true, - "requires": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" - } - }, - "strip-ansi": { - "version": "3.0.1", - "resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "dev": true, - "requires": { - "ansi-regex": "^2.0.0" - } - } - } - }, - "wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true - }, - "xml2js": { - "version": "0.4.19", - "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.19.tgz", - "integrity": "sha512-esZnJZJOiJR9wWKMyuvSE1y6Dq5LCuJanqhxslH2bxM6duahNZ+HMpCLhBQGZkbX6xRf8x1Y2eJlgt2q3qo49Q==", - "dev": true, - "requires": { - "sax": ">=0.6.0", - "xmlbuilder": "~9.0.1" - } - }, - "xmlbuilder": { - "version": "9.0.7", - "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz", - "integrity": "sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0=", - "dev": true - }, - "xtend": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", - "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=", - "dev": true - }, - "y18n": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz", - "integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=", - "dev": true - }, - "yallist": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", - "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", - "dev": true - }, - "yargs": { - "version": "11.1.0", - "resolved": "http://registry.npmjs.org/yargs/-/yargs-11.1.0.tgz", - "integrity": "sha512-NwW69J42EsCSanF8kyn5upxvjp5ds+t3+udGBeTbFnERA+lF541DDpMawzo4z6W/QrzNM18D+BPMiOBibnFV5A==", - "dev": true, - "requires": { - "cliui": "^4.0.0", - "decamelize": "^1.1.1", - "find-up": "^2.1.0", - "get-caller-file": "^1.0.1", - "os-locale": "^2.0.0", - "require-directory": "^2.1.1", - "require-main-filename": "^1.0.1", - "set-blocking": "^2.0.0", - "string-width": "^2.0.0", - "which-module": "^2.0.0", - "y18n": "^3.2.1", - "yargs-parser": "^9.0.2" - }, - "dependencies": { - "yargs-parser": { - "version": "9.0.2", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-9.0.2.tgz", - "integrity": "sha1-nM9qQ0YP5O1Aqbto9I1DuKaMwHc=", - "dev": true, - "requires": { - "camelcase": "^4.1.0" - } - } - } - }, - "yargs-parser": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-10.1.0.tgz", - "integrity": "sha512-VCIyR1wJoEBZUqk5PA+oOBF6ypbwh5aNB3I50guxAL/quggdfs4TtNHQrSazFA3fYZ+tEqfs0zIGlv0c/rgjbQ==", - "dev": true, - "requires": { - "camelcase": "^4.1.0" - } - }, - "zip-stream": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/zip-stream/-/zip-stream-1.2.0.tgz", - "integrity": "sha1-qLxF9MG0lpnGuQGYuqyqzbzUugQ=", - "dev": true, - "requires": { - "archiver-utils": "^1.3.0", - "compress-commons": "^1.2.0", - "lodash": "^4.8.0", - "readable-stream": "^2.0.0" - } - } - } -} diff --git a/src/GitVersionTfsTask/package.json b/src/GitVersionTfsTask/package.json index 031bafe1f5..7112dbaa55 100644 --- a/src/GitVersionTfsTask/package.json +++ b/src/GitVersionTfsTask/package.json @@ -1,30 +1,22 @@ { - "name": "gitversion", - "version": "1.0.0", - "private": true, - "description": "", - "main": "index.js", - "scripts": { - "build": "npm run build:mono && npm run build:netcore", - "build:mono": "tsc -p ./tsconfig.mono.json && copy-node-modules . GitVersionTask", - "build:netcore": "tsc -p ./tsconfig.netcore.json && copy-node-modules . GitVersionNetCoreTask", - "test": "echo \"Error: no test specified\" && exit 1", - "package": "tfx extension create --manifest-globs vss-extension.json" - }, - "author": "", - "license": "MIT", - "dependencies": { - "q": "1.5.1", - "azure-pipelines-task-lib": "2.7.1" - }, - "devDependencies": { - "@types/argparse": "^1.0.35", - "@types/minimatch": "3.0.3", - "@types/node": "10.11.0", - "@types/q": "1.5.1", - "argparse": "^1.0.10", - "copy-node-modules": "^1.0.8", - "tfx-cli": "^0.6.1", - "typescript": "^3.0.3" - } + "name": "gitversion", + "version": "1.0.0", + "private": true, + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "MIT", + "dependencies": { + "vsts-task-lib": "1.1.0", + "q": "1.4.1" + }, + "devDependencies": { + "@types/minimatch": "^2.0.29", + "@types/node": "^7.0.5", + "@types/q": "0.0.32", + "typescript": "^2.3.2" + } } diff --git a/src/GitVersionTfsTask/GitVersionTask/task.json b/src/GitVersionTfsTask/task.json similarity index 78% rename from src/GitVersionTfsTask/GitVersionTask/task.json rename to src/GitVersionTfsTask/task.json index 03920e6a1f..58f8c6b6b4 100644 --- a/src/GitVersionTfsTask/GitVersionTask/task.json +++ b/src/GitVersionTfsTask/task.json @@ -6,20 +6,23 @@ "author": "GitVersion Contributors", "helpMarkDown": "See the [documentation](http://gitversion.readthedocs.org/en/latest/) for help", "category": "Build", - "demands": [], + "demands": [ ], "version": { - "Major": "4", + "Major": "0", "Minor": "0", "Patch": "0" }, "minimumAgentVersion": "1.83.0", - "groups": [{ - "name": "additional", - "displayName": "Additional Options", - "isExpanded": false - }], + "groups": [ + { + "name": "additional", + "displayName": "Additional Options", + "isExpanded": false + } + ], "instanceNameFormat": "GitVersion", - "inputs": [{ + "inputs": [ + { "name": "updateAssemblyInfo", "type": "boolean", "label": "Update AssemblyInfo files", @@ -54,29 +57,20 @@ "helpMarkDown": "Optionally supply the path to GitVersion.exe", "groupName": "additional" }, - { - "name": "targetPath", - "type": "string", - "label": "Working directory path", - "defaultValue": "", - "required": false, - "helpMarkDown": "Optionally supply the path to the working directory", - "groupName": "additional" - }, { "name": "preferBundledVersion", "type": "boolean", - "label": "Prefer bundled GitVersion.exe", + "label": "Prefer bundled GiVersion.exe", "required": false, "helpMarkDown": "If checked it will prefer the bundled version over a version found in path", "groupName": "additional" } ], "execution": { - "Node": { + "Node": { "target": "GitVersion.js", "argumentFormat": "", - "workingDirectory": "." + "workingDirectory": "" } } -} \ No newline at end of file +} diff --git a/src/GitVersionTfsTask/tsconfig.base.json b/src/GitVersionTfsTask/tsconfig.json similarity index 99% rename from src/GitVersionTfsTask/tsconfig.base.json rename to src/GitVersionTfsTask/tsconfig.json index 6f2d9f401d..a4410d2e46 100644 --- a/src/GitVersionTfsTask/tsconfig.base.json +++ b/src/GitVersionTfsTask/tsconfig.json @@ -10,4 +10,4 @@ "inlineSourceMap": true, "declaration": false } -} +} \ No newline at end of file diff --git a/src/GitVersionTfsTask/tsconfig.mono.json b/src/GitVersionTfsTask/tsconfig.mono.json deleted file mode 100644 index 471bca19e2..0000000000 --- a/src/GitVersionTfsTask/tsconfig.mono.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": "./tsconfig.base.json", - "compilerOptions": { - "outDir": "GitVersionTask" - } -} diff --git a/src/GitVersionTfsTask/tsconfig.netcore.json b/src/GitVersionTfsTask/tsconfig.netcore.json deleted file mode 100644 index b8fe627721..0000000000 --- a/src/GitVersionTfsTask/tsconfig.netcore.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": "./tsconfig.base.json", - "compilerOptions": { - "outDir": "GitVersionNetCoreTask" - } -} diff --git a/src/GitVersionTfsTask/vss-extension.netcore.json b/src/GitVersionTfsTask/vss-extension.netcore.json deleted file mode 100644 index 1132aabfc4..0000000000 --- a/src/GitVersionTfsTask/vss-extension.netcore.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "manifestVersion": 1, - "id": "gitversion-netcore", - "name": "GitVersion (.NET Core)", - "publisher": "gittools", - "public": true, - "author": "GitVersion Contributors", - "version": "$version$", - "description": "Build task for easy semantic versioning for projects using Git.", - "targets": [{ - "id": "Microsoft.VisualStudio.Services" - }], - "files": [ - { "path": "GitVersionNetCoreTask" } - ], - "categories": [ - "Build and release" - ], - "icons": { - "default": "images/extension-icon.png" - }, - "tags": [ - "semver", - "git", - "versioning", - "gitflow", - "githubflow" - ], - "links": { - "learn": { - "uri": "http://gitversion.readthedocs.org/en/stable" - }, - "getstarted": { - "uri": "http://gitversion.readthedocs.org/en/stable/build-server-support/build-server/tfs-build-vnext/#running-inside-tfs" - }, - "license": { - "uri": "https://github.com/GitTools/GitVersion/blob/master/LICENSE" - }, - "repository": { - "uri": "https://github.com/GitTools/GitVersion" - }, - "support": { - "uri": "https://github.com/GitTools/GitVersion/issues" - } - }, - "screenshots": [{ - "path": "images/builds.png" - }, - { - "path": "images/build-task.png" - } - ], - "content": { - "details": { - "path": "overview.md" - } - }, - "contributions": [ - { - "id": "gitversion-netcore-task", - "type": "ms.vss-distributed-task.task", - "targets": [ - "ms.vss-distributed-task.tasks" - ], - "properties": { - "name": "GitVersionNetCoreTask" - } - }] -} diff --git a/src/NuGet.Config b/src/NuGet.Config deleted file mode 100644 index 3f0e003403..0000000000 --- a/src/NuGet.Config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/src/global.json b/src/global.json deleted file mode 100644 index 598fc17363..0000000000 --- a/src/global.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "sdk": { - "version": "2.1.503" - } -} \ No newline at end of file diff --git a/tools/packages.config b/tools/packages.config new file mode 100644 index 0000000000..4bc41f6930 --- /dev/null +++ b/tools/packages.config @@ -0,0 +1,5 @@ + + + + +