This repository has been archived by the owner on Jul 27, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 49
Initial use of GitVersion #226
Merged
Merged
Changes from 1 commit
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
aa54405
Initial use of GitVersion
CharliePoole 975875c
Extract PR number
CharliePoole b486c27
Add branch name to ci builds
CharliePoole 10abbd8
Fix errors and refactor so properties are all set in constructor
CharliePoole d261fec
Use GitVer version for packaging locally and on Travis
CharliePoole 87bb6ca
Use GitVer version for packaging on AppVeyor
CharliePoole a0ef16a
Exclude pdb files from zip for now
CharliePoole d9606c0
Update CommonAssemblyInfo for CI builds
CharliePoole e08bac4
Remove Debugging info from script
CharliePoole c3e8757
Merge branch 'master' into issue-206
CharliePoole 68781f8
Ignore files in .vscode dir
CharliePoole 924e2f5
Merge branch 'issue-206' of https://github.com/CharliePoole/nunit-gui…
CharliePoole 62a1cfd
Fix build.sh arguments
CharliePoole File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,8 @@ | |
#tool nuget:?package=GitVersion.CommandLine | ||
#addin "Cake.Incubator" | ||
|
||
using System.Text.RegularExpressions; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The regex is back for parsing whether it is a PR or not, so we should keep this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Exactly. |
||
|
||
////////////////////////////////////////////////////////////////////// | ||
// ARGUMENTS | ||
////////////////////////////////////////////////////////////////////// | ||
|
@@ -233,30 +235,56 @@ Task("PackageChocolatey") | |
|
||
class BuildInfo | ||
{ | ||
private GitVersion _gitVersion; | ||
|
||
public BuildInfo(GitVersion gitVersion) | ||
{ | ||
BranchName = gitVersion.BranchName; | ||
PreReleaseLabel = gitVersion.PreReleaseLabel; | ||
AssemblyVersion = gitVersion.AssemblySemVer; | ||
AssemblyFileVersion = PackageVersion = | ||
gitVersion.MajorMinorPatch + "-" + PreReleaseLabel + "-" + gitVersion.CommitsSinceVersionSourcePadded; | ||
_gitVersion = gitVersion; | ||
} | ||
|
||
public string BranchName | ||
{ | ||
get { return _gitVersion.BranchName; } | ||
} | ||
|
||
public string AssemblyVersion | ||
{ | ||
get { return _gitVersion.AssemblySemVer; } | ||
} | ||
public string AssemblyFileVersion | ||
{ | ||
get { return PackageVersion; } | ||
} | ||
|
||
public string BranchName { get; set; } | ||
public string PreReleaseLabel | ||
{ | ||
get { return _gitVersion.PreReleaseLabel; } | ||
} | ||
|
||
public string PackageVersion | ||
{ | ||
get { return _gitVersion.MajorMinorPatch + "-" + PreReleaseLabel + "-" + _gitVersion.PreReleaseNumber.PadLeft(4, '0'); } | ||
} | ||
|
||
public string AssemblyVersion { get; set; } | ||
public string AssemblyFileVersion { get; set; } | ||
public bool IsPullRequest | ||
{ | ||
// Requires correct setup of GitVersion.yml | ||
get { return PreReleaseLabel == "pr"; } | ||
} | ||
|
||
public string PreReleaseLabel { get; set; } | ||
public string PackageVersion { get; set; } | ||
public string PullRequestNumber | ||
{ | ||
get { return IsPullRequest ? _gitVersion.PreReleaseNumber : string.Empty; } | ||
} | ||
|
||
public string Dump() | ||
{ | ||
var NL = Environment.NewLine; | ||
return " BranchName: " + BranchName + NL + | ||
" IsPullRequest: " + IsPullRequest.ToString() + NL + | ||
" PullRequestNumber: " + PullRequestNumber + NL + | ||
" AssemblyVersion: " + AssemblyVersion + NL + | ||
" AssemblyFileVersion: " + AssemblyFileVersion + NL + | ||
" PreReleaseLabel: " + PreReleaseLabel + NL + | ||
" Package Version: " + PackageVersion + NL; | ||
} | ||
} | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this necessary ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had a regular expression at one point but it's gone now.