forked from migratordotnet/Migrator.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
/
default.build
263 lines (235 loc) · 11.2 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
<?xml version="1.0" encoding="utf-8" ?>
<project name="migrator" default="build" xmlns="http://nant.sf.net/release/0.85/nant.xsd">
<property name="dotnet" value="true" if="${framework::get-target-framework() == 'net-2.0' or framework::get-target-framework() == 'net-3.5'}"/>
<property name="mono" value="true" if="${framework::get-target-framework() == 'mono-2.0'}"/>
<property name="defines" value="DOTNET2" if="${property::exists('dotnet')}" />
<property name="defines" value="MONO2" if="${property::exists('mono')}" />
<property name="version" value="0.8"/>
<property name="debug" value="true" />
<!-- Paths to various parts of the build -->
<property name="dir.bin" value="build" />
<property name="dir.lib" value="lib" />
<property name="dir.results" value="results"/>
<property name="dir.zip" value="${dir.bin}/zip" />
<property name="dir.src" value="src"/>
<property name="dir.config" value="${dir.src}/config" />
<property name="dir.tests" value="${dir.src}/Migrator.Tests" />
<property name="dir.msbuild" value="${dir.src}/Migrator.MSBuild" />
<property name="dir.nant" value="${dir.src}/Migrator.NAnt" />
<property name="dir.framework" value="${dir.src}/Migrator.Framework" />
<property name="dir.providers" value="${dir.src}/Migrator.Providers" />
<property name="dir.core" value="${dir.src}/Migrator" />
<property name="dir.console" value="${dir.src}/Migrator.Console" />
<property name="dir.tools.ncover" value="${dir.lib}/NCover" />
<property name="dir.tools.nunit" value="${dir.lib}/NUnit" />
<property name="dir.lib.postgre" value="${dir.lib}/Npgsql/${framework::get-target-framework()}" />
<property name="dir.keyfile" value="${dir.src}/MigratorDotNet.snk" />
<property name="test.project.name" value="Migrator.Tests"/>
<!-- Test related properties -->
<!-- To exclude tests, provide a comma separated set of exclude categories in your local.properties e.g. Oracle,SqlServer,Postgre -->
<property name="tests.exclude" value=""/>
<property name="tests.app.config" value="${dir.config}/app.config"/>
<!-- Overrideable. Add your own values to a file called local.properties to have them override any above properties -->
<include buildfile="local.properties" failonerror="false"/>
<!-- load the NCover NAnt tasks -->
<loadtasks assembly="${dir.tools.ncover}/Explorer/NCoverExplorer.NAntTasks.dll" />
<!--
Once we setup to build from sln, we can specify build config to target
which is ideal to output release assemblies over debug. the debug, release
targets are not used at the moment
<target name="debug">
<property name="build.config" value="Debug" />
<call target="build" />
</target>
<target name="release">
<property name="build.config" value="Release" />
<call target="build.common" />
</target>
-->
<target name="build" description="Builds the app" depends="prepare">
<csc target="library" output="${dir.bin}/Migrator.Framework.dll" define="${defines}" debug="${debug}" keyfile="${dir.keyfile}">
<sources>
<include name="${dir.config}/AssemblyInfo.cs" />
<include name="${dir.framework}/**/*.cs" />
</sources>
<references>
<include name="System.dll" />
<include name="System.Data.dll" />
</references>
</csc>
<csc target="library" output="${dir.bin}/Migrator.Providers.dll" define="${defines}" debug="${debug}" keyfile="${dir.keyfile}">
<sources>
<include name="${dir.config}/AssemblyInfo.cs" />
<include name="${dir.providers}/**/*.cs" />
</sources>
<references>
<include name="System.dll" />
<include name="System.Data.dll" />
<include name="Mono.Data.Sqlite.dll" if="${property::exists('mono')}"/>
<include name="${dir.bin}/System.Data.SQLite.DLL" if="${property::exists('dotnet')}"/>
<include name="${dir.bin}/Migrator.Framework.dll" />
<include name="${dir.bin}/MySql.Data.dll" />
<include name="${dir.bin}/Npgsql.dll" />
<include name="${dir.lib}/Oracle.DataAccess.dll" />
<include name="${dir.lib}/System.Data.SqlServerCe.dll" />
</references>
</csc>
<csc target="library" output="${dir.bin}/Migrator.dll" define="${defines}" debug="${debug}" keyfile="${dir.keyfile}">
<sources>
<include name="${dir.config}/AssemblyInfo.cs" />
<include name="${dir.core}/**/*.cs" />
</sources>
<references>
<include name="System.dll" />
<include name="System.Data.dll" />
<include name="System.Configuration.dll" />
<include name="${dir.bin}/Migrator.Framework.dll" />
<include name="${dir.bin}/Migrator.Providers.dll" />
</references>
</csc>
<csc target="library" output="${dir.bin}/Migrator.NAnt.dll" define="${defines}" debug="${debug}">
<sources>
<include name="${dir.config}/AssemblyInfo.cs" />
<include name="${dir.nant}/**/*.cs" />
</sources>
<references>
<include name="System.dll" />
<include name="${dir.bin}/NAnt.Core.dll" />
<include name="${dir.bin}/Migrator.Framework.dll" />
<include name="${dir.bin}/Migrator.dll" />
</references>
</csc>
<csc target="library" output="${dir.bin}/Migrator.MSBuild.dll" define="${defines}" debug="${debug}" if="${framework::get-target-framework() == 'net-2.0'}" keyfile="${dir.keyfile}">
<sources>
<include name="${dir.config}/AssemblyInfo.cs" />
<include name="${dir.msbuild}/**/*.cs" />
</sources>
<references>
<include name="System.dll" />
<include name="Microsoft.Build.Framework.dll" />
<include name="Microsoft.Build.Utilities.dll" />
<include name="${dir.bin}/Migrator.Framework.dll" />
<include name="${dir.bin}/Migrator.dll" />
</references>
</csc>
<csc target="exe" output="${dir.bin}/Migrator.Console.exe" define="${defines}" debug="${debug}" keyfile="${dir.keyfile}">
<sources>
<include name="${dir.config}/AssemblyInfo.cs" />
<include name="${dir.console}/**/*.cs" />
</sources>
<references>
<include name="System.dll" />
<include name="${dir.bin}/Migrator.Framework.dll" />
<include name="${dir.bin}/Migrator.dll" />
</references>
</csc>
</target>
<target name="rebuild" description="Rebuilds the app from scratch" depends="clean, build" />
<target name="build.tests" description="Builds the tests" depends="build, prepare.tests">
<copy file="${tests.app.config}" tofile="${dir.bin}/${test.project.name}.dll.config" />
<csc target="library" output="${dir.bin}/${test.project.name}.dll" define="${defines}" debug="${debug}">
<sources>
<include name="${dir.tests}/**/*.cs" />
</sources>
<references>
<include name="System.dll" />
<include name="System.Data.dll" />
<include name="System.Configuration.dll" />
<include name="${dir.lib}/System.Data.SqlServerCe.dll" />
<include name="${dir.bin}/Migrator.Framework.dll" />
<include name="${dir.bin}/Migrator.dll" />
<include name="${dir.bin}/Migrator.Providers.dll" />
<include name="${dir.tools.nunit}/nunit.mocks.dll" />
<include name="${dir.tools.nunit}/nunit.framework.dll" />
</references>
</csc>
</target>
<target name="prepare">
<mkdir dir="${dir.bin}" />
<copy file="${dir.msbuild}/Migrator.Targets" todir="${dir.bin}" />
<copy todir="${dir.bin}" flatten="true">
<fileset>
<include name="${dir.lib}/NAnt.Core.dll" />
<include name="${dir.lib}/log4net.dll" />
<include name="${dir.lib}/MySql.Data.dll" />
<include name="${dir.lib}/System.Data.SQLite.DLL" />
<include name="${dir.lib.postgre}/Npgsql.dll" />
<include name="${dir.lib.postgre}/Mono.Security.dll" />
<include name="${dir.lib}/Oracle.DataAccess.dll" />
<include name="${dir.lib}/System.Data.SqlServerCe.dll" />
</fileset>
</copy>
</target>
<target name="prepare.tests">
<mkdir dir="${dir.bin}" />
<mkdir dir="${dir.results}"/>
<copy todir="${dir.bin}" flatten="true">
<fileset>
<include name="${dir.tools.nunit}/nunit.mocks.dll" />
<include name="${dir.tools.nunit}/nunit.framework.dll" />
</fileset>
</copy>
</target>
<target name="clean" description="Sweep it yeah!">
<delete dir="${dir.bin}"/>
<delete dir="${dir.results}"/>
</target>
<target name="test" description="Run tests" depends="build.tests">
<nunit2>
<formatter type="Plain" />
<test
assemblyname="${dir.bin}/Migrator.Tests.dll"
appconfig="${tests.app.config}">
<categories>
<exclude name="${tests.exclude}"/>
</categories>
</test>
</nunit2>
</target>
<target name="test.coverage" description="Run the tests with code coverage. Only works on Windows/.NET" depends="build.tests">
<ncover program="${dir.tools.ncover}/NCover.Console.exe"
commandLineExe="${dir.tools.nunit}/nunit-console.exe"
commandLineArgs="${dir.bin}/${test.project.name}.dll /exclude=${tests.exclude} /labels /nologo /noshadow"
coverageFile="${dir.results}/coverage.xml"
logFile="${dir.results}/coverage.log">
<assemblies basedir="${dir.bin}">
<include name="Migrator.*.dll" />
<include name="Migrator.dll" />
<exclude name="*.Tests.dll" />
</assemblies>
</ncover>
<ncoverexplorer program="${dir.tools.ncover}/Explorer/NCoverExplorer.Console.exe"
projectName="Migrator"
outputDir="${dir.results}"
satisfactoryCoverage="80"
reportType="ModuleClassFunctionSummary"
htmlReportName="CoverageSummary.html"
showExcluded="True">
<fileset>
<include name="${dir.results}/coverage.xml" />
</fileset>
</ncoverexplorer>
</target>
<target name="zip" description="Creates a zip file of the entire project including examples, source and docs" depends="build">
<mkdir dir="${dir.zip}" />
<property name="zipcontainer" value="${dir.zip}/migratordotnet-${version}"/>
<mkdir dir="${zipcontainer}" />
<mkdir dir="${zipcontainer}/lib" />
<copy todir="${zipcontainer}/lib">
<fileset basedir="${dir.bin}">
<include name="**/*" />
</fileset>
</copy>
<copy todir="${zipcontainer}">
<fileset>
<include name="doc/**/*" />
</fileset>
</copy>
<zip zipfile="migratordotnet-${version}.zip">
<fileset basedir="${dir.zip}">
<include name="**/*" />
</fileset>
</zip>
<delete dir="${dir.zip}"/>
</target>
</project>