forked from nhibernate/nhibernate-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
default.build
344 lines (294 loc) · 13.3 KB
/
default.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
<?xml version="1.0" ?>
<project
name="NHibernate"
default="build"
xmlns="http://nant.sf.net/release/0.90/nant.xsd"
>
<property name="root.dir" value="." />
<property name="target.dir" value="net461" />
<include buildfile="${root.dir}/build-common/common.xml" />
<!-- Pass -D:skip.tests=true to NAnt to skip running tests when building -->
<property name="skip.tests" value="false" overwrite="false" />
<property name="skip.manual" value="false" overwrite="false" />
<target name="init" depends="common.init" description="Initializes build properties" />
<target name="prepare-build-directory" depends="init">
<mkdir dir="${testresults.dir}" />
</target>
<target name="nuget.set-properties">
<property name="nuget.nupackages.dir" value="${build.dir}/nuget_gallery" />
<property name="nuget.nupackages.pushbatfile" value="${nuget.nupackages.dir}/NuGetPush.bat" />
</target>
<target name="build"
depends="init prepare-build-directory nuget.set-properties"
description="Builds NHibernate in the current configuration">
<property name="build.counter" value="" overwrite="false" />
<exec program="dotnet" verbose="true">
<arg value="msbuild" />
<arg value="${root.dir}/src/NHibernate.sln" />
<arg value="/p:Platform="Any CPU"" />
<arg value="/p:Configuration="${build.config}""/>
<arg value="/p:GeneratePackageOnBuild="True"" />
<arg value="/p:IncludeSymbols="True"" />
<arg value="/p:IncludeSource="True"" />
<arg value="/p:PackageOutputPath="${path::get-full-path(nuget.nupackages.dir)}"" />
<!-- build.counter is not available by default. It needs to be exposed in Team City as system parameter system.build.counter with value %build.counter% -->
<arg value="/p:BuildNumber="${build.counter}"" unless="${build.counter == ''}" />
<arg value="/t:Restore" />
<arg value="/t:Rebuild" />
<arg value="/v:q" />
<arg value="/m" />
</exec>
</target>
<target name="solution-restore" depends="common.tools-restore">
<exec program="dotnet" verbose="true">
<arg value="msbuild" />
<arg value="/t:Restore" />
<arg value="${root.dir}/src/NHibernate.sln" />
</exec>
</target>
<target name="get-tool-info" depends="common.tools-restore">
<xmlpeek
file="${tools.dir}/packages.csproj"
xpath="/Project/ItemGroup/PackageReference[@Include = '${tool.id}']/@Version"
property="tool.version" />
<property name="tool.path" value="${tools.dir}/${tool.id}/${tool.version}/" />
</target>
<target name="generate-async" depends="solution-restore">
<exec workingdir="${root.dir}/src" program="dotnet" verbose="true">
<arg line="async-generator" />
</exec>
</target>
<target name="put-connection-settings-into-defined-app-config">
<!-- make sure the config file is writable -->
<attrib file="${app.config}" readonly="false" />
<!--
Tell nhibernate how to connect to the test database.
-->
<xmlpoke file="${app.config}"
xpath="//*/hbm:property[@name='dialect']"
value="${nhibernate.dialect}">
<namespaces>
<namespace prefix="hbm" uri="urn:nhibernate-configuration-2.2" />
</namespaces>
</xmlpoke>
<xmlpoke file="${app.config}"
xpath="//*/hbm:property[@name='command_timeout']"
value="${nhibernate.command_timeout}">
<namespaces>
<namespace prefix="hbm" uri="urn:nhibernate-configuration-2.2" />
</namespaces>
</xmlpoke>
<xmlpoke file="${app.config}"
xpath="//*/hbm:property[@name='connection.driver_class']"
value="${nhibernate.connection.driver_class}">
<namespaces>
<namespace prefix="hbm" uri="urn:nhibernate-configuration-2.2" />
</namespaces>
</xmlpoke>
<xmlpoke file="${app.config}"
xpath="//*/hbm:property[@name='connection.connection_string']"
value="${nhibernate.connection.connection_string}">
<namespaces>
<namespace prefix="hbm" uri="urn:nhibernate-configuration-2.2" />
</namespaces>
</xmlpoke>
<!-- Make sure the property exists - it's only set for some scenarios. -->
<property name="nhibernate.odbc.explicit_datetime_scale" value="" unless="${property::exists('nhibernate.odbc.explicit_datetime_scale')}"/>
<xmlpoke file="${app.config}"
xpath="//*/hbm:property[@name='odbc.explicit_datetime_scale']"
value="${nhibernate.odbc.explicit_datetime_scale}">
<namespaces>
<namespace prefix="hbm" uri="urn:nhibernate-configuration-2.2" />
</namespaces>
</xmlpoke>
<!-- Make sure the property exists - it's only set for some scenarios. -->
<property name="nhibernate.oracle.use_n_prefixed_types_for_unicode" value="" unless="${property::exists('nhibernate.oracle.use_n_prefixed_types_for_unicode')}"/>
<xmlpoke file="${app.config}"
xpath="//*/hbm:property[@name='oracle.use_n_prefixed_types_for_unicode']"
value="${nhibernate.oracle.use_n_prefixed_types_for_unicode}">
<namespaces>
<namespace prefix="hbm" uri="urn:nhibernate-configuration-2.2" />
</namespaces>
</xmlpoke>
<!-- Make sure the property exists - it's only set for some scenarios. -->
<property name="nhibernate.query.default_cast_length" value="" unless="${property::exists('nhibernate.query.default_cast_length')}"/>
<xmlpoke file="${app.config}"
xpath="//*/hbm:property[@name='query.default_cast_length']"
value="${nhibernate.query.default_cast_length}">
<namespaces>
<namespace prefix="hbm" uri="urn:nhibernate-configuration-2.2" />
</namespaces>
</xmlpoke>
</target>
<target name="put-connection-settings-into-app-config">
<property name="app.config" value="src/${test.file}/bin/${build.config}/${target.dir}/${test.file}.dll.config" />
<call target="put-connection-settings-into-defined-app-config" />
</target>
<target name="find-nunit">
<property name="tool.id" value="NUnit.Console" />
<call target="get-tool-info" />
<property name="nunit-console" value="${tools.dir}/NUnit.ConsoleRunner/${tool.version}/tools/nunit3-console.exe" />
</target>
<target name="run-tests" depends="find-nunit" description="Run NUnit tests">
<exec program="${nunit-console}" failonerror="${not property::exists(test.file + '.IgnoreFail')}">
<arg value="${root.dir}/src/${test.file}/bin/${build.config}/${target.dir}/${test.file}.dll" />
<arg value="--result=${testresults.dir}/${test.file}.dll-results.xml;format=nunit2" />
<arg value="--teamcity" if="${property::exists('config.teamcity')}" />
<arg value="--x86" unless="${property::exists('nunit-x64')}" />
</exec>
</target>
<target name="remove-connection-settings-from-app-config">
<property name="app.config" value="${root.dir}/src/${test.file}/bin/${build.config}/${target.dir}/${test.file}.dll.config" />
<xmlpoke
file="${app.config}"
xpath="/configuration/nhibernate/add[@key='hibernate.connection.connection_string']/@value"
value="conn string here"
/>
</target>
<target name="run-database-tests"
depends="put-connection-settings-into-app-config run-tests remove-connection-settings-from-app-config" />
<target name="test" depends="init build" description="Runs all NHibernate tests for the current framework" unless="${skip.tests}">
<property name="testfiles.all" value="NHibernate.TestDatabaseSetup NHibernate.Test NHibernate.Test.VisualBasic" />
<foreach item="String" in="${testfiles.all}" delim=" " property="test.file">
<call target="run-database-tests"/>
</foreach>
</target>
<target name="doc" depends="init binaries"
description="Builds the Help Documentation and the API documentation">
<nant buildfile="doc/documentation.build" target="api manual" />
</target>
<target name="reference" depends="init binaries" unless="${skip.manual}"
description="Builds Reference Manual">
<nant buildfile="doc/documentation.build" target="manual" />
</target>
<target name="reference-zip" depends="init binaries" unless="${skip.manual}"
description="Builds Reference Manual zip">
<nant buildfile="doc/documentation.build" target="manual-zip"/>
</target>
<target name="api" depends="init binaries"
description="Builds the API Documentation">
<nant buildfile="doc/documentation.build" target="api" />
</target>
<target name="binaries" depends="init">
<call target="build" />
</target>
<target name="sources-zip" depends="init">
<exec program="git" commandline="archive HEAD --format zip --output "${build.dir}/NHibernate-${project.version}-src.zip""/>
</target>
<target name="binaries-zip" depends="init bin-pack">
<zip zipfile="${build.dir}/NHibernate-${project.version}-bin.zip">
<fileset basedir="${bin-pack.tmpdir}">
<include name="**/*" />
</fileset>
</zip>
</target>
<target name="bin-pack" depends="init binaries">
<property name="bin-pack.tmpdir" value="${build.dir}/tmp-bin" />
<property name="bin-pack.conf-template" value="${bin-pack.tmpdir}/Configuration_Templates" />
<property name="bin-pack.required" value="${bin-pack.tmpdir}/Required_Bins" />
<property name="bin-pack.tests" value="${bin-pack.tmpdir}/Tests" />
<copy file="releasenotes.txt" todir="${bin-pack.tmpdir}"/>
<copy file="LICENSE.txt" todir="${bin-pack.tmpdir}"/>
<copy file="HowInstall.txt" todir="${bin-pack.tmpdir}"/>
<exec program="CScript.exe"
commandline="Tools\showdown\showdown.wsf README.md ${bin-pack.tmpdir}/readme.html"/>
<!--Configuration templates-->
<copy todir="${bin-pack.conf-template}">
<fileset basedir="${root.dir}/src/NHibernate.Config.Templates">
<include name="*"/>
</fileset>
</copy>
<!--Minimal Required Bins-->
<copy todir="${bin-pack.required}">
<fileset basedir="${root.dir}/src/NHibernate">
<include name="*.xsd" />
</fileset>
</copy>
<copy todir="${bin-pack.required}">
<fileset basedir="${root.dir}/src/NHibernate/bin/${build.config}/${target.dir}/">
<include name="Antlr3.Runtime.???" />
<include name="Iesi.Collections.???" />
<include name="NHibernate.???" />
<include name="Remotion.Linq.???" />
<include name="Remotion.Linq.EagerFetching.???" />
</fileset>
</copy>
<!-- Tests -->
<copy file="${root.dir}/src/NHibernate.Test/TestEmbeddedConfig.cfg.xml" todir="${bin-pack.tests}"/>
<copy file="${root.dir}/src/NHibernate.DomainModel/ABC.hbm.xml" todir="${bin-pack.tests}"/>
<copy todir="${bin-pack.tests}/DbScripts">
<fileset basedir="${root.dir}/src/NHibernate.Test/DbScripts">
<include name="*.sql" />
</fileset>
</copy>
<copy todir="${bin-pack.tests}">
<fileset basedir="${root.dir}/src/NHibernate.Test/bin/${build.config}/${target.dir}">
<include name="log4net*" />
<include name="NHibernate.DomainModel.*" />
<include name="NHibernate.Test.*" />
<include name="nunit*" />
</fileset>
</copy>
<copy todir="${bin-pack.tests}">
<fileset basedir="${root.dir}/src/NHibernate.Test.VisualBasic/bin/${build.config}/${target.dir}">
<include name="NHibernate.Test.VisualBasic.*" />
</fileset>
</copy>
<copy todir="${bin-pack.tests}">
<fileset basedir="${root.dir}/src/NHibernate.TestDatabaseSetup/bin/${build.config}/${target.dir}">
<include name="NHibernate.TestDatabaseSetup.*" />
</fileset>
</copy>
</target>
<target name="package" depends="init binaries test reference-zip sources-zip binaries-zip"
description="Creates files for the General Available Release on SourceForge">
<echo message="Created a '${project.config}' package in ${build.dir}" />
</target>
<target name="release" depends="init binaries binaries-zip sources-zip"
description="Creates files for the partial (Alpha-Beta-Candidate) Release on SourceForge">
<echo message="Created a '${project.config}' package in ${build.dir}" />
</target>
<target name="cleanall" description="Deletes every build configuration">
<echo message="Deleting all builds from all configurations" />
<delete dir="build" failonerror="false" />
</target>
<target name="clean" depends="init" description="Deletes current build">
<delete dir="${build.dir}" failonerror="false" />
</target>
<target name="gen-schema-classes" descripton="Generates schema classes from nhibernate-mapping.xsd">
<exec program="xsd.exe"
commandline="src\NHibernate\nhibernate-mapping.xsd /classes /fields /order /namespace:NHibernate.Cfg.MappingSchema /out:src\NHibernate\Cfg\MappingSchema\"/>
</target>
<target name="nugetpushbat" depends="init binaries nuget.set-properties"
description="Creates files for the release on nuget gallery.">
<echo message="rem In order to use this bat you have to be sure you have executed 'nuget SetApiKey' ${environment::newline()}" file="${nuget.nupackages.pushbatfile}" append="false"/>
<foreach item="File" property="filename">
<in>
<items>
<include name="${nuget.nupackages.dir}/*.nupkg"/>
</items>
</in>
<do>
<echo message="dotnet nuget push -s https://api.nuget.org/v3/index.json ${path::get-file-name(filename)} ${environment::newline()}" file="${nuget.nupackages.pushbatfile}" append="true"/>
</do>
</foreach>
</target>
<target name="nugetpush" depends="init binaries nuget.set-properties"
description="Push packages on nuget gallery.">
<!-- In order to use this task you have to be sure you have executed 'nuget SetApiKey' -->
<foreach item="File" property="filename">
<in>
<items>
<include name="${nuget.nupackages.dir}/*.nupkg"/>
</items>
</in>
<do>
<exec basedir="${tools.dir}" workingdir="${nuget.nupackages.dir}" program="dotnet">
<arg value="nuget" />
<arg value="push" />
<arg value="${filename}" />
</exec>
</do>
</foreach>
</target>
</project>