7
7
#tool dotnet: ? package = GitReleaseManager . Tool & version = 0.15 .0
8
8
#tool dotnet: ? package = XamlStyler . Console & version = 3.2404 .2
9
9
#tool nuget: ? package = GitVersion . CommandLine & version = 5.12 .0
10
- #tool nuget: ? package = NUnit . ConsoleRunner & version = 3.18 .3
11
-
12
- #addin nuget: ? package = Cake . Figlet & version = 2.0 .1
13
10
14
11
///////////////////////////////////////////////////////////////////////////////
15
12
// ARGUMENTS
@@ -28,6 +25,8 @@ var solution = srcDir + "/MahApps.Metro.sln";
28
25
var publishDir = baseDir + "/Publish" ;
29
26
var testResultsDir = Directory( baseDir + "/TestResults" ) ;
30
27
28
+ var gitVersionPath = Context. Tools. Resolve( "gitversion.exe" ) ;
29
+
31
30
var styler = Context. Tools. Resolve( "xstyler.exe" ) ;
32
31
var stylerFile = baseDir + "/Settings.XAMLStyler" ;
33
32
@@ -38,8 +37,7 @@ public class BuildData
38
37
public DotNetVerbosity DotNetVerbosity { get ; }
39
38
public bool IsLocalBuild { get ; set ; }
40
39
public bool IsPullRequest { get ; set ; }
41
- public bool IsDevelopBranch { get ; set ; }
42
- public bool IsReleaseBranch { get ; set ; }
40
+ public bool IsPrerelease { get ; set ; }
43
41
public GitVersion GitVersion { get ; set ; }
44
42
45
43
public BuildData(
@@ -56,9 +54,7 @@ public class BuildData
56
54
public void SetGitVersion ( GitVersion gitVersion )
57
55
{
58
56
GitVersion = gitVersion ;
59
-
60
- IsDevelopBranch = StringComparer . OrdinalIgnoreCase . Equals ( "develop ", GitVersion. BranchName) ;
61
- IsReleaseBranch = StringComparer . OrdinalIgnoreCase . Equals ( "main ", GitVersion. BranchName) ;
57
+ IsPrerelease = GitVersion . NuGetVersion . Contains ( "- ") ;
62
58
}
63
59
}
64
60
@@ -73,11 +69,7 @@ Setup<BuildData>(ctx =>
73
69
throw new NotImplementedException ( $ "{ repoName } will only build on Windows because it's not possible to target WPF and Windows Forms from UNIX.") ;
74
70
}
75
71
76
- Information ( Figlet ( repoName ) ) ;
77
-
78
- var gitVersionPath = Context . Tools . Resolve ( "gitversion.exe" ) ;
79
-
80
- Information ( "GitVersion : {0}" , gitVersionPath ) ;
72
+ Spectre . Console . AnsiConsole . Write ( new Spectre . Console . FigletText ( repoName ) ) ;
81
73
82
74
var buildData = new BuildData (
83
75
configuration : Argument ( "configuration" , "Release" ) ,
@@ -98,15 +90,18 @@ Setup<BuildData>(ctx =>
98
90
}
99
91
buildData . SetGitVersion ( GitVersion ( new GitVersionSettings { ToolPath = gitVersionPath , OutputType = GitVersionOutput . Json } ) ) ;
100
92
93
+ Information ( "GitVersion : {0}" , gitVersionPath ) ;
101
94
Information ( "Branch : {0}" , buildData . GitVersion . BranchName ) ;
102
95
Information ( "Configuration : {0}" , buildData . Configuration ) ;
103
96
Information ( "IsLocalBuild : {0}" , buildData . IsLocalBuild ) ;
97
+ Information ( "IsPrerelease : {0}" , buildData . IsPrerelease ) ;
104
98
Information ( "Informational Version: {0}" , buildData . GitVersion . InformationalVersion ) ;
105
99
Information ( "SemVer Version: {0}" , buildData . GitVersion . SemVer ) ;
106
100
Information ( "AssemblySemVer Version: {0}" , buildData . GitVersion . AssemblySemVer ) ;
107
101
Information ( "MajorMinorPatch Version: {0}" , buildData . GitVersion . MajorMinorPatch ) ;
108
102
Information ( "NuGet Version: {0}" , buildData . GitVersion . NuGetVersion ) ;
109
103
Information ( "Verbosity : {0}" , buildData . Verbosity ) ;
104
+ Information ( "Publish folder : {0}" , publishDir ) ;
110
105
111
106
return buildData ;
112
107
} ) ;
@@ -123,8 +118,7 @@ Task("Clean")
123
118
. ContinueOnError ( )
124
119
. Does ( ( ) =>
125
120
{
126
- var filesToDelete = GetFiles ( "**/*_wpftmp.csproj" )
127
- ;
121
+ var filesToDelete = GetFiles ( "**/*_wpftmp.csproj" ) ;
128
122
DeleteFiles ( filesToDelete ) ;
129
123
130
124
var directoriesToDelete = GetDirectories ( "./**/obj" )
@@ -146,11 +140,11 @@ Task("Build")
146
140
var msbuildSettings = new DotNetMSBuildSettings
147
141
{
148
142
MaxCpuCount = 0 ,
149
- Version = data . IsReleaseBranch ? data . GitVersion . MajorMinorPatch : data . GitVersion . NuGetVersion ,
143
+ Version = data . GitVersion . NuGetVersion ,
150
144
AssemblyVersion = data . GitVersion . AssemblySemVer ,
151
145
FileVersion = data . GitVersion . AssemblySemFileVer ,
152
146
InformationalVersion = data . GitVersion . InformationalVersion ,
153
- ContinuousIntegrationBuild = data . IsReleaseBranch ,
147
+ ContinuousIntegrationBuild = true ,
154
148
ArgumentCustomization = args => args . Append ( "/m" ) . Append ( "/nr:false" ) // The /nr switch tells msbuild to quite once it's done
155
149
} ;
156
150
// msbuildSettings.FileLoggers.Add(
@@ -182,7 +176,7 @@ Task("Pack")
182
176
var msbuildSettings = new DotNetMSBuildSettings
183
177
{
184
178
MaxCpuCount = 0 ,
185
- Version = data . IsReleaseBranch ? data . GitVersion . MajorMinorPatch : data . GitVersion . NuGetVersion ,
179
+ Version = data . GitVersion . NuGetVersion ,
186
180
AssemblyVersion = data . GitVersion . AssemblySemVer ,
187
181
FileVersion = data . GitVersion . AssemblySemFileVer ,
188
182
InformationalVersion = data . GitVersion . InformationalVersion
@@ -306,6 +300,7 @@ Task("Tests")
306
300
Configuration = data . Configuration ,
307
301
NoBuild = true ,
308
302
NoRestore = true ,
303
+ Loggers = new [ ] { "trx" } ,
309
304
ResultsDirectory = testResultsDir ,
310
305
Verbosity = data . DotNetVerbosity
311
306
} ;
@@ -338,7 +333,7 @@ Task("CreateRelease")
338
333
GitReleaseManagerCreate ( token , "MahApps" , repoName , new GitReleaseManagerCreateSettings {
339
334
Milestone = data . GitVersion . MajorMinorPatch ,
340
335
Name = data . GitVersion . AssemblySemFileVer ,
341
- Prerelease = data . IsDevelopBranch ,
336
+ Prerelease = data . IsPrerelease ,
342
337
TargetCommitish = data . GitVersion . BranchName ,
343
338
WorkingDirectory = "."
344
339
} ) ;
0 commit comments