[1146] | 1 | <?xml version="1.0"?>
|
---|
| 2 | <project>
|
---|
| 3 |
|
---|
| 4 | <property name="project.base" value="${project::get-base-directory()}" />
|
---|
| 5 |
|
---|
| 6 | <property name="samples.base" value="${path::get-full-path('../..')}" />
|
---|
| 7 | <!-- Duplicate the following if more levels are added -->te
|
---|
| 8 | <property name="samples.base" value="${path::get-full-path('../../..')}"
|
---|
| 9 | unless="${path::get-file-name(samples.base)=='samples'}" />
|
---|
| 10 |
|
---|
| 11 | <property name="output.dir" value="${samples.base}/bin" />
|
---|
| 12 |
|
---|
| 13 | <property name="nunit.bin.dir"
|
---|
| 14 | value="${path::combine(path::get-directory-name(samples.base), 'bin')}" />
|
---|
| 15 | <property name="nunit.framework.dll"
|
---|
| 16 | value="${path::combine(nunit.bin.dir,'net-1.1/framework/nunit.framework.dll')}" />
|
---|
| 17 | <property name="nunit.core.dll"
|
---|
| 18 | value="${path::combine(nunit.bin.dir,'net-1.1/nunit.core.dll')}" />
|
---|
| 19 | <property name="nunit.core.interfaces.dll"
|
---|
| 20 | value="${path::combine(nunit.bin.dir,'net-1.1/nunit.core.interfaces.dll')}" />
|
---|
| 21 |
|
---|
| 22 | <property name="sample" value="${project::get-name()}"
|
---|
| 23 | unless="${property::exists('sample')}"/>
|
---|
| 24 | <property name="sample.dll" value="${sample}.dll" />
|
---|
| 25 |
|
---|
| 26 | <property name="sample.type"
|
---|
| 27 | value="${path::get-file-name(path::get-directory-name(project.base))}" />
|
---|
| 28 | <property name="sample.type" value="addin" if="${sample.type=='Core'}" />
|
---|
| 29 |
|
---|
| 30 | <if test="${directory::exists(path::combine(project.base, 'Tests'))}" >
|
---|
| 31 | <property name="tests" value="${sample}Tests"
|
---|
| 32 | unless="${property::exists('tests')}" />
|
---|
| 33 | <property name="test.dll" value="${tests}.dll" />
|
---|
| 34 | </if>
|
---|
| 35 |
|
---|
| 36 | <property name="nunit.build" value="false"
|
---|
| 37 | unless="${property::exists('project.package.dir')}"/>
|
---|
| 38 | <property name="nunit.build" value="true"
|
---|
| 39 | if="${property::exists('project.package.dir')}"/>
|
---|
| 40 |
|
---|
| 41 | <property name="build.debug" value="true"
|
---|
| 42 | unless="${property::exists('build.debug')}" />
|
---|
| 43 | <property name="build.config" value="Debug"
|
---|
| 44 | if="${build.debug}" />
|
---|
| 45 | <property name="build.config" value="Release"
|
---|
| 46 | unless="${build.debug}" />
|
---|
| 47 |
|
---|
| 48 |
|
---|
| 49 | <target name="clean" description="Remove files created by build">
|
---|
| 50 |
|
---|
| 51 | <delete file="${output.dir}/${sample.dll}" />
|
---|
| 52 | <delete file="${output.dir}/${sample}.pdb" />
|
---|
| 53 |
|
---|
| 54 | <if test="${property::exists('test.dll')}">
|
---|
| 55 | <delete file="${output.dir}/${test.dll}" />
|
---|
| 56 | <delete file="${output.dir}/${path::change-extension(test.dll, '.pdb')}" />
|
---|
| 57 | </if>
|
---|
| 58 |
|
---|
| 59 | </target>
|
---|
| 60 |
|
---|
| 61 | <target name="init">
|
---|
| 62 |
|
---|
| 63 | <mkdir dir="${output.dir}" unless="${directory::exists(output.dir)}" />
|
---|
| 64 |
|
---|
| 65 | <copy file="${nunit.framework.dll}" todir="${output.dir}"
|
---|
| 66 | if="${not nunit.build and file::exists(nunit.framework.dll)}" />
|
---|
| 67 |
|
---|
| 68 | </target>
|
---|
| 69 |
|
---|
| 70 | <target name="init-addin">
|
---|
| 71 |
|
---|
| 72 | <mkdir dir="${output.dir}" unless="${directory::exists(output.dir)}" />
|
---|
| 73 |
|
---|
| 74 | <copy file="${nunit.core.dll}" todir="${output.dir}"
|
---|
| 75 | if="${not nunit.build and file::exists(nunit.core.dll)}" />
|
---|
| 76 | <copy file="${nunit.core.interfaces.dll}" todir="${output.dir}"
|
---|
| 77 | if="${not nunit.build and file::exists(nunit.core.interfaces.dll)}" />
|
---|
| 78 |
|
---|
| 79 | </target>
|
---|
| 80 |
|
---|
| 81 | <target name="build" Description="Build the sample">
|
---|
| 82 | <call target="build-${sample.type}"/>
|
---|
| 83 | </target>
|
---|
| 84 |
|
---|
| 85 | <target name="build-csharp" depends="init">
|
---|
| 86 |
|
---|
| 87 | <csc target="library" output="${output.dir}/${sample.dll}" debug="${build.debug}">
|
---|
| 88 | <sources>
|
---|
| 89 | <patternset refid="source-files"/>
|
---|
| 90 | </sources>
|
---|
| 91 | <references basedir="${output.dir}">
|
---|
| 92 | <include name="nunit.framework.dll" />
|
---|
| 93 | </references>
|
---|
| 94 | </csc>
|
---|
| 95 |
|
---|
| 96 | </target>
|
---|
| 97 |
|
---|
| 98 | <target name="build-addin" depends="init-addin">
|
---|
| 99 |
|
---|
| 100 | <csc target="library" output="${output.dir}/${sample}.dll" debug="${build.debug}">
|
---|
| 101 | <sources>
|
---|
| 102 | <patternset refid="source-files"/>
|
---|
| 103 | </sources>
|
---|
| 104 | <references basedir="${output.dir}">
|
---|
| 105 | <include name="nunit.core.interfaces.dll" />
|
---|
| 106 | <include name="nunit.core.dll" />
|
---|
| 107 | </references>
|
---|
| 108 | </csc>
|
---|
| 109 |
|
---|
| 110 | <call target="build-addin-test" if="${property::exists('test.dll')}" />
|
---|
| 111 |
|
---|
| 112 | </target>
|
---|
| 113 |
|
---|
| 114 | <target name="build-addin-test">
|
---|
| 115 |
|
---|
| 116 | <csc target="library" output="${output.dir}/${test.dll}" debug="${build.debug}">
|
---|
| 117 | <sources basedir="Tests">
|
---|
| 118 | <patternset refid="test-files"/>
|
---|
| 119 | </sources>
|
---|
| 120 | <references basedir="${output.dir}">
|
---|
| 121 | <include name="nunit.framework.dll" />
|
---|
| 122 | <include name="${sample}.dll" />
|
---|
| 123 | </references>
|
---|
| 124 | </csc>
|
---|
| 125 |
|
---|
| 126 | </target>
|
---|
| 127 |
|
---|
| 128 | <target name="build-vb" depends="init">
|
---|
| 129 |
|
---|
| 130 | <vbc target="library"
|
---|
| 131 | output="${output.dir}/${sample.dll}" debug="${build.debug}">
|
---|
| 132 | <imports>
|
---|
| 133 | <import namespace="System"/>
|
---|
| 134 | <import namespace="System.Collections"/>
|
---|
| 135 | </imports>
|
---|
| 136 | <sources>
|
---|
| 137 | <patternset refid="source-files"/>
|
---|
| 138 | </sources>
|
---|
| 139 | <references basedir="${output.dir}">
|
---|
| 140 | <include name="System.dll" />
|
---|
| 141 | <include name="nunit.framework.dll" />
|
---|
| 142 | </references>
|
---|
| 143 | </vbc>
|
---|
| 144 |
|
---|
| 145 | </target>
|
---|
| 146 |
|
---|
| 147 | <target name="build-jsharp" depends="init">
|
---|
| 148 |
|
---|
| 149 | <vjc target="library" output="${output.dir}/${sample.dll}" debug="${build.debug}">
|
---|
| 150 | <sources>
|
---|
| 151 | <patternset refid="source-files"/>
|
---|
| 152 | </sources>
|
---|
| 153 | <references basedir="${output.dir}">
|
---|
| 154 | <include name="nunit.framework.dll" />
|
---|
| 155 | </references>
|
---|
| 156 | </vjc>
|
---|
| 157 |
|
---|
| 158 | </target>
|
---|
| 159 |
|
---|
| 160 | <target name="build-managed" depends="init">
|
---|
| 161 |
|
---|
| 162 | <readregistry property="vs.2003.path"
|
---|
| 163 | key="Software\Microsoft\VisualStudio\7.1\InstallDir"
|
---|
| 164 | hive="LocalMachine" failonerror="false"
|
---|
| 165 | unless="${property::exists( 'vs.2003.path' )}"/>
|
---|
| 166 |
|
---|
| 167 | <fail message="VS 2003 must be installed to build this sample"
|
---|
| 168 | unless="${property::exists( 'vs.2003.path' )}"/>
|
---|
| 169 |
|
---|
| 170 | <exec program="devenv.exe" basedir="${vs.2003.path}" workingdir="."
|
---|
| 171 | commandline="${sample}.vcproj /build ${build.config} /out ${output.dir}/${sample.dll}" />
|
---|
| 172 |
|
---|
| 173 | </target>
|
---|
| 174 |
|
---|
| 175 | <target name="build-cpp-cli" depends="init">
|
---|
| 176 |
|
---|
| 177 | <readregistry property="vs.2005.path"
|
---|
| 178 | key="Software\Microsoft\VisualStudio\8.0\InstallDir"
|
---|
| 179 | hive="LocalMachine" failonerror="false"
|
---|
| 180 | unless="${property::exists( 'vs.2005.path' )}"/>
|
---|
| 181 |
|
---|
| 182 | <fail message="VS 2005 must be installed to build this sample"
|
---|
| 183 | unless="${property::exists( 'vs.2005.path' )}"/>
|
---|
| 184 |
|
---|
| 185 | <exec program="devenv.exe"
|
---|
| 186 | basedir="${vs.2005.path}" workingdir="."
|
---|
| 187 | commandline="${sample}.vcproj /build ${build.config} /out ${output.dir}/${sample.dll}"/>
|
---|
| 188 |
|
---|
| 189 | </target>
|
---|
| 190 |
|
---|
| 191 | <!-- ************************************************************* -->
|
---|
| 192 | <!-- Package targets are only used by the NUnit build script in -->
|
---|
| 193 | <!-- order to package the samples for distribution. -->
|
---|
| 194 | <!-- ************************************************************* -->
|
---|
| 195 |
|
---|
| 196 | <target name="package">
|
---|
| 197 |
|
---|
| 198 | <fail message="Can't use package target directly - it must be called from the NUnit build script."
|
---|
| 199 | unless="${nunit.build}"/>
|
---|
| 200 |
|
---|
| 201 | <property name="sample.path"
|
---|
| 202 | value="${string::replace(project.base, samples.base, package.samples.dir)}" />
|
---|
| 203 |
|
---|
| 204 | <call target="package-${sample.type}" />
|
---|
| 205 |
|
---|
| 206 | </target>
|
---|
| 207 |
|
---|
| 208 | <target name="package-csharp">
|
---|
| 209 |
|
---|
| 210 | <property name="sample.proj" value="${sample}.csproj" />
|
---|
| 211 |
|
---|
| 212 | <call target="copy-source-files" />
|
---|
| 213 | <call target="update-framework-ref" />
|
---|
| 214 |
|
---|
| 215 | </target>
|
---|
| 216 |
|
---|
| 217 | <target name="package-jsharp">
|
---|
| 218 |
|
---|
| 219 | <property name="sample.proj" value="${sample}.vjsproj" />
|
---|
| 220 |
|
---|
| 221 | <call target="copy-source-files" />
|
---|
| 222 | <call target="update-framework-ref" />
|
---|
| 223 |
|
---|
| 224 | </target>
|
---|
| 225 |
|
---|
| 226 | <target name="update-framework-ref">
|
---|
| 227 |
|
---|
| 228 | <xmlpoke
|
---|
| 229 | file="${sample.path}/${sample.proj}"
|
---|
| 230 | xpath="/VisualStudioProject/*/Build/References/Reference[@Name='nunit.framework']/@HintPath"
|
---|
| 231 | value="..\..\..\bin\net-1.1\framework\nunit.framework.dll" />
|
---|
| 232 |
|
---|
| 233 | </target>
|
---|
| 234 |
|
---|
| 235 | <target name="package-vb">
|
---|
| 236 |
|
---|
| 237 | <property name="sample.proj" value="${sample}.vbproj" />
|
---|
| 238 |
|
---|
| 239 | <call target="copy-source-files" />
|
---|
| 240 | <call target="update-framework-ref" />
|
---|
| 241 |
|
---|
| 242 | </target>
|
---|
| 243 |
|
---|
| 244 | <target name="package-managed">
|
---|
| 245 |
|
---|
| 246 | <property name="sample.proj" value="${sample}.vcproj" />
|
---|
| 247 |
|
---|
| 248 | <call target="copy-source-files" />
|
---|
| 249 |
|
---|
| 250 | <copy todir="${package.samples.dir}/cpp/managed/failures"
|
---|
| 251 | file="./cpp-managed-failures.vcproj">
|
---|
| 252 | <filterchain>
|
---|
| 253 | <replacestring from="$(SolutionDir)..\..\..\src\NUnitFramework\framework\bin\Debug\nunit.framework.dll"
|
---|
| 254 | to="..\..\..\..\bin\nunit.framework.dll"/>
|
---|
| 255 | </filterchain>
|
---|
| 256 | </copy>
|
---|
| 257 |
|
---|
| 258 | </target>
|
---|
| 259 |
|
---|
| 260 | <target name="package-cpp-cli">
|
---|
| 261 |
|
---|
| 262 | <property name="sample.proj" value="${sample}.vcproj" />
|
---|
| 263 |
|
---|
| 264 | <call target="copy-source-files" />
|
---|
| 265 |
|
---|
| 266 | <xmlpoke
|
---|
| 267 | file="${sample.path}/${sample.proj}"
|
---|
| 268 | xpath="/VisualStudioProject/References/AssemblyReference[@AssemblyName='nunit.framework']/@RelativePath"
|
---|
| 269 | value="..\..\..\..\bin\net-2.0\framework\nunit.framework.dll" />
|
---|
| 270 |
|
---|
| 271 | </target>
|
---|
| 272 |
|
---|
| 273 | <target name="package-addin">
|
---|
| 274 |
|
---|
| 275 | <property name="sample.proj" value="${sample}.csproj" />
|
---|
| 276 |
|
---|
| 277 | <call target="copy-source-files" />
|
---|
| 278 | <call target="copy-test-files"
|
---|
| 279 | if="${property::exists('test.dll')}"/>
|
---|
| 280 |
|
---|
| 281 | </target>
|
---|
| 282 |
|
---|
| 283 | <target name="copy-source-files">
|
---|
| 284 |
|
---|
| 285 | <copy todir="${sample.path}" includeemptydirs="false">
|
---|
| 286 | <fileset basedir=".">
|
---|
| 287 | <include name="${sample.proj}" />
|
---|
| 288 | <include name="${sample}.build" />
|
---|
| 289 | <include name="Readme.txt" />
|
---|
| 290 | <patternset refid="source-files" />
|
---|
| 291 | </fileset>
|
---|
| 292 | </copy>
|
---|
| 293 |
|
---|
| 294 | </target>
|
---|
| 295 |
|
---|
| 296 | <target name="copy-test-files">
|
---|
| 297 |
|
---|
| 298 | <copy todir="${sample.path}/Tests" includeemptydirs="false">
|
---|
| 299 | <fileset basedir="Tests">
|
---|
| 300 | <include name="${sample}Tests.csproj" />
|
---|
| 301 | <include name="${sample}Tests.build" />
|
---|
| 302 | <patternset refid="test-files" />
|
---|
| 303 | </fileset>
|
---|
| 304 | </copy>
|
---|
| 305 |
|
---|
| 306 | </target>
|
---|
| 307 |
|
---|
| 308 | </project>
|
---|