1
+ #tool "nuget:?package=GitVersion.CommandLine"
2
+
1
3
//////////////////////////////////////////////////////////////////////
2
4
// ARGUMENTS
3
5
//////////////////////////////////////////////////////////////////////
@@ -14,60 +16,74 @@ var buildDir = Directory("./artifacts") + Directory(configuration);
14
16
var solutionFile = File ( "./src/FluentAssertions.BestPractices.sln" ) ;
15
17
var testCsproj = File ( "./src/FluentAssertions.BestPractices.Tests/FluentAssertions.BestPractices.Tests.csproj" ) ;
16
18
var nuspecFile = File ( "./src/FluentAssertions.BestPractices/FluentAssertions.BestPractices.nuspec" ) ;
19
+ GitVersion gitVersion ;
17
20
18
21
//////////////////////////////////////////////////////////////////////
19
22
// TASKS
20
23
//////////////////////////////////////////////////////////////////////
21
24
25
+ Task ( "GitVersion" )
26
+ . Does ( ( ) =>
27
+ {
28
+ gitVersion = GitVersion ( new GitVersionSettings
29
+ {
30
+ UpdateAssemblyInfo = true
31
+ } ) ;
32
+ } ) ;
33
+
22
34
Task ( "Clean" )
23
35
. Does ( ( ) =>
24
- {
25
- CleanDirectory ( buildDir ) ;
26
- } ) ;
36
+ {
37
+ CleanDirectory ( buildDir ) ;
38
+ } ) ;
27
39
28
40
Task ( "Restore-NuGet-Packages" )
29
41
. IsDependentOn ( "Clean" )
30
42
. Does ( ( ) =>
31
- {
32
- DotNetCoreRestore ( solutionFile ) ;
33
- } ) ;
43
+ {
44
+ DotNetCoreRestore ( solutionFile ) ;
45
+ } ) ;
34
46
35
47
Task ( "Build" )
36
48
. IsDependentOn ( "Restore-NuGet-Packages" )
37
49
. Does ( ( ) =>
38
- {
39
- DotNetCoreBuild ( solutionFile , new DotNetCoreBuildSettings
40
- {
41
- Configuration = configuration ,
42
- OutputDirectory = buildDir
43
- } ) ;
44
- } ) ;
50
+ {
51
+ DotNetCoreBuild ( solutionFile , new DotNetCoreBuildSettings
52
+ {
53
+ Configuration = configuration ,
54
+ OutputDirectory = buildDir
55
+ } ) ;
56
+ } ) ;
45
57
46
58
Task ( "Run-Unit-Tests" )
47
- . IsDependentOn ( "Build" )
59
+ . IsDependentOn ( "Build" )
48
60
. Does ( ( ) =>
49
- {
50
- DotNetCoreTest ( testCsproj , new DotNetCoreTestSettings
51
- {
52
- Filter = "TestCategory=Completed" ,
53
- Configuration = configuration
54
- } ) ;
55
- } ) ;
61
+ {
62
+ DotNetCoreTest ( testCsproj , new DotNetCoreTestSettings
63
+ {
64
+ Filter = "TestCategory=Completed" ,
65
+ Configuration = configuration
66
+ } ) ;
67
+ } ) ;
56
68
57
69
Task ( "Pack" )
58
- . Does ( ( ) =>
70
+ . IsDependentOn ( "GitVersion" )
71
+ . Does ( ( ) =>
59
72
{
60
- var nuGetPackSettings = new NuGetPackSettings {
61
- OutputDirectory = buildDir
62
- } ;
63
- NuGetPack ( nuspecFile , nuGetPackSettings ) ;
73
+ var nuGetPackSettings = new NuGetPackSettings
74
+ {
75
+ OutputDirectory = buildDir ,
76
+ Version = gitVersion . NuGetVersionV2
77
+ } ;
78
+ NuGetPack ( nuspecFile , nuGetPackSettings ) ;
64
79
} ) ;
65
80
66
81
//////////////////////////////////////////////////////////////////////
67
82
// TASK TARGETS
68
83
//////////////////////////////////////////////////////////////////////
69
84
70
85
Task ( "Default" )
86
+ . IsDependentOn ( "GitVersion" )
71
87
. IsDependentOn ( "Build" )
72
88
. IsDependentOn ( "Run-Unit-Tests" )
73
89
. IsDependentOn ( "Pack" ) ;
0 commit comments