-
Notifications
You must be signed in to change notification settings - Fork 86
/
spark.build
184 lines (148 loc) · 7.81 KB
/
spark.build
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
<?xml version="1.0" encoding="utf-8"?>
<!--EXTERNAL_PROPERTIES: usdDatabaseVersion-->
<!--EXTERNAL_PROPERTIES: CCNetLabel-->
<project name="Spark" default="build" xmlns="http://nant.sf.net/release/0.92/nant.xsd">
<property name="solution.dir" value="src"/>
<property name="solution.file" value="${solution.dir}\Spark.sln"/>
<property name="build.dir" value="${project::get-base-directory()}\build"/>
<property name="msbuild.dir" value="C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin" />
<property name="results.dir" value="results" />
<property name="version.major" value="1"/>
<property name="version.minor" value="8"/>
<property name="version.build" value="2"/>
<property name="version.revision" value="0-alpha"/>
<property name="project.version" value="${version.major}.${version.minor}" dynamic="true" />
<property name="project.fullversion" value="${version.major}.${version.minor}.${version.build}.${version.revision}" dynamic="true" />
<property name="nant.settings.currentframework" value="net-4.0" />
<property name="company.name" value="Louis DeJardin" />
<property name="project.authors" value="RobertTheGrey" />
<property name="project.copyright" value="Copyright (c) ${company.name} 2008-${datetime::get-year(datetime::now())}"/>
<property name="project.signassembly" value="False"/>
<!-- Debug|Release -->
<property name="project.config" value="Release" />
<property name="dist.revision" value="${datetime::get-year(datetime::now())*10000+datetime::get-month(datetime::now())*100+ datetime::get-day(datetime::now())}"/>
<target name="build" depends="clean, init, version, compile, test, package" />
<target name="init" description="Initializes build properties">
<tstamp>
<formatter property="datetime.buildtime" pattern="yyyy-MM-dd, HH:mm:ss" />
</tstamp>
<echo message="Current Directory: ${project::get-base-directory()}"/>
</target>
<target name="clean" description="Deletes build artifacts">
<delete dir="${build.dir}" failonerror="false" />
</target>
<target name="version" description="Defines version variables and poke them into .csproj files">
<if test="${property::exists('CCNetLabel')}">
<property name="version.build" value="${CCNetLabel}"/>
<echo message="Using CruiseControl build number ${CCNetLabel}" />
</if>
<if test="${property::exists('build.number')}">
<property name="version.build" value="${build.number}"/>
<echo message="Using TeamCity build number ${build.number}" />
</if>
<property name="dist.revision" value="${project.fullversion}"/>
<echo message="UPDATING PACKAGE INFO AND SETTING VERSION TO ${project.fullversion}" />
<foreach item="File" property="filename">
<in>
<items>
<include name="**/*.csproj" />
<!-- No need set the info on unit test projects -->
<exclude name="**Tests**" />
<!-- Ancient code is hiding in the \src folder! -->
<exclude name="*/Tools/**" />
<exclude name="**/Profiling/**" />
<exclude name="**/Samples/**" />
</items>
</in>
<do>
<echo message="Poking ${filename}" />
<xmlpoke file="${filename}" xpath="//Project/PropertyGroup/SignAssembly" value="${project.signassembly}" />
<xmlpoke file="${filename}" xpath="//Project/PropertyGroup/AssemblyVersion" value="${project.version}" />
<xmlpoke file="${filename}" xpath="//Project/PropertyGroup/Version" value="${project.fullversion}" />
<xmlpoke file="${filename}" xpath="//Project/PropertyGroup/FileVersion" value="${project.fullversion}" />
<xmlpoke file="${filename}" xpath="//Project/PropertyGroup/Copyright" value="${project.copyright}" />
<xmlpoke file="${filename}" xpath="//Project/PropertyGroup/Authors" value="${project.authors}" />
<xmlpoke file="${filename}" xpath="//Project/PropertyGroup/Company" value="${company.name}" />
</do>
</foreach>
</target>
<target name="compile" depends="init">
<echo />
<echo message="Build Directory is ${build.dir}" />
<exec program="${msbuild.dir}\msbuild.exe"
commandline=""${solution.file}" /t:clean /v:m"
workingdir="." />
<!-- MSBUILD Task Clean -->
<!-- See Directory.build.props to that defines hook to clear the bin and obj folders -->
<echo />
<echo message="MSBUILD CLEAN" />
<echo />
<!-- MSBUILD Task: Restore -->
<echo />
<echo message="MSBUILD RESTORE" />
<echo />
<exec program="${msbuild.dir}\msbuild.exe"
commandline=""${solution.file}" /t:restore /v:m"
workingdir="." />
<!-- MSBUILD Task: Build -->
<echo />
<echo message="MSBUILD BUILD" />
<echo />
<exec program="${msbuild.dir}\msbuild.exe"
commandline=""${solution.file}" /t:build "/p:Configuration=${project.config}" /v:m"
workingdir="." />
</target>
<target name="test" depends="init" description="Runs unit tests">
<delete dir="${results.dir}" if="${directory::exists('${results.dir}')}" verbose="true" />
<mkdir dir="${results.dir}"/>
<!-- Assumes nunit console running installed via "choco install nunit-console-runner" -->
<property name="nunit.dir" value="C:\ProgramData\chocolatey\lib\nunit-console-runner\tools" readonly="true" />
<foreach item="File" property="filename">
<in>
<items>
<!-- Not using a pattern to avoid dupplicats (i.e. some .tests.dll files are in multiple projects) -->
<include name="src/Spark.Tests/bin/${project.config}/net481/Spark.Tests.dll" />
<include name="src/Spark.Web.Tests/bin/${project.config}/net481/Spark.Web.Tests.dll" />
<include name="src/Spark.Python.Tests/bin/${project.config}/net481/Spark.Python.Tests.dll" />
<include name="src/Spark.Ruby.Tests/bin/${project.config}/net481/Spark.Ruby.Tests.dll" />
<include name="src/Spark.Web.Mvc.Tests/bin/${project.config}/net481/Spark.Web.Mvc.Tests.dll" />
<include name="src/Spark.Web.Mmv.Tests/bin/${project.config}/net481/Spark.Web.Mvc.Ruby.Tests.dll" />
<include name="src/Castle.MonoRail.Pdf.TestsTests/bin/${project.config}/net481/Castle.MonoRail.Pdf.Tests.dll" />
<include name="src/Castle.Monorail.Views.Tests/bin/${project.config}/net481/Castle.MonoRail.Views.Spark.Tests.dll" />
</items>
</in>
<do>
<echo />
<echo message="Running unit tests in ${filename}" />
<echo />
<exec program="nunit3-console.exe" basedir="${nunit.dir}" workingdir="${path::get-directory-name(filename)}">
<arg value="${filename}" />
<arg value="--result:${results.dir}\${path::get-file-name(filename)}-results.xml"/>
</exec>
</do>
</foreach>
</target>
<target name="package" description="Creates nuget packages">
<echo />
<echo message="MSBUILD PACK" />
<echo />
<!-- MSBUILD Task: Pack -->
<exec program="${msbuild.dir}\msbuild.exe"
commandline=""${solution.file}" /t:pack "/p:Configuration=${project.config}" /v:m"
workingdir="." />
<copy todir="${build.dir}" flatten="true">
<fileset>
<include name="**/*.nupkg" />
<include name="**/*.snupkg" />
</fileset>
</copy>
</target>
<target name="push" description="Publishes the nuget packages on nuget.org">
<!-- Assumes dotnet CLI installed -->
<exec program="dotnet.exe">
<arg value="nuget" />
<arg value="push" />
<arg value=""${build.dir}/*.nupkg"" />
</exec>
</target>
</project>