forked from yandex-qatools/htmlelements-dotnet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
HtmlElements-dotNet.build
352 lines (307 loc) · 16.2 KB
/
HtmlElements-dotNet.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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
<?xml version="1.0" encoding="utf-8"?>
<project name="htmlelements-dotnet" default="build">
<include buildfile="HtmlElements-dotNet.include" />
<!-- Dependencies -->
<property name="dependency.impromptuinterface.path" value="packages/ImpromptuInterface.6.2.2/lib/net40" overwrite="true"/>
<property name="dependency.selenium.support.path" value="packages/Selenium.Support.2.44.0/lib/net40" overwrite="true"/>
<property name="dependency.selenium.webdriver.path" value="packages/Selenium.WebDriver.2.44.0/lib/net40" overwrite="true"/>
<property name="dependency.nunit.framework.path" value="packages/NUnit.2.6.3/lib" overwrite="true"/>
<property name="dependency.nunit.runners.path" value="packages/NUnit.Runners.2.6.3/tools" overwrite="true"/>
<property name="dependency.moq.path" value="packages/Moq.4.1.1309.1617/lib/net40" overwrite="true"/>
<property name="dependency.impromptuinterface.include" value="${dependency.impromptuinterface.path}/ImpromptuInterface.dll" overwrite="true"/>
<property name="dependency.selenium.support.include" value="${dependency.selenium.support.path}/WebDriver.Support.dll" overwrite="true"/>
<property name="dependency.selenium.webdriver.include" value="${dependency.selenium.webdriver.path}/WebDriver.dll" overwrite="true"/>
<property name="dependency.nunit.framework.include" value="${dependency.nunit.framework.path}/nunit.framework.dll" overwrite="true"/>
<property name="dependency.nunit.runners.executable" value="${dependency.nunit.runners.path}/nunit-console.exe" overwrite="true"/>
<property name="dependency.moq.include" value="${dependency.moq.path}/Moq.dll" overwrite="true"/>
<!-- Project properties -->
<property name="version" value="0.0" overwrite="true"/>
<property name="product.name" value="HtmlElements-dotNet" overwrite="false"/>
<property name="product.company" value="Yandex QATools" overwrite="false"/>
<property name="product.description" value="WebDriver PageObject extension for .NET" overwrite="false"/>
<property name="product.duration" value="2012" overwrite="false" />
<property name="product.docfile" value="${product.name}.xml" overwrite="false"/>
<property name="path.base" value="${project::get-base-directory()}"/>
<property name="path.build" value="${path.base}/build" dynamic="true"/>
<property name="path.dist" value="${path.base}/dist" dynamic="true"/>
<property name="path.src.product" value="${path.base}/${product.name}" dynamic="true"/>
<property name="path.src.tests" value="${path.base}/HtmlElements-Tests" dynamic="true"/>
<property name="path.packages" value="${path.base}/packages" dynamic="true"/>
<property name="path.build.assemblyinfo" value="${path.src.product}/Properties/AssemblyInfo.cs" dynamic="true"/>
<property name="path.tools.nuget" value="${path.base}/.nuget/NuGet.exe"/>
<property name="product.assembly" value="${product.name}.dll" overwrite="false"/>
<property name="product.assembly.tests" value="HtmlElements-Tests.dll" overwrite="false"/>
<property name="product.clsCompliant" value="true" overwrite="false"/>
<property name="nuget.apiKey" value="" overwrite="false"/>
<property name="nuget.publish" value="true" overwrite="false"/>
<property name="version.useZero" value="${not(nuget.publish)}" dynamic="true"/>
<property name="version.major" value="1" dynamic="true"/>
<property name="version.minor" value="0" dynamic="true"/>
<property name="version.build" value="0" dynamic="true"/>
<property name="build.version" value="${version.major}.${version.minor}.${version.build}" dynamic="true"/>
<property name="build.assemblyversion" value="${version.major}.${version.minor}.0" dynamic="true"/>
<property name="build.config" value="debug" overwrite="false"/>
<property name="build.platform" value="net-4.0" overwrite="true"/>
<property name="build.target" value="net-4.0" overwrite="true"/>
<property name="build.asminfo" value="SharedAssemblyInfo.cs"/>
<property name="skip.tests" value="false" readonly="false" overwrite="false"/>
<target name="build" depends="all"/>
<target name="package" depends="package-bin" />
<target name="all" depends="core test"/>
<target name="clean">
<delete dir="${path.build}" if="${directory::exists(path.build)}"/>
<delete dir="${path.dist}" if="${directory::exists(path.dist)}"/>
</target>
<target name="config-build-debug">
<property name="build.debug" value="true"/>
<property name="build.optimize" value="false" overwrite="false"/>
<property name="global.build.defines" value="DEBUG,TRACE"/>
</target>
<target name="config-build-release">
<property name="build.debug" value="PdbOnly"/>
<property name="build.optimize" value="true" overwrite="false"/>
<property name="global.build.defines" value="TRACE,STRONG"/>
</target>
<target name="nuget-restore-product">
<property name="nuget.package.dir" value="${path.src.product}" />
<call target="nuget-restore" />
</target>
<target name="nuget-restore-tests">
<property name="nuget.package.dir" value="${path.src.tests}" />
<call target="nuget-restore" />
</target>
<target name="nuget-restore">
<call target="nuget-restore-win" if="${not(string::contains(build.platform, 'mono'))}" />
<call target="nuget-restore-mono" if="${string::contains(build.platform, 'mono')}" />
</target>
<target name="nuget-restore-win">
<exec program="${path.tools.nuget}">
<arg value="restore" />
<arg value="${nuget.package.dir}/packages.config" />
<arg value="-PackagesDirectory" />
<arg value="packages" />
</exec>
</target>
<target name="nuget-restore-mono">
<exec program="${framework::get-runtime-engine(framework::get-target-framework())}">
<arg value="${path.tools.nuget}" />
<arg value="restore" />
<arg value="${nuget.package.dir}/packages.config" />
<arg value="-PackagesDirectory" />
<arg value="packages" />
</exec>
</target>
<target name="core" depends="init nuget-restore-product">
<csc noconfig="true" warnaserror="true" target="library" debug="${build.debug}" optimize="${build.optimize}" define="${build.defines}" output="${current.path.build}/${product.assembly}" doc="${current.path.build}/${product.docfile}" >
<arg line="/filealign:512"/>
<arg value="-sdk:2" if="${string::contains(build.platform, 'mono-3.5')}"/>
<arg value="-sdk:4" if="${string::contains(build.platform, 'mono-4.0')}"/>
<sources basedir="${path.src.product}">
<include name="${build.asminfo}"/>
<include name="**/*.cs"/>
</sources>
<references>
<include name="mscorlib.dll" />
<include name="System.dll" />
<include name="System.Core.dll" />
<include name="Microsoft.CSharp.dll" />
<include name="System.Data.dll" />
<include name="System.Drawing.dll" />
<include name="${dependency.selenium.webdriver.include}" />
<include name="${dependency.selenium.support.include}" />
<include name="${dependency.impromptuinterface.include}" />
</references>
<nowarn>
<warning number="1591" />
</nowarn>
</csc>
</target>
<target name="init">
<mkdir dir="${path.build}" if="${not(directory::exists(path.build))}"/>
<call target="config-build-${build.config}"/>
<call target="config-platform-${build.target}"/>
<property name="current.path.build" value="${path.build}/${build.config}"/>
<property name="current.path.tests" value="${path.build}/tests" />
<mkdir dir="${current.path.build}" if="${not(directory::exists(current.path.build))}"/>
<copy todir="${current.path.build}">
<fileset basedir="${path.base}">
<include name="LICENSE"/>
</fileset>
</copy>
</target>
<target name="test" depends="compile-tests" unless="${skip.tests}">
<mkdir dir="${current.path.tests}/report"/>
<call target="test-win" if="${not(string::contains(build.platform, 'mono'))}" />
<call target="test-mono" if="${string::contains(build.platform, 'mono')}" />
</target>
<target name="test-win" depends="compile-tests" unless="${skip.tests}">
<exec program="${dependency.nunit.runners.executable}" basedir="${path.base}">
<arg value="-xml=${current.path.tests}/report/${product.assembly}.xml" />
<arg value="-framework=${build.platform}" />
<arg value="-config=${build.config}" />
<arg value="${current.path.tests}/${product.assembly.tests}" />
</exec>
</target>
<target name="test-mono" depends="compile-tests" unless="${skip.tests}">
<exec program="${framework::get-runtime-engine(framework::get-target-framework())}" basedir="${path.base}">
<arg value="${dependency.nunit.runners.executable}" />
<arg value="-xml=${current.path.tests}/report/${product.assembly}.xml" />
<arg value="-framework=${build.platform}" />
<arg value="-config=${build.config}" />
<arg value="${current.path.tests}/${product.assembly.tests}" />
</exec>
</target>
<target name="compile-tests" depends="nuget-restore-tests" unless="${skip.tests}">
<mkdir dir="${current.path.tests}"/>
<copy todir="${current.path.tests}" flatten="true">
<fileset basedir="${path.base}">
<include name="${current.path.build}/${product.assembly}" />
<include name="${dependency.moq.include}" />
<include name="${dependency.nunit.framework.include}" />
<include name="${dependency.selenium.webdriver.include}" />
<include name="${dependency.selenium.support.include}" />
<include name="${dependency.impromptuinterface.include}" />
</fileset>
</copy>
<csc noconfig="true" nostdlib="true" warnaserror="true" target="library" debug="${build.debug}" optimize="${build.optimize}" define="${build.defines}"
output="${current.path.tests}/${product.assembly.tests}">
<sources basedir="${path.src.tests}">
<include name="**/*.cs"/>
</sources>
<references basedir="${path.base}">
<include name="${current.path.build}/${product.assembly}" />
<include name="mscorlib.dll" />
<include name="System.dll" />
<include name="System.Core.dll" />
<include name="${dependency.moq.include}" />
<include name="${dependency.nunit.framework.include}"/>
<include name="System.Data.dll" />
<include name="System.Drawing.dll" />
<include name="${dependency.selenium.webdriver.include}" />
<include name="${dependency.selenium.support.include}" />
</references>
<nowarn>
<warning number="0649"/>
</nowarn>
</csc>
</target>
<target name="config-platform-net-4.0">
<property name="nant.settings.currentframework" value="net-4.0"/>
<property name="build.defines" value="${global.build.defines},NET,NET_40,NO_PARTIAL_TRUST"/>
<property name="nuget.platform" value="net40"/>
<property name="nuget.add" value="true"/>
<property name="build.platform" value="net-4.0" overwrite="true"/>
</target>
<target name="config-platform-net-4.5">
<property name="nant.settings.currentframework" value="net-4.5"/>
<property name="build.defines" value="${global.build.defines},NET,NET_45,NO_PARTIAL_TRUST"/>
<property name="nuget.platform" value="net45"/>
<property name="nuget.add" value="true"/>
<property name="build.platform" value="net-4.5" overwrite="true"/>
</target>
<target name="config-platform-mono-4.0">
<property name="nant.settings.currentframework" value="mono-4.0"/>
<property name="build.defines" value="${global.build.defines},NET,NET_40,MONO,MONO_40,NO_GENERIC_MOQ" />
<property name="nuget.add" value="false"/>
<property name="build.platform" value="mono-4.0" overwrite="true"/>
</target>
<target name="create-assembly-info" depends="init">
<echo message="Build Number: '${build.version}'" />
<echo message="Assembly Version: '${build.assemblyversion}'" />
<echo message="Build Platform: '${build.platform}'" />
<asminfo output="${path.build.assemblyinfo}" language="CSharp">
<imports>
<import namespace="System"/>
<import namespace="System.Reflection"/>
<import namespace="System.Runtime.InteropServices"/>
</imports>
<attributes>
<attribute type="AssemblyProductAttribute" value="${product.name}: ${product.description}" />
<attribute type="AssemblyCompanyAttribute" value="${product.company}" />
<attribute type="AssemblyCopyrightAttribute" value="Copyright © ${product.duration} ${product.company} and contributors" />
<attribute type="AssemblyVersionAttribute" value="${build.assemblyversion}" />
<attribute type="AssemblyFileVersionAttribute" value="${build.version}" />
<attribute type="ComVisibleAttribute" value="false" />
<attribute type="CLSCompliantAttribute" value="true" if="${product.clsCompliant}" />
</attributes>
</asminfo>
</target>
<target name="package-bin" depends="create-assembly-info all">
<mkdir dir="${path.dist}" if="${not(directory::exists(path.dist))}"/>
<zip zipfile="${path.dist}\${product.name}-${build.version}-${build.config}-${build.platform}.zip" ziplevel="9">
<fileset basedir="${current.path.build}">
<include name="**/*.*"/>
</fileset>
</zip>
</target>
<target name="nuget">
<property name="nuget.sourcedir" value="${path.base}/nuget" />
<property name="nuget.basedir" value="${path.base}/build/nuget" />
<property name="nuget.symbol.basedir" value="${path.base}/build/nuget_symbol" />
<property name="nuget.name" value="${product.name}" />
<property name="nuget.project" value="${path.src.product}/${product.name}.csproj" />
<property name="nuget.releaseDirectory" value="${path.build}\release" dynamic="true"/>
<property name="nuget.additionalFiles" value="-" />
<property name="nuget.packageName" value="${nuget.name}" />
<property name="nuget.platform" value="${build.platform}"/>
<call target="nuget-run"/>
</target>
<target name="nuget-run" description="Copies the nuget output to the top bin directory">
<delete dir="${nuget.basedir}"/>
<if test="${not(nuget.symbol.basedir == '')}">
<!-- unless does not work on delete -->
<delete dir="${nuget.symbol.basedir}"/>
</if>
<property name="nuget.version" value="${build.version}"/>
<call target="config-build-${build.config}"/>
<call target="config-platform-${nuget.platform}"/>
<copy overwrite="false" todir="${nuget.basedir}\lib\${nuget.platform}" flatten="true" if="${nuget.add}">
<fileset basedir="${nuget.releaseDirectory}">
<include name="${nuget.name}.dll" />
<include name="${nuget.name}.xml" />
<include name="${nuget.name}.pdb" />
<include name="${nuget.additionalFiles}" unless="${nuget.additionalFiles == '-'}"/>
</fileset>
</copy>
<copy overwrite="false" todir="${nuget.basedir}">
<fileset basedir="${nuget.sourcedir}">
<include name="**/*" />
</fileset>
</copy>
<echo message="Build Version: ${nuget.version}"/>
<xmlpoke file="${nuget.basedir}/${nuget.name}.nuspec" xpath="//package/nu:metadata/nu:version" value="${nuget.version}">
<namespaces>
<namespace prefix="xsi" uri="http://www.w3.org/2001/XMLSchema-instance" />
<namespace prefix="xsd" uri="http://www.w3.org/2001/XMLSchema" />
<namespace prefix="nu" uri="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd" />
</namespaces>
</xmlpoke>
<exec program="${path.tools.nuget}" workingdir="${nuget.basedir}" commandline="pack ${nuget.basedir}\${nuget.name}.nuspec -Exclude **\*.pdb" />
<move todir="${path.dist}\NuGet\">
<fileset basedir="${nuget.basedir}">
<include name="*.nupkg" />
</fileset>
</move>
<exec program="${path.tools.nuget}" workingdir="${nuget.basedir}" commandline="pack ${nuget.basedir}\${nuget.name}.nuspec" />
<if test="${not(nuget.project == '')}">
<exec program="${path.tools.nuget}" workingdir="${nuget.basedir}" commandline="pack ${nuget.project} -symbols" />
<unzip zipfile="${nuget.basedir}\${nuget.packageName}.${nuget.version}.nupkg" todir="${nuget.symbol.basedir}/target"/>
<unzip zipfile="${nuget.basedir}\${nuget.packageName}.${version.major}.${version.minor}.0.0.symbols.nupkg" todir="${nuget.symbol.basedir}/source"/>
<copy overwrite="false" todir="${nuget.symbol.basedir}/target">
<fileset basedir="${nuget.symbol.basedir}/source">
<include name="[Content_Types].xml" />
<include name="src/**" />
</fileset>
</copy>
<zip zipfile="${path.dist}\NuGet\${nuget.packageName}.${nuget.version}.symbols.nupkg">
<fileset basedir="${nuget.symbol.basedir}/target">
<include name="**"/>
</fileset>
</zip>
</if>
<if test="${not(nuget.apiKey == '') and nuget.publish}">
<echo message="Publish to nuget.org" />
<exec program="${path.tools.nuget}" workingdir="${path.dist}\NuGet\" commandline="push ${nuget.packageName}.${nuget.version}.nupkg ${nuget.apiKey} -NonInteractive" failonerror="false"/>
</if>
</target>
</project>