forked from nhibernate/nhibernate-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
common.xml
288 lines (236 loc) · 12.8 KB
/
common.xml
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
<?xml version="1.0" ?>
<project xmlns="http://nant.sf.net/release/0.85-rc3/nant.xsd">
<!--
Use this to determine if the key file NHibernate.snk should be used to
sign the assemblies. Defaults to true since private key is present
in CVS.
-->
<property name="sign" value="true" overwrite="false" />
<property name="key.file" value="${root.dir}/src/NHibernate.snk" />
<!-- Generating AssemblyInfo files for Visual Studio -->
<property name="visual-studio" value="false" overwrite="false" />
<if test="${visual-studio}">
<property name="key.file" value="../../${key.file}" />
</if>
<!--
if Visual Studio Help Integration Kit has been installed
then change this to true or include -D:vshik.installed=true in the command line.
It generates Visual Studio.NET 2003 documentation.
-->
<property name="vshik.installed" value="false" overwrite="false" />
<property name="vshik.path" value="${environment::get-folder-path('ProgramFiles')}/Microsoft Help 2.0 SDK" />
<!--
if nunit2report tasks from http://nunit2report.sourceforge.net/ has been installed
then change this to true. It generates a nice looking html report for the test files
-->
<property name="nunit2report.installed" value="false" overwrite="false" />
<property name="nant-version.current" value="${assemblyname::get-version(assembly::get-name(nant::get-assembly()))}" />
<property name="nant-version.required" value="0.91.4312.0" /> <!-- Nant 0.91 release version -->
<!--
Path to the folder that contain the external assemblies. For net-2.0 the values will
be lib, lib/net, and lib/net/2.0 respectively.
-->
<property name="lib.dir" value="lib" dynamic="true" />
<property name="lib.family.dir" value="${path::combine(lib.dir, framework::get-family(framework::get-target-framework()))}" dynamic="true" />
<property name="lib.framework.dir" value="${path::combine(lib.family.dir, version::to-string(framework::get-version()))}" dynamic="true" />
<!--
These are used to set the correct attributes in AssemblyInfo.cs.
-->
<property name="project.company" value="NHibernate.org" />
<!--
Version number computation
JBoss product versioning guidelines (http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossProductVersioning)
say we are supposed to use version numbers formatted like major.minor.patch.qualifier, where
qualifier is alphanumeric (Alpha#, Beta#, CR#, GA, SP#), and the numeric part may be anything, e.g.
a time/date stamp, a SVN revision number and so on.
I'm only going to use simple sequential numbers for now and the script below is used to translate
the alphanumeric version into a numeric assembly version: x.y.z.qN is translated into x.y.z.(base+N)
where base is 1000 for Alpha, 2000 for Beta, 3000 for CR, and 4000 for both GA and SP (so GA is
effectively SP0).
-->
<property name="project.version" value="4.0.3.GA" overwrite="false" />
<!-- This version number should be changed if, but only if, there are incompatible
changes compared to the previous version. -->
<property name="project.default-assembly-version" value="4.0.0.4000" overwrite="false" />
<!-- Compute short project version (major.minor) using a regex -->
<regex input="${project.version}" pattern="^(?'shortversion'\d+\.\d+)" />
<property name="project.version.short" value="${shortversion}" />
<!-- Compute and set project.version.numeric and project.version.nuget from project.version if it hasn't been set already -->
<if test="${not property::exists('project.version.numeric')}">
<script language="C#">
<references>
<include name="System.dll" />
</references>
<imports>
<import namespace="System.Text.RegularExpressions" />
</imports>
<code><![CDATA[
public const string VersionRegex = @"^(?<major>.+)\.{1}(?<minor>.+)\.{1}(?<build>.+)\.{1}(?<qualifier>Alpha|Beta|CR|GA|SP*)(?<qualifierNumber>\d*)$";
public static void ScriptMain(Project project)
{
string version = project.Properties["project.version"];
project.Properties["project.version.numeric"] = ToNumericVersion(version);
project.Properties["project.version.nuget"] = ToNuGetVersion(version);
}
public static string ToNuGetVersion(string version)
{
Match matches = Regex.Match(version, VersionRegex, RegexOptions.Singleline);
if (matches.Success == false) throw new BuildException("Unrecognised version number.");
if (matches.Groups.Count < 4) throw new BuildException("Unrecognised version number.");
string qualifier = matches.Groups["qualifier"].Value;
// For official releases we must use a completely numeric version.
// For pre-releases, the alphanumerics should be retained, to make Nuget
// understand it's a pre-release.
if (qualifier == "GA") return ToNumericVersion(version);
if (qualifier == "SP") return ToNumericVersion(version);
return String.Concat(
String.Join(".", new string[] { matches.Groups["major"].Value, matches.Groups["minor"].Value, matches.Groups["build"].Value }),
"-",
matches.Groups["qualifier"].Value,
matches.Groups["qualifierNumber"].Value);
}
public static string ToNumericVersion(string version)
{
const int BaseAlpha = 1000;
const int BaseBeta = 2000;
const int BaseCR = 3000;
const int BaseGA = 4000;
const int BaseSP = 4000; // SP is same as GA because GA has no number and SP's start with 1.
Match matches = Regex.Match(version, VersionRegex);
if (matches.Success == false) throw new BuildException("Unrecognised version number.");
if (matches.Groups.Count < 4) throw new BuildException("Unrecognised version number.");
string qualifier = matches.Groups["qualifier"].Value;
int qualifierNumber;
Int32.TryParse(matches.Groups["qualifierNumber"].Value, out qualifierNumber);
int revisionBase;
switch (qualifier)
{
case "Alpha": revisionBase = BaseAlpha; break;
case "Beta": revisionBase = BaseBeta; break;
case "CR": revisionBase = BaseCR; break;
case "GA": revisionBase = BaseGA; break;
case "SP": revisionBase = BaseSP; break;
default: throw new BuildException("Unknown version qualifier " + qualifier);
}
int revisionNumber = revisionBase + qualifierNumber;
return String.Join(".", new string[] {
matches.Groups["major"].Value,
matches.Groups["minor"].Value,
matches.Groups["build"].Value,
revisionNumber.ToString() });
}
]]></code>
</script>
</if>
<!-- debug|release -->
<property name="build.defines" value="" />
<!-- platform specific properties. These are the defaults -->
<property name="current.build.defines" value="${build.defines}" />
<!-- properties used to connect to database for testing -->
<include buildfile="nhibernate-properties.xml" />
<!-- named project configurations -->
<target name="set-debug-project-configuration" description="Perform a 'debug' build">
<property name="build.release" value="false" />
<property name="build.debug" value="true" />
<property name="build.name" value="NHibernate-${project.version}-${project.config}" />
</target>
<target name="set-release-project-configuration" description="Perform a 'release' build">
<property name="build.release" value="true" />
<property name="build.debug" value="pdbonly" />
<property name="build.name" value="NHibernate-${project.version}" />
</target>
<target name="set-project-configuration">
<property name="project.config" value="debug" overwrite="false" />
<if test="${not(target::exists('set-' + project.config + '-project-configuration'))}">
<fail message="Unknown configuration: '${project.config}'" />
</if>
<call target="set-${project.config}-project-configuration" />
<property name="build.root.dir" value="${root.dir}/build/${build.name}" />
<property name="build.dir" value="${build.root.dir}" />
<property name="bin.dir" value="${build.dir}/bin/${nant.settings.currentframework}" />
<property name="testresults.dir" value="${bin.dir}/test-results" />
<property name="tools.dir" value="${root.dir}/Tools"/>
</target>
<target name="set-framework-configuration">
<if test="${not(target::exists('set-'+framework::get-target-framework()+'-framework-configuration'))}">
<fail message="The '${framework::get-target-framework()}' framework is not supported by this version of NHibernate." />
</if>
<call target="set-${framework::get-target-framework()}-framework-configuration" />
</target>
<target name="set-net-4.0-framework-configuration">
<property name="nant.settings.currentframework" value="net-4.0" />
<property name="current.build.defines" value="${build.defines}NET,NET_2_0,NET_3_5,NET_4_0" />
<!-- not using SDK_v2_0 because ndoc throws an exception -->
<property name="link.sdkdoc.version" value="SDK_v1_1" />
<!-- merge should work with 4.0 when compiling for 4.0 -->
<property name="merge.targetplatform" value="v4" />
<property name="referenceassemblies.dir" value="${environment::get-folder-path('ProgramFiles')}\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0" />
</target>
<target name="set-net-3.5-framework-configuration">
<property name="nant.settings.currentframework" value="net-3.5" />
<property name="current.build.defines" value="${build.defines}NET,NET_2_0,NET_3_5" />
<!-- not using SDK_v2_0 because ndoc throws an exception -->
<property name="link.sdkdoc.version" value="SDK_v1_1" />
<!-- merge should work with 2.0 when compiling for 3.5 -->
<property name="merge.targetplatform" value="v2" />
<property name="referenceassemblies.dir" value="${environment::get-folder-path('ProgramFiles')}\Reference Assemblies\Microsoft\Framework\v3.5" />
</target>
<target name="set-net-2.0-framework-configuration">
<property name="nant.settings.currentframework" value="net-2.0" />
<property name="current.build.defines" value="${build.defines}NET,NET_2_0" />
<!-- not using SDK_v2_0 because ndoc throws an exception -->
<property name="link.sdkdoc.version" value="SDK_v1_1" />
<property name="merge.targetplatform" value="v2" />
</target>
<target name="set-mono-3.5-framework-configuration">
<property name="nant.settings.currentframework" value="mono-3.5" />
<property name="current.build.defines" value="${build.defines}NET,NET_2_0,NET_3_5,MONO" />
<!-- not using SDK_v2_0 because ndoc throws an exception -->
<property name="link.sdkdoc.version" value="SDK_v1_1" />
<!-- merge should work with 2.0 when compiling for 3.5 -->
<property name="merge.targetplatform" value="v2" />
</target>
<target name="set-mono-2.0-framework-configuration">
<property name="nant.settings.currentframework" value="mono-2.0" />
<property name="current.build.defines" value="${build.defines}NET,NET_2_0,MONO" />
<!-- not using SDK_v2_0 because ndoc throws an exception -->
<property name="link.sdkdoc.version" value="SDK_v1_1" />
<property name="merge.targetplatform" value="v2" />
</target>
<target name="display-current-runtime">
<echo message="" />
<echo message="----------------------------------------------------------" />
<echo message=" ${framework::get-description(framework::get-target-framework())}" />
<echo message="----------------------------------------------------------" />
<echo message="" />
<echo message="framework : ${framework::get-target-framework()}" />
<echo message="description : ${framework::get-description(framework::get-target-framework())}" />
<echo message="sdk directory : ${framework::get-sdk-directory(framework::get-target-framework())}" />
<echo message="framework directory : ${framework::get-framework-directory(framework::get-target-framework())}" />
<echo message="assembly directory : ${framework::get-assembly-directory(framework::get-target-framework())}" />
<echo message="runtime engine : ${framework::get-runtime-engine(framework::get-target-framework())}" />
<echo message="" />
</target>
<target name="common.init"
depends="set-framework-configuration set-project-configuration"
description="Initializes build properties">
<fileset id="project.sources" failonempty="true">
<include name="**/*.cs" />
</fileset>
<resourcefileset id="project.resources" />
</target>
<target name="common.find-nunit">
<property name="nunit-console" value="${tools.dir}/NUnit/nunit-console-x86.exe" />
</target>
<target name="common.find-ndoc">
<property name="ndoc-console" value="${tools.dir}/ndoc/NDocConsole.exe" />
</target>
<target name="nuget.set-properties">
<property name="nuget.nupackages.relative-dir" value="nuget_gallery" />
<!-- The nuget.workingdir is the directory from where all *.nuspec files will work.
This is to simplify the compilation of *.nuspec.template files (see section 'files')-->
<property name="nuget.workingdir" value="${build.dir}/tmp_nugetdeploy" />
<property name="nuget.nupackages.dir" value="${build.dir}/${nuget.nupackages.relative-dir}" />
<property name="nuget.nupackages.pushbatfile" value="${nuget.nupackages.dir}/NuGetPush.bat" />
</target>
</project>