summaryrefslogtreecommitdiff
path: root/Assignment3.build
blob: f644b9b2da4d970e515d7c31e12935f81faa34c6 (plain)
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
<?xml version="1.0"?>
<project name="Sait.Cmpp298.Assignment3" default="all">
    <property name="debug" value="true" />
	
	<property name="base.dir" value="${project::get-base-directory()}"/>	
	<property name="build.dir" value="${base.dir}\build"/>
	<property name="deploy.dir" value="${base.dir}\deploy"/>
	<property name="tools.dir" value="${base.dir}\tools"/>
	<property name="lib.dir" value="${base.dir}\lib"/>
	<property name="config.dir" value="${base.dir}\config" />
	<property name="src.dir" value="${base.dir}\src"/>
	<property name="app.src.dir" value="${src.dir}\app"/>
	<property name="test.src.dir" value="${src.dir}\test"/>
	<property name="desktop.ui.dir" value="${app.src.dir}\Cmpp298.Assignment3.Desktop.UI"/>	

	<property name="assignment3.lib" value="assignment3.dll" />
	<property name="test.lib" value="assignment3.test.dll"/>
	<property name="assignment3.exe" value="${project::get-name()}.exe" />
	<property name="app.config" value="${config.dir}\app.config" />	
	
	<fileset id="test.references">
		<include name="${tools.dir}\mbunit\MbUnit.Framework.dll" />
		<include name="${tools.dir}\rhinomocks\Rhino.Mocks.dll" />
		<include name="${build.dir}\${assignment3.lib}"/>
	</fileset>

	<fileset id="app.source.files">
		<exclude name="${desktop.ui.dir}\**\*.cs" />
		<exclude name="${app.src.dir}\**\AssemblyInfo.cs" />
		<include name="${app.src.dir}\**\*.cs"/>
	</fileset>

	<fileset id="app.desktop.files">
		<include name="${desktop.ui.dir}\**\*.cs" />
	</fileset>

	<include buildfile="Assignment3.sql.build"/>
	<if test="${file::exists('local.properties.xml')}">
		<echo message="Loading local.properties.xml" />
		<include buildfile="local.properties.xml" />
	</if>
	
    <target name="all" depends="build.db" description="Builds database" />
	
	<target name="convert.template">
		<copy file="${target}.template" tofile="${target}" overwrite="true">
			<filterchain>
				<replacetokens>
					<token key="initial.catalog" value="${initial.catalog}" />
					<token key="sqlcmd.connectionstring" value="${sqlcmd.connectionstring}" />
					<token key="config.connectionstring" value="${config.connectionstring}" />
					<token key="database.provider" value="${database.provider}" />
					<token key="database.path" value="${database.path}" />
				</replacetokens>
			</filterchain>
		</copy>
	</target>

	<target name="clean">
		<delete dir="${build.dir}" />
		<delete dir="${deploy.dir}" />
	</target>

	<target name="init" depends="clean">
		<mkdir dir="${build.dir}"/>
		<mkdir dir="${deploy.dir}" />
	</target>
	
	<target name="compile" depends="init">
		<csc output="${compile.dir}\${assignment3.lib}" target="library" debug="${debug}">
			<sources refid="app.source.files" />
			<references refid="test.references" />
		</csc>
	</target>

	<target name="test.compile">
		<property name="target" value="${app.config}"/>
		<call target="convert.template"/>	
	
		<property name="compile.dir" value="${build.dir}" />
		<call target="compile"/>
		<csc output="${compile.dir}\${test.lib}" target="library" debug="${debug}">
			<sources>
				<include name="${test.src.dir}\**\*.cs"/>
				<exclude name="${test.src.dir}\**\AssemblyInfo.cs" />
			</sources>
			<references refid="test.references"/>
		</csc>
	</target>
	
	<target name="test" depends="test.compile">
		<copy file="${app.config}" tofile="${build.dir}\${test.lib}.config"/>

		<copy todir="${build.dir}" flatten="true">
			<fileset basedir="${tools.dir}\rhinomocks">
				<include name="**\Rhino.Mocks.dll" />
			</fileset>
		</copy>

		<copy todir="${build.dir}" flatten="true">
			<fileset basedir="${tools.dir}\mbunit">
				<include name="*.dll" />
			</fileset>			
		</copy>		
		
		<exec basedir="${tools.dir}\mbunit" 
			useruntimeengine="true" 
			workingdir="${build.dir}"
			program="mbunit.Cons.exe" 
			failonerror="false"
			commandline="${test.lib} /report-type:Text /rf:${build.dir} /rnf:Report" />		

		<call target="test.report"/>	
			
	</target>	
		
	<target name="test.report">	
			<exec basedir="${system.root}"
				program="notepad.exe"
				commandline="${build.dir}\Report.txt" />
	</target>			
		
	<target name="deploy" depends="init">
		<property name="target" value="${app.config}"/>
		<call target="convert.template"/>
		<copy file="${app.config}" tofile="${deploy.dir}\${assignment3.exe}.config"/>
	
		<csc output="${deploy.dir}\${assignment3.exe}" target="winexe" debug="false" optimize="true">
			<sources>	
				<exclude name="${app.src.dir}\**\AssemblyInfo.cs" />
				<include name="${app.src.dir}\**\*.cs"/>
				<exclude name="${desktop.ui.dir}\**\AssemblyInfo.cs" />
				<include name="${desktop.ui.dir}\**\*.cs" />
				<include name="${config.dir}\**\AssemblyInfo.cs"/>
			</sources>
			<resources dynamicprefix="true" prefix="HelloWorld">
				<include name="${desktop.ui.dir}\**\*.resx" />
			</resources>
		</csc>
	</target>

</project>