5
5
6
6
#tool "nuget:?package=GitVersion.CommandLine&version=4.0.0"
7
7
8
- var target = Argument ( "target" , "Default" ) ;
8
+ //////////////////////////////////////////////////////////////////////
9
+ // VARIABLES
10
+ //////////////////////////////////////////////////////////////////////
11
+ // Project details
12
+ var product = "CruiseControl.NET" ;
13
+
14
+ var target = Argument ( "target" , "default" ) ;
15
+ var configuration = Argument ( "configuration" , "Debug" ) ;
16
+ var verbosity = Argument ( "verbosity" , "Normal" ) ;
17
+
18
+ var nantExe = @".\Tools\NAnt\NAnt.exe" ;
19
+ GitVersion gitVersionResults ;
20
+
21
+ ///////////////////////////////////////////////////////////////////////////////
22
+ // SETUP / TEARDOWN
23
+ ///////////////////////////////////////////////////////////////////////////////
24
+
25
+ //NOTE: Executed BEFORE the first task.
26
+ Setup ( context =>
27
+ {
28
+ Information ( "Determine build environment" ) ;
29
+
30
+ Information ( "Determine build version" ) ;
31
+ gitVersionResults = GitVersion ( new GitVersionSettings ( ) ) ;
32
+
33
+ Information ( "Building version {0} of {1}." , gitVersionResults . InformationalVersion , product ) ;
34
+ Information ( "Target: {0}." , target ) ;
35
+ } ) ;
9
36
10
- Task ( "Default" )
37
+ // NOTE: Executed AFTER the last task.
38
+ Teardown ( context =>
39
+ {
40
+ Information ( "Finished building version {0} of {1}." , gitVersionResults . InformationalVersion , product ) ;
41
+ } ) ;
42
+
43
+
44
+ Task ( "default" )
11
45
. Does ( ( ) =>
12
46
{
13
- Information ( "Hello World!" ) ;
47
+ Information ( "Available targets" ) ;
48
+ Information ( " build : Builds the project by running the clean and build targets from ccnet.build script" ) ;
49
+ Information ( " build-all : Builds the project, runs tests and packages artifacts by running the all target from ccnet.build script" ) ;
50
+ Information ( " run-tests : Run projects tests by executing the runTests target from ccnet.build script" ) ;
51
+ Information ( " package : Packages project artifacts by running package target from ccnet.build script" ) ;
52
+ Information ( " web-packages : Packages the project webdashboards by running build.packages from ccnet.build script" ) ;
14
53
} ) ;
15
54
55
+ Task ( "build" )
56
+ . Does ( ( ) => {
57
+ //Tools\NAnt\NAnt.exe clean build -buildfile:ccnet.build -D:codemetrics.output.type=HtmlFile -nologo -logfile:nant-build.log.txt %*
58
+ using ( var process = StartAndReturnProcess ( nantExe ,
59
+ new ProcessSettings {
60
+ Arguments = " clean build -buildfile:ccnet.build -D:codemetrics.output.type=HtmlFile -D:version=" + gitVersionResults . AssemblySemVer + " -D:fversion=" + gitVersionResults . AssemblySemFileVer + " -D:iversion=\" " + gitVersionResults . InformationalVersion + "\" -nologo -logfile:nant-build.log.txt %*" ,
61
+ RedirectStandardError = false ,
62
+ RedirectStandardOutput = false ,
63
+ Silent = false
64
+ } ) )
65
+ {
66
+ process . WaitForExit ( ) ;
67
+ // This should output 0 as valid arguments supplied
68
+ Information ( "Exit code: {0}" , process . GetExitCode ( ) ) ;
69
+ }
70
+ } ) ;
71
+
72
+ Task ( "build-all" )
73
+ . Does ( ( ) => {
74
+ //Tools\NAnt\NAnt.exe clean build -buildfile:ccnet.build -D:codemetrics.output.type=HtmlFile -nologo -logfile:nant-build.log.txt %*
75
+ using ( var process = StartAndReturnProcess ( nantExe ,
76
+ new ProcessSettings {
77
+ Arguments = " all -buildfile:ccnet.build -D:codemetrics.output.type=HtmlFile -D:version=" + gitVersionResults . AssemblySemVer + " -D:fversion=" + gitVersionResults . AssemblySemFileVer + " -D:iversion=\" " + gitVersionResults . InformationalVersion + "\" -nologo -logfile:nant-build.log.txt %*" ,
78
+ RedirectStandardError = false ,
79
+ RedirectStandardOutput = false ,
80
+ Silent = false
81
+ } ) )
82
+ {
83
+ process . WaitForExit ( ) ;
84
+ // This should output 0 as valid arguments supplied
85
+ Information ( "Exit code: {0}" , process . GetExitCode ( ) ) ;
86
+ }
87
+ } ) ;
88
+
89
+ Task ( "run-tests" )
90
+ . Does ( ( ) => {
91
+ //Tools\NAnt\NAnt.exe runTests -buildfile:ccnet.build -D:codemetrics.output.type=HtmlFile -nologo -logfile:nant-build-tests.log.txt %*
92
+ using ( var process = StartAndReturnProcess ( nantExe ,
93
+ new ProcessSettings {
94
+ Arguments = " runTests -buildfile:ccnet.build -D:codemetrics.output.type=HtmlFile -D:version=" + gitVersionResults . AssemblySemVer + " -D:fversion=" + gitVersionResults . AssemblySemFileVer + " -D:iversion=\" " + gitVersionResults . InformationalVersion + "\" -nologo -logfile:nant-build-tests.log.txt %*" ,
95
+ RedirectStandardError = false ,
96
+ RedirectStandardOutput = false ,
97
+ } ) )
98
+ {
99
+ process . WaitForExit ( ) ;
100
+ // This should output 0 as valid arguments supplied
101
+ Information ( "Exit code: {0}" , process . GetExitCode ( ) ) ;
102
+ }
103
+ } ) ;
104
+
105
+ Task ( "package" )
106
+ . Does ( ( ) => {
107
+ //Tools\NAnt\NAnt.exe package -buildfile:ccnet.build -D:CCNetLabel=1.5.0.0 -nologo -logfile:nant-build-package.log.txt %*
108
+ using ( var process = StartAndReturnProcess ( nantExe ,
109
+ new ProcessSettings {
110
+ Arguments = " package -buildfile:ccnet.build -D:version=" + gitVersionResults . AssemblySemVer + " -D:fversion=" + gitVersionResults . AssemblySemFileVer + " -D:iversion=\" " + gitVersionResults . InformationalVersion + "\" -nologo -logfile:nant-build-package.log.txt %*" ,
111
+ RedirectStandardError = false ,
112
+ RedirectStandardOutput = false ,
113
+ } ) )
114
+ {
115
+ process . WaitForExit ( ) ;
116
+ // This should output 0 as valid arguments supplied
117
+ Information ( "Exit code: {0}" , process . GetExitCode ( ) ) ;
118
+ }
119
+ } ) ;
120
+
121
+ Task ( "web-packages" )
122
+ . Does ( ( ) => {
123
+ //Tools\NAnt\NAnt.exe build.packages -buildfile:ccnet.build -nologo -logfile:nant-build-web-packages.log.txt %*
124
+ using ( var process = StartAndReturnProcess ( nantExe ,
125
+ new ProcessSettings {
126
+ Arguments = " build.packages -buildfile:ccnet.build -D:version=" + gitVersionResults . AssemblySemVer + " -D:fversion=" + gitVersionResults . AssemblySemFileVer + " -D:iversion=\" " + gitVersionResults . InformationalVersion + "\" -nologo -logfile:nant-build-web-packages.log.txt %*" ,
127
+ RedirectStandardError = false ,
128
+ RedirectStandardOutput = false ,
129
+ } ) )
130
+ {
131
+ process . WaitForExit ( ) ;
132
+ // This should output 0 as valid arguments supplied
133
+ Information ( "Exit code: {0}" , process . GetExitCode ( ) ) ;
134
+ }
135
+ } ) ;
136
+
16
137
RunTarget ( target ) ;
0 commit comments