2 <project name=
"<%= Name %>" default=
"build" xmlns=
"http://nant.sf.net/release/0.85/nant.xsd">
3 <!-- Directories, change these if you which to change project structure -->
4 <property name=
"dir.src.app" value=
"app" />
5 <property name=
"dir.src.test" value=
"test" />
6 <property name=
"dir.config" value=
"config" />
7 <property name=
"dir.bin" value=
"public/bin" />
8 <property name=
"dir.lib" value=
"lib" />
9 <property name=
"dir.lib.castle" value=
"${dir.lib}/castle" />
10 <property name=
"dir.lib.nunit" value=
"${dir.lib}/nunit" />
11 <property name=
"dir.lib.nant" value=
"${dir.lib}/nant" />
12 <property name=
"dir.lib.mysql" value=
"${dir.lib}/mysql/${framework::get-target-framework()}" />
13 <property name=
"dir.lib.npgsql" value=
"${dir.lib}/npgsql/${framework::get-target-framework()}" />
14 <property name=
"dir.lib.migrator" value=
"${dir.lib}/Migrator/${framework::get-target-framework()}" />
15 <property name=
"dir.db" value=
"db" />
16 <property name=
"dir.migrations" value=
"${dir.db}/migrations" />
19 Castle release properties. If you change one of these you should
20 run the setup target again to update the libs.
22 <property name=
"castle.version" value=
"<%= TargetFramework %>" />
23 <property name=
"castle.url" value=
"http://staticfiles.bantamtech.com/Castle-${castle.version}-rc2.zip" />
25 <loadtasks assembly=
"${dir.lib.nant}/NAnt.Contrib.Tasks.dll" />
27 <target name=
"clean" description=
"Delete all temp. files">
28 <delete dir=
"${dir.bin}" />
31 <target name=
"build" description=
"Compile all source files">
32 <mkdir dir=
"${dir.bin}" />
33 <copy flatten=
"true" todir=
"${dir.bin}">
35 <include name=
"${dir.lib.castle}/**" />
36 <include name=
"${dir.lib.npgsql}/**" />
37 <include name=
"${dir.lib.mysql}/**" />
38 <include name=
"${dir.lib.migrator}/**" />
39 <include name=
"${dir.lib.nunit}/nunit.framework.dll" />
42 <csc target=
"library" output=
"${dir.bin}/${project::get-name()}.dll">
44 <include name=
"${dir.config}/Boot.cs" />
45 <include name=
"${dir.src.app}/**/*.cs" />
46 <include name=
"${dir.src.test}/**/*.cs" />
47 <include name=
"${dir.migrations}/**/*.cs" />
49 <references basedir=
"${dir.bin}">
50 <include name=
"System.Web.dll" />
51 <include name=
"nunit.framework.dll" />
52 <include name=
"Castle.Core.dll" />
53 <include name=
"Castle.ActiveRecord.dll" />
54 <include name=
"Castle.MonoRail.Framework.dll" />
55 <include name=
"Castle.MonoRail.ActiveRecordScaffold.dll" />
56 <include name=
"Castle.MonoRail.ActiveRecordSupport.dll" />
57 <include name=
"Castle.MonoRail.Framework.Views.NVelocity.dll" />
58 <include name=
"Castle.Components.Common.EmailSender.dll" />
59 <include name=
"Castle.Components.Common.EmailSender.SmtpEmailSender.dll" />
60 <include name=
"Castle.MonoRail.TestSupport.dll" />
61 <include name=
"log4net.dll" />
62 <include name=
"NHibernate.dll" />
63 <include name=
"Nullables.NHibernate.dll" />
64 <include name=
"Nullables.dll" />
65 <include name=
"NVelocity.dll" />
66 <include name=
"MySql.Data.dll" />
67 <include name=
"Npgsql.dll" />
68 <include name=
"Migrator.dll" />
69 <!-- add other references here -->
74 <target name=
"rebuild" description=
"Clean and build" depends=
"clean, build" />
76 <target name=
"test" description=
"Runs all the tests" depends=
"build">
77 <nunit2 if=
"${platform::is-win32()}">
78 <formatter type=
"Plain" />
79 <test assemblyname=
"${dir.bin}/${project::get-name()}.dll" />
81 <exec program=
"nunit-console" if=
"${platform::is-unix()}">
82 <arg line=
"${dir.bin}/${project::get-name()}.dll /nologo" />
86 <target name=
"migrate" description=
"Migrate the database" depends=
"build">
87 <!-- get connection string -->
88 <property name=
"environment" value=
"development" overwrite=
"false" />
89 <property name=
"version" value=
"-1" overwrite=
"false" />
90 <property name=
"migration.output.dll" value=
"${dir.bin}/${project::get-name()}.dll" />
91 <xmlpeek file=
"${dir.config}/databases/${environment}.xml"
92 xpath=
"/activerecord/config/add[@key='hibernate.connection.connection_string']/@value"
93 property=
"connection.string" />
94 <xmlpeek file=
"${dir.config}/databases/${environment}.xml"
95 xpath=
"/activerecord/config/add[@key='hibernate.connection.driver_class']/@value"
96 property=
"driver.class" />
97 <property name=
"ext" value=
".bat" if=
"${platform::is-win32()}" />
98 <property name=
"ext" value=
"" overwrite=
"false" />
99 <!-- run migrations -->
100 <exec program=
"script/migrate${ext}">
101 <arg line='${driver.class}
"${connection.string}" "${migration.output.dll}" -version ${version}'
/>
105 <target name=
"setup" description=
"Setup the developement environment">
106 <!-- Installs castles -->
108 <get src=
"${castle.url}" dest=
"tmp/castle.zip" />
109 <unzip zipfile=
"tmp/castle.zip" todir=
"tmp/castle" />
110 <unzip zipfile=
"tmp/castle/bin/external-dependencies.zip" todir=
"tmp/castle/bin" />
112 <mkdir dir=
"${dir.lib.castle}" />
113 <copy todir=
"${dir.lib.castle}">
114 <fileset basedir=
"tmp/castle/bin">
115 <include name=
"**/*" />
116 <exclude name=
"external-dependencies.zip" />
121 <!-- Installs required libs in the GAC -->
122 <gac-install failonerror=
"false">
124 <include name=
"${dir.lib.castle}/Castle.MonoRail.TestSupport.dll" />
125 <include name=
"${dir.lib.mysql}/MySql.Data.dll" />