-
Notifications
You must be signed in to change notification settings - Fork 0
/
DbFriend.core.build
136 lines (117 loc) · 5.01 KB
/
DbFriend.core.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
<?xml version="1.0" ?>
<project name="DbFriend.core">
<property name="nant.settings.currentframework" value="net-3.5" />
<property name="SetupdbConfig.connectionstring" value="-E -S localhost"/>
<property name="base.dir" value="${project::get-base-directory()}" />
<property name="build.dir" value="${base.dir}\build" />
<property name="build.sql.dir" value="${build.dir}\db-setup"/>
<property name="db.timestamp" value="${build.sql.dir}\db.timestamp"/>
<property name="integration.db.needs.setup" value="false" />
<property name="build.dir.drop" value="${build.dir}\Debug" />
<property name="test-runner.exe" value="${base.dir}\tools\gallio\gallio.echo.exe" />
<fileset id="integration.db.creation.files">
<include name="${build.sql.dir}\CreateDB.sql" />
<include name="${build.sql.dir}\CreateUser.sql" />
</fileset>
<fileset id="integration.db.setup.shell.files">
<include name="${build.sql.dir}\0000001.sql" />
<include name="${build.sql.dir}\0000002.sql" />
<include name="${build.sql.dir}\0000003.sql" />
<include name="${build.sql.dir}\0000004.sql" />
<include name="${build.sql.dir}\0000005.sql" />
</fileset>
<!-- User targets -->
<target name="clean" description="Delete Automated Build artifacts">
<delete dir="${build.dir.drop}" if="${directory::exists(build.dir.drop)}"/>
</target>
<target name="compile" description="Compiles using the AutomatedDebug Configuration">
<msbuild project="src\DbFriend.sln">
<property name="Configuration" value="AutomatedDebug" />
</msbuild>
</target>
<target name="unittest" depends="compile, run-unit-tests"
description="Compile and Run UNIT Tests" />
<target name="test" depends="compile, run-tests"
description="Compile and Run Tests" />
<target name="full" depends="clean, test, dist" description="Compiles, tests, and produces distributions" />
<!-- Internal targets -->
<target name="run-unit-tests">
<property name="test-runner.exe.args" value='/wd:. /rd:${build.dir}\test-reports /rt:XHTML "DbFriend.Testing.Unit.dll"' />
<echo message="Args: [${test-runner.exe.args}]" />
<mkdir dir="${build.dir}\test-reports" />
<exec program="${test-runner.exe}" workingdir="${build.dir.drop}\Testing.Unit">
<arg line="${test-runner.exe.args}"/>
</exec>
</target>
<target name="run-tests" depends="setup.integration.db">
<property name="test-runner.exe.args" value='/wd:. /rd:${build.dir}\test-reports /re:TeamCityExtension,Gallio.TeamCityIntegration /rt:XML "DbFriend.Testing.Unit.dll" "DbFriend.Testing.Integration.dll"' />
<echo message="Args: [${test-runner.exe.args}]" />
<mkdir dir="${build.dir}\test-reports" />
<exec program="${test-runner.exe}" workingdir="${build.dir.drop}\Testing.Integration">
<arg line="${test-runner.exe.args}"/>
</exec>
</target>
<target name="dist">
<echo message="Copying files from [${build.dir.drop}\DbFriend.Shell] to [${build.dir}\dist]" />
<copy todir="${build.dir}\dist">
<fileset basedir="${build.dir.drop}\DbFriend.Shell">
<include name="**\*"/>
<exclude name="**\*.pdb" />
</fileset>
</copy>
<zip zipfile="${build.dir}\DbFriend.zip">
<fileset basedir="${build.dir}\dist">
<include name="**\*" />
</fileset>
</zip>
</target>
<target name="setup.integration.db" depends="check.integration.db.needs.setup">
<if test="${integration.db.needs.setup}">
<echo message="Running integration DB setup"/>
<call target="_build.db" cascade="false" />
</if>
<touch file="${db.timestamp}" />
</target>
<target name="check.integration.db.needs.setup">
<echo message="Checking if IntegrationDB needs to be setup"/>
<property name="integration.db.needs.setup" value="false" />
<uptodate property="integration.db.needs.setup">
<sourcefiles>
<include name="${db.timestamp}" />
</sourcefiles>
<targetfiles>
<include name="${build.sql.dir}\*.sql"/>
</targetfiles>
</uptodate>
</target>
<target name="_build.db">
<foreach item="File" property="target">
<in>
<items refid="integration.db.creation.files"/>
</in>
<do>
<call target="run.sql.file.nodb" />
</do>
</foreach>
<foreach item="File" property="target">
<in>
<items refid="integration.db.setup.shell.files"/>
</in>
<do>
<call target="run.sql.file" />
</do>
</foreach>
</target>
<target name="run.sql.file.nodb">
<echo message="Executing ${target}" />
<exec program="${osql.exe}"
workingdir="${build.sql.dir}"
commandline='${SetupdbConfig.connectionstring} -n -b -i "${target}"' />
</target>
<target name="run.sql.file">
<echo message="Executing ${target}" />
<exec program="${osql.exe}"
workingdir="${build.sql.dir}"
commandline='${SetupdbConfig.connectionstring} -n -d dbFriend_IntegrationTest -b -i "${target}"' />
</target>
</project>