forked from markov1ivan/NHibernate.Caches
-
Notifications
You must be signed in to change notification settings - Fork 1
/
buildcommon.xml
140 lines (115 loc) · 5.92 KB
/
buildcommon.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
<?xml version="1.0" ?>
<project xmlns="http://nant.sf.net/release/0.85/nant.xsd">
<property name="framework.family" value="${framework::get-family(framework::get-target-framework())}"/>
<property name="framework.version" value="${framework::get-version(framework::get-target-framework())}"/>
<property name="folders.lib" value="../Lib/${framework.family}/${framework.version}" />
<property name="key.file" value="../NHibernate.Caches.snk" />
<property name="nant-version.current" value="${assemblyname::get-version(assembly::get-name(nant::get-assembly()))}" />
<property name="nant-version.required" value="0.85.2478.0" />
<!-- Nant 0.85 release version -->
<property name="nant-version.beta1_086" value="0.86.2898.0" />
<!-- Nant 0.86 Beta 1 -->
<!--
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" />
<if test="${nant-version.current != nant-version.beta1_086 or framework::get-target-framework() != 'net-3.5'}">
<property name="lib.framework.dir" value="${path::combine(lib.family.dir, version::to-string(framework::get-version(framework::get-target-framework())))}" dynamic="true" />
</if>
<!--
These are used to set the correct attributes in AssemblyInfo.cs.
-->
<property name="project.company" value="nhforge.org" />
<property name="project.version" value="3.3.3" 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 from project.version if it hasn't been set already -->
<if test="${not property::exists('project.version.numeric')}">
<script language="C#">
<code>
<![CDATA[
public const int BaseAlpha = 1000;
public const int BaseBeta = 2000;
public const int BaseCR = 3000;
public const int BaseGA = 4000;
// SP is same as GA because GA has no number and SP's start with 1.
public const int BaseSP = 4000;
public static void ScriptMain(Project project)
{
project.Properties["project.version.numeric"] = ToNumericVersion(
project.Properties["project.version"]);
}
public static string ToNumericVersion(string version)
{
int qualifierStart = version.LastIndexOf('.') + 1;
int qualifierNumberStart = version.IndexOfAny(
"0123456789".ToCharArray(),
qualifierStart);
if (qualifierNumberStart < 0) qualifierNumberStart = version.Length;
string qualifier = version.Substring(qualifierStart, qualifierNumberStart - qualifierStart);
int qualifierNumber = qualifierNumberStart < version.Length
? int.Parse(version.Substring(qualifierNumberStart))
: 0;
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);
}
string revisionNumber = (revisionBase + qualifierNumber).ToString();
return version.Substring(0, qualifierStart) + revisionNumber;
}
]]>
</code>
</script>
</if>
<!-- 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-Caches-${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-Caches-${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}" />
</target>
<target name="init" depends="set-project-configuration">
<property name="folders.build" value="${bin.dir}" />
<mkdir dir="${folders.build}"/>
</target>
<target name="copy-common-reference" depends="init">
<copy todir="${folders.build}" flatten="true">
<fileset>
<include name="${folders.lib}/NHibernate.dll" />
<include name="${folders.lib}/Iesi.Collections.dll" />
<include name="${folders.lib}/log4net.dll" />
<include name="${folders.lib}/nunit.framework.dll" />
</fileset>
</copy>
</target>
<target name="bin-pack-common">
<property name="bin-pack.tmpdir" value="${build.dir}/tmp-bin" />
<property name="bin-pack.project.deploy" value="${bin-pack.tmpdir}/${bin-pack.project.name}" />
<mkdir dir="${bin-pack.project.deploy}"/>
<copy file="${root.dir}/NHibernate.Caches.snk" todir="${bin-pack.project.deploy}"/>
<copy file="${folders.build}/NHibernate.Caches.${bin-pack.project.name}.dll" todir="${bin-pack.project.deploy}"/>
</target>
</project>