-
Notifications
You must be signed in to change notification settings - Fork 141
/
GitSharp.build
286 lines (226 loc) · 10.8 KB
/
GitSharp.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
<?xml version="1.0"?>
<project name="GitSharp" default="run-tests">
<property name="build.config" value="debug" overwrite="false" />
<property name="build.platform" value="${nant.settings.currentframework}" />
<property name="build.defines" value="TRACE;LINQ;DEBUG" />
<property name="build.runs.on.mono" value="${(framework::get-family(framework::get-runtime-framework()) == 'mono')}" />
<property name="path.base" value="${project::get-base-directory()}"/>
<property name="path.build" value="${path.base}/build"/>
<property name="path.lib" value="${path.base}/lib"/>
<property name="path.dist" value="${path.base}/dist"/>
<property name="path.tools" value="${path.base}/tools"/>
<property name="path.tools.nunit" value="${path.tools}/nunit"/>
<!-- Revision version detection. If build.vcs.number hasn't been passed through command line argument, version revision is set to 'local-build' -->
<property name="build.vcs.number.1" value="" overwrite="false"/>
<property name="version.revision" value="local-build" />
<if test="${(string::get-length(build.vcs.number.1) != 0)}">
<property name="version.revision" value="${build.vcs.number.1}" />
</if>
<property name="version.major" value="${version::get-major(version::parse(version))}" dynamic="true"/>
<property name="version.minor" value="${version::get-minor(version::parse(version))}" dynamic="true"/>
<property name="version.build" value="${version::get-build(version::parse(version))}" dynamic="true"/>
<property name="build.version" value="${version.major}.${version.minor}.${version.build}.${version.revision}" dynamic="true"/>
<target name="rebuild" depends="clean, run-tests"/>
<target name="clean">
<delete dir="${path.build}" if="${directory::exists(path.build)}"/>
<delete dir="${path.dist}" if="${directory::exists(path.dist)}"/>
</target>
<target name="dist" depends="run-tests, package"/>
<!-- ********************************************** -->
<!-- GitSharp.Core.dll -->
<!-- ********************************************** -->
<target name="compile-core" depends="init">
<property name="assembly.name" value="GitSharp.Core" />
<property name="assembly.type" value="library" />
<property name="project.directory" value="${assembly.name}" />
<property name="assembly.namespace" value="${assembly.name}" />
<fileset id="project.references" >
<include name="System.dll" />
<include name="System.Core.dll" />
<include name="System.Xml.dll" />
<include name="${path.lib}/ICSharpCode.SharpZipLib.dll" />
<include name="${path.lib}/Winterdom.IO.FileMap.dll" />
<include name="${path.lib}/Tamir.SharpSSH.dll" />
</fileset>
<call target="compile-dll" />
</target>
<!-- ********************************************** -->
<!-- git.exe -->
<!-- ********************************************** -->
<target name="compile-cli" depends="compile-gitsharp">
<property name="assembly.name" value="GitSharp.Git" />
<property name="assembly.type" value="exe" />
<property name="project.directory" value="Git" />
<property name="assembly.namespace" value="GitSharp.CLI" />
<fileset id="project.references" basedir="${path.build.output}" >
<include name="GitSharp.dll" />
<include name="GitSharp.Core.dll" />
</fileset>
<copy todir="${path.build.output}">
<fileset basedir="${path.base}/Git">
<include name="Commands.xml" />
</fileset>
</copy>
<call target="compile-dll" />
</target>
<!-- ********************************************** -->
<!-- GitSharp.dll -->
<!-- ********************************************** -->
<target name="compile-gitsharp" depends="compile-core">
<property name="assembly.name" value="GitSharp" />
<property name="assembly.type" value="library" />
<property name="project.directory" value="${assembly.name}" />
<property name="assembly.namespace" value="${assembly.name}" />
<fileset id="project.references" basedir="${path.build.output}" >
<include name="System.dll" />
<include name="System.Core.dll" />
<include name="GitSharp.Core.dll" />
<include name="${path.lib}/Tamir.SharpSSH.dll" />
</fileset>
<call target="compile-dll" />
</target>
<!-- ********************************************** -->
<!-- GitSharp.Tests.dll -->
<!-- ********************************************** -->
<target name="compile-tests" depends="compile-cli">
<property name="assembly.name" value="GitSharp.Tests" />
<property name="assembly.type" value="library" />
<property name="project.directory" value="${assembly.name}" />
<property name="assembly.namespace" value="${assembly.name}" />
<fileset id="project.references" >
<include name="${path.build.output}/GitSharp.dll" />
<include name="${path.build.output}/GitSharp.Core.dll" />
<include name="${path.build.output}/GitSharp.Git.exe" />
<include name="${path.tools.nunit}/nunit.framework.dll" />
</fileset>
<call target="compile-dll" />
</target>
<!-- ********************************************** -->
<!-- run tests -->
<!-- ********************************************** -->
<target name="run-tests" depends="compile-tests">
<property name="path.testresults" value="${path.build}/${build.platform}-${build.config}/test-results" />
<mkdir dir="${path.testresults}" if="${not(directory::exists(path.testresults))}"/>
<echo message="path.testresults = ${path.testresults}"/>
<copy todir="${path.testresults}">
<fileset basedir="${path.base}/GitSharp.Tests/Resources">
<include name="${path.build.output}/*.dll" />
<include name="${path.build.output}/GitSharp.Git.exe" />
</fileset>
</copy>
<copy todir="${path.testresults}/Resources">
<fileset basedir="${path.base}/GitSharp.Tests/Resources">
<include name="**" />
</fileset>
</copy>
<property name="nunit.consolerunner" value="${path.tools.nunit}/nunit-console.exe" />
<property name="nunit.commandline" value="GitSharp.Tests.dll /xml:GitSharp.Tests.dll-results.xml /noshadow " />
<if test="${build.runs.on.mono}">
<property name="nunit.consolerunner" value="nunit-console2" />
<property name="nunit.commandline" value="GitSharp.Tests.dll -xml:GitSharp.Tests.dll-results.xml -noshadow " />
</if>
<exec verbose="true"
program="${nunit.consolerunner}"
workingdir="${path.testresults}"
commandline="${nunit.commandline}"
failonerror="true"
/>
<property name="debugger.file.path.before" value="${path.build.output}/GitSharp.Git.pdb" />
<property name="debugger.file.path.after" value="${path.build.output}/Git.pdb" />
<property name="debugger.file.path.before" value="${path.build.output}/GitSharp.Git.exe.mdb" if="${build.runs.on.mono}" />
<property name="debugger.file.path.after" value="${path.build.output}/Git.exe.mdb" if="${build.runs.on.mono}" />
<move file="${path.build.output}/GitSharp.Git.exe" tofile="${path.build.output}/Git.exe" />
<move file="${debugger.file.path.before}" tofile="${debugger.file.path.after}" />
<move file="${path.build.output}/GitSharp.Git.xml" tofile="${path.build.output}/Git.xml" />
</target>
<target name="init">
<loadfile file="version.txt" property="version" />
<mkdir dir="${path.build}" if="${not(directory::exists(path.build))}"/>
<property name="path.build.output" value="${path.build}/${build.platform}-${build.config}/bin"/>
<echo message="build.version = ${build.version}"/>
<echo message="path.build.output = ${path.build.output}"/>
<mkdir dir="${path.build.output}" if="${not(directory::exists(path.build.output))}"/>
<call target="set-${build.config}-project-configuration" />
</target>
<target name="package">
<mkdir dir="${path.dist}" if="${not(directory::exists(path.dist))}"/>
<copy todir="${path.build.output}">
<fileset>
<include name="${path.base}/*.txt" />
<exclude name="${path.base}/version.txt" />
</fileset>
</copy>
<zip zipfile="${path.dist}/GitSharp-${build.version}-${build.config}-${build.platform}.zip" ziplevel="9">
<fileset basedir="${path.build.output}">
<include name="*.*"/>
</fileset>
</zip>
</target>
<target name="set-debug-project-configuration" >
<property name="build.optimize" value="false" />
</target>
<target name="set-release-project-configuration" >
<property name="build.optimize" value="true" />
<property name="build.defines" value="LINQ;TRACE" />
</target>
<target name="compile-dll">
<call target="copy-references"/>
<property name="project.sources.path" value="${path.base}/${project.directory}"/>
<call target="create-assembly-info"/>
<fileset id="project.sources" failonempty="true">
<include name="${project.sources.path}/**/*.cs" />
</fileset>
<property name="assembly.extension" value="dll" />
<property name="assembly.extension" value="exe" if="${assembly.type == 'exe'}" />
<csc target="${assembly.type}"
debug="Full"
define="${build.defines}"
optimize="${build.optimize}"
output="${path.build.output}/${assembly.name}.${assembly.extension}"
doc="${path.build.output}/${assembly.name}.xml" >
<sources refid="project.sources" />
<references refid="project.references" />
<resources prefix="${assembly.namespace}.Resources.">
<include name="${project.sources.path}/Resources/*.*"/>
</resources>
<nowarn>
<!-- No warning when public members lack XML comments -->
<warning number="1591" />
</nowarn>
</csc>
<call target="cleanup-assembly-info"/>
</target>
<target name="cleanup-assembly-info">
<delete file="${project.sources.path}/SharedAssemblyInfo.cs" />
<delete file="${project.sources.path}/VersionAssemblyInfo.cs" />
</target>
<target name="create-assembly-info">
<copy todir="${project.sources.path}">
<fileset>
<include name="${path.base}/SharedAssemblyInfo.cs" />
</fileset>
</copy>
<asminfo output="${project.sources.path}/VersionAssemblyInfo.cs" language="CSharp">
<imports>
<import namespace="System"/>
<import namespace="System.Reflection"/>
<import namespace="System.Runtime.InteropServices"/>
</imports>
<attributes>
<attribute type="AssemblyVersionAttribute" value="${version}"/>
<attribute type="AssemblyProductAttribute" value="GitSharp [${version.revision}]"/>
</attributes>
</asminfo>
</target>
<target name="copy-references">
<foreach item="File" property="reference">
<in>
<items refid="project.references" />
</in>
<do>
<echo message="reference = ${reference}"/>
<copy file="${reference}" todir="${path.build.output}" />
</do>
</foreach>
</target>
</project>