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 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623
|
<?xml version="1.0"?>
<project name="NUnit" default="build" basedir=".">
<!--
This build file will build NUnit for any of the supported
runtimes which are actually installed.
NOTE: This file uses features that are not available in
NAnt 0.84. It has been tested using the nightly download
nant-0.85-20040707.zip.
Examples of Use:
nant net-1.1 release build
nant build-all
nant clean build
Runtime Support:
net-1.0 Microsoft .NET version 1.0
net-1.1 Microsoft .NET version 1.1
net-2.0 Microsoft .NET version 2.0
mono-1.0 Mono version 1.0 (or installed version)
Debug and release versions of each of these may be built
Default:
Default is to build the debug version for .NET 1.1. This
may be changed by setting the default properties below.
Limitations:
1. Currently, the .NET 1.0 builds of nunit-gui cannot be
run successfully. This is because the resource files
specify the use of .NET 1.1. This will be fixed in a
follow-up release.
2. In order to build cpp-sample for either version of .NET,
the correct version of cl.exe must be found on the path.
This is a limitation of the NAnt <cl> task.
-->
<!-- Global settings and defaults -->
<property name="project.build.dir" value="${nant.project.basedir}\build"/>
<property name="project.package.dir" value="${nant.project.basedir}\package"/>
<!-- List supported frameworks and flag which ones are available -->
<property name="frameworks" value="net-1.0,net-1.1,mono-1.0"/>
<available type="Framework" resource="net-1.0" property="framework.available.net-1.0" />
<available type="Framework" resource="net-1.1" property="framework.available.net-1.1" />
<available type="Framework" resource="mono-1.0" property="framework.available.mono-1.0" />
<!-- Set up default build and runtime configuration -->
<property name="build.config" value="debug"/>
<property name="build.clean" value="false"/>
<property name="runtime.config" value="net"/>
<property name="runtime.version" value="1.1"/>
<!-- Get Visual Studio locations from registry if this is a win32 machine -->
<if test="${platform::is-win32()}">
<readregistry property="vs.2002.path" key="Software\Microsoft\VisualStudio\7.0\InstallDir" hive="LocalMachine" />
<readregistry property="vs.2003.path" key="Software\Microsoft\VisualStudio\7.1\InstallDir" hive="LocalMachine" />
</if>
<!-- Set up version for packaging (override as needed) -->
<property name="package.version" value="2.2.0"/>
<!-- Root of the package file name -->
<property name="package.name" value="${nant.project.name}-${package.version}"/>
<!-- Package directory - will effect top level directory name in zips -->
<property name="package.dir" value="${project.package.dir}/${package.name}"/>
<!-- Command-line build configurations -->
<target name="debug" description="Set config to debug">
<call target="set-debug-build-config" />
</target>
<target name="release" description="Set config to release">
<call target="set-release-build-config" />
</target>
<target name="clean" description="Set flag to perform clean builds">
<property name="build.clean" value="true"/>
</target>
<!-- Command-line runtime configurations -->
<target name="net" description="Set runtime to .NET 1.1">
<call target="set-net-1.1-runtime-config"/>
</target>
<target name="net-1.0" description="Set runtime to .NET 1.0">
<call target="set-net-1.0-runtime-config"/>
</target>
<target name="net-1.1" description="Set runtime to .NET 1.1">
<call target="set-net-1.1-runtime-config"/>
</target>
<target name="net-2.0" description="Set runtime to .NET 2.0">
<call target="set-net-2.0-runtime-config"/>
</target>
<target name="mono" description="Set runtime to Mono">
<call target="set-mono-1.0-runtime-config"/>
</target>
<target name="mono-1.0" description="Set runtime to Mono">
<call target="set-mono-1.0-runtime-config"/>
</target>
<!-- Clean directories -->
<target name="clean-build-dir" depends="set-build-dir">
<delete dir="${build.dir}" if="${directory::exists( build.dir )}"/>
</target>
<target name="clean-package-dir" depends="set-package-config">
<delete dir="${package.dir}" if="${directory::exists( package.dir )}"/>
</target>
<!-- Targets that operate on all configs and runtimes -->
<target name="clean-all" description="Erase all build directories">
<delete dir="${project.build.dir}" if="${directory::exists( project.build.dir )}"/>
</target>
<target name="build-all"
description="Build all runtime versions in both debug and release">
<call target="set-debug-build-config"/>
<call target="build-each"/>
<call target="set-release-build-config"/>
<call target="build-each"/>
</target>
<target name="test-all"
description="Test all versions in both debug and release">
<call target="set-debug-build-config"/>
<call target="test-each"/>
<call target="set-release-build-config"/>
<call target="test-each"/>
</target>
<!-- Create standard packages for distribution - Note that this
target has different semantics from the other -all targets -->
<target name="package-all"
description="Create all the packages we normally distribute.">
<call target="package-src"/>
<call target="set-release-build-config"/>
<call target="package-each-zip"/>
<if test="${platform::is-win32()}">
<call target="set-net-1.1-runtime-config"/>
<call target="set-release-build-config"/>
<call target="package-msi"/>
</if>
</target>
<!-- Targets that operate on both debug and release -->
<target name="build-all-configs"
description="Build selected runtime version in both debug and release">
<call target="set-debug-build-config"/>
<call target="set-runtime-config"/>
<call target="build"/>
<call target="set-release-build-config"/>
<call target="set-runtime-config"/>
<call target="build"/>
</target>
<target name="test-all-configs"
description="Test debug and release for the selected runtime version">
<call target="set-debug-build-config"/>
<call target="set-runtime-config"/>
<call target="test"/>
<call target="set-release-build-config"/>
<call target="set-runtime-config"/>
<call target="test"/>
</target>
<!-- Targets that operate on each available runtime -->
<target name="build-each"
description="Build for each available runtime">
<foreach item="String" delim="," property="framework" in="${frameworks}">
<if test="${framework::exists( framework )}">
<call target="set-${framework}-runtime-config"/>
<call target="build"/>
</if>
</foreach>
</target>
<target name="test-each"
description="Test under each available runtime">
<foreach item="String" delim="," property="framework" in="${frameworks}">
<if test="${framework::exists( framework )}">
<call target="set-${framework}-runtime-config"/>
<call target="test" />
</if>
</foreach>
</target>
<target name="package-each-zip"
description="Create zip package for each available runtime">
<foreach item="String" delim="," property="framework" in="${frameworks}">
<if test="${framework::exists( framework )}">
<call target="set-${framework}-runtime-config"/>
<call target="package-zip" />
</if>
</foreach>
</target>
<target name="package-each-msi"
description="Create msi package for each win32 runtime">
<fail message="MSI can only be built on the Win32 platform" unless="${platform::is-win32()}"/>
<foreach item="String" delim="," property="framework" in="${frameworks}">
<if test="${framework::exists( framework )}">
<call target="set-${framework}-runtime-config"/>
<if test="${build.win32}">
<call target="package-msi" />
</if>
</if>
</foreach>
</target>
<!-- Targets that perform builds -->
<target name="build" depends="set-build-dir"
description="Build NUnit for a single runtime version and config">
<echo message="*"/>
<echo message="* Starting ${runtime.config} ${runtime.version} ${build.config} build"/>
<echo message="*"/>
<!-- Clean the build directory if this is a clean build -->
<call target="clean-build-dir" if="${build.clean}"/>
<!-- Create the build directory -->
<mkdir dir="${build.dir}/bin"/>
<!-- Copy key file to the correct relative location -->
<copy file="nunit.key" todir="${project.build.dir}"/>
<!-- Build everything except the samples -->
<nant buildfile="framework\nunit.framework.build" target="build"/>
<nant buildfile="core\nunit.core.build" target="build"/>
<nant buildfile="extensions\nunit.extensions.build" target="build"/>
<nant buildfile="util\nunit.util.build" target="build"/>
<nant buildfile="nunit-console\nunit-console.build" target="build"/>
<nant buildfile="mocks\nunit.mocks.build" target="build"/>
<!-- Build Win32-only projects -->
<if test="${build.win32}">
<nant buildfile="uikit\nunit.uikit.build" target="build"/>
<nant buildfile="nunit-gui\nunit-gui.build" target="build"/>
<!-- Tests need uikit, so build them last -->
<nant buildfile="tests\tests.build" target="build"/>
</if>
<!-- Tests are not compiling under mono, so they are temporarily moved above -->
</target>
<!-- Build sample programs -->
<target name="samples" depends="build" description="Build sample programs">
<nant buildfile="samples\samples.build" target="build"/>
</target>
<target name="build-msi" depends="set-build-dir,set-package-config"
description="Build msi file for installation on Windows systems">
<fail message="MSI can only be built on the Win32 platform" unless="${platform::is-win32()}"/>
<fail message="MSI can only be built for a Win32 runtime" unless="${platform::is-win32()}"/>
<echo message="*"/>
<echo message="* Building msi for ${runtime.config} ${runtime.version} ${build.config}"/>
<echo message="*"/>
<delete file="msi.txt" if="${file::exists( 'msi.txt' )}"/>
<call target="build-${runtime.config}-${runtime.version}-msi"/>
<echo message="* Build complete - output saved as msi.txt"/>
</target>
<target name="build-net-1.0-msi">
<fail message="Property vs.2002.path not set" unless="${property::exists( 'vs.2002.path' )}"/>
<exec program="${vs.2002.path}\devenv.exe"
commandline="nunit.sln /build ${build.config} /project install /out msi.txt"/>
</target>
<target name="build-net-1.1-msi">
<fail message="Property vs.2003.path not set" unless="${property::exists( 'vs.2003.path' )}"/>
<exec program="${vs.2003.path}\devenv.exe"
commandline="nunit.sln /build ${build.config} /project install /out msi.txt"/>
</target>
<!-- Targets for running tests -->
<target name="test" depends="build"
description="Run tests for a build using console runner">
<echo message="*"/>
<echo message="* Starting ${runtime.config} ${runtime.version} ${build.config} test run"/>
<echo message="*"/>
<!-- We use exec rather than the nunit2 task because we are testing
a new build of NUnit which is likely not to be included in the Nant build -->
<exec basedir="${build.dir}/bin"
workingdir="${build.dir}/bin"
program="nunit-console.exe"
useruntimeengine="true"
commandline="nunit.tests.dll" />
</target>
<target name="nunit2-test"
description="Run tests for a build using console runner">
<echo message="*"/>
<echo message="* Starting ${runtime.config} ${runtime.version} ${build.config} test run"/>
<echo message="*"/>
<nunit2>
<formatter type="Plain"/>
<test assemblyname="${build.dir}/bin/nunit.tests.dll"/>
</nunit2>
</target>
<target name="timing-test" depends="build"
description="Run timing tests (long)">
<echo message="*"/>
<echo message="* Starting ${runtime.config} ${runtime.version} ${build.config} timing tests"/>
<echo message="*"/>
<echo message="* WARNING: Test may take some time to run"/>
<echo message="*"/>
<exec basedir="${build.dir}/bin" workingdir="${build.dir}/bin" program="nunit-console.exe" commandline="timing-tests.dll"/>
</target>
<target name="gui-test" depends="build"
description="Run tests for a build using gui runner">
<ifnot test="${nant.platform.win32}">
<fail message="NUnit-gui is only available on Win32"/>
</ifnot>
<ifnot test="${build.win32}">
<fail message="NUnit-gui is only available for Win32"/>
</ifnot>
<echo message="*"/>
<echo message="* Starting ${runtime.config} ${runtime.version} ${build.config} gui test run"/>
<echo message="*"/>
<exec basedir="${build.dir}/bin" workingdir="${build.dir}/bin" program="nunit-gui.exe" commandline="nunit.tests.dll"/>
</target>
<!-- Targets for packaging the NUnit distribution -->
<target name="package-zip" depends="set-package-config" description="Create distribution package">
<!-- Perform a build -->
<call target="build"/>
<!-- Copy top level files -->
<copy file="nunit-gui/logo.ico" tofile="${build.dir}/logo.ico"/>
<copy file="license.rtf" tofile="${build.dir}/license.rtf"/>
<!-- Copy source files that build doesn't copy -->
<copy todir="${build.dir}/src">
<fileset basedir=".">
<include name="nunit.build"/>
<include name="nunit.sln"/>
<include name="nunit.key"/>
<include name="nunit20under21.config"/>
<include name="install/install.vdproj"/>
</fileset>
</copy>
<!-- Samples are not built, so let them copy themselves -->
<nant buildfile="samples/samples.build" target="copy-all"/>
<!-- Copy docs -->
<call target="copy-docs"/>
<!-- Remove any temporary output files produced by tests
from the build directory - temporary fix -->
<delete>
<fileset>
<include name="temp*.xml"/>
</fileset>
</delete>
<!-- Re-copy everything to our package dir - this is so
we get a single top level directory called NUNit-x.x.x -->
<call target="clean-package-dir"/>
<mkdir dir="${package.dir}"/>
<copy todir="${package.dir}">
<fileset basedir="${build.dir}">
<include name="**"/>
</fileset>
</copy>
<!-- Create the zip file -->
<zip zipfile="${project.package.dir}/${zip.file.name}" ziplevel="9">
<fileset basedir="${package.dir}">
<include name="**"/>
</fileset>
</zip>
</target>
<target name="package-src" depends="clean-package-dir"
description="Create full source package for developer use">
<!-- Get source files into the package dir directly -->
<property name="src.dir" value="${package.dir}"/>
<mkdir dir="${src.dir}"/>
<call target="copy-src"/>
<!-- Get docs into the doc subdirectory of the package dir -->
<property name="doc.dir" value="${package.dir}/doc"/>
<call target="copy-docs"/>
<!-- Create the zip file -->
<zip zipfile="${project.package.dir}/${zipped.src.file.name}" ziplevel="9">
<fileset basedir="${package.dir}">
<include name="**"/>
</fileset>
</zip>
</target>
<target name="package-msi" depends="build-msi,set-package-config"
description="Build msi file and deploy it to the package dir">
<copy file="install\${build.config}\${msi.file.name}" tofile="${project.package.dir}/${msi.file.name}"/>
</target>
<target name="copy-docs">
<mkdir dir="${doc.dir}"/>
<copy todir="${doc.dir}">
<fileset basedir="doc">
<include name="ReleaseNotes.txt"/>
<include name="ChangeLog.txt"/>
<include name="*.html"/>
<include name="css/*"/>
<include name="files/*"/>
<exclude name="files/Supplement.doc"/>
<include name="img/*"/>
</fileset>
</copy>
</target>
<target name="copy-src">
<mkdir dir="${src.dir}"/>
<!-- Copy top level src files and install project -->
<copy todir="${src.dir}">
<fileset basedir=".">
<include name="license.rtf"/>
<include name="nunit.build"/>
<include name="nunit.sln"/>
<include name="nunit.key"/>
<include name="nunit20under22.config"/>
<include name="nunit21under22.config"/>
<include name="install/install.vdproj"/>
</fileset>
</copy>
<!-- Copy individual projects -->
<nant buildfile="framework\nunit.framework.build" target="copy"/>
<nant buildfile="core\nunit.core.build" target="copy"/>
<nant buildfile="extensions\nunit.extensions.build" target="copy"/>
<nant buildfile="util\nunit.util.build" target="copy"/>
<nant buildfile="nunit-console\nunit-console.build" target="copy"/>
<nant buildfile="mocks\nunit.mocks.build" target="copy"/>
<nant buildfile="samples\samples.build" target="copy-all"/>
<!-- Copy win32-only projects -->
<if test="${build.win32}">
<nant buildfile="uikit\nunit.uikit.build" target="copy"/>
<nant buildfile="nunit-gui\nunit-gui.build" target="copy"/>
</if>
<nant buildfile="tests\tests.build" target="copy-all"/>
</target>
<!-- Register core and framework in the gac -->
<target name="add-to-gac" depends="build">
<exec program="${nant.settings.currentframework.sdkdirectory}/gacutil.exe"
commandline="/i ${build.dir}/bin/nunit.framework.dll"/>
<echo message="The assembly nunit.framework was added to the GAC"/>
<exec program="${nant.settings.currentframework.sdkdirectory}/gacutil.exe"
commandline="/i ${build.dir}/bin/nunit.core.dll"/>
<echo message="The assembly nunit.core was added to the GAC"/>
</target>
<!-- Set up build configuration -->
<target name="set-build-config">
<call target="set-${build.config}-build-config"/>
</target>
<target name="set-debug-build-config">
<property name="build.config" value="debug"/>
<property name="build.debug" value="true"/>
<property name="build.defines.csc" value="DEBUG,TRACE" readonly="false" />
<property name="build.defines.jsc" value="DEBUG,TRACE" readonly="false" />
<property name="build.defines.vbc" value="DEBUG=True,TRACE=True" readonly="false" />
<property name="build.defines.vjc" value="DEBUG,TRACE" readonly="false" />
<property name="build.defines.cl" value="/D _DEBUG" readonly="false" />
<property name="zip.build.suffix" value="-dbg"/>
<property name="msi.build.suffix" value="-dbg"/>
</target>
<target name="set-release-build-config">
<property name="build.config" value="release"/>
<property name="build.debug" value="false"/>
<property name="build.defines.csc" value="TRACE,STRONG" readonly="false" />
<property name="build.defines.jsc" value="TRACE,STRONG" readonly="false" />
<property name="build.defines.vbc" value="TRACE=True,STRONG=True" readonly="false" />
<property name="build.defines.vjc" value="TRACE,STRONG" readonly="false" />
<property name="build.defines.cl" value="/D STRONG" readonly="false" />
<property name="zip.build.suffix" value=""/>
<property name="msi.build.suffix" value=""/>
</target>
<!-- Set up runtime configuration -->
<target name="set-runtime-config">
<call target="set-${runtime.config}-${runtime.version}-runtime-config"/>
</target>
<target name="set-net-1.0-runtime-config">
<property name="runtime.config" value="net"/>
<property name="runtime.version" value="1.0"/>
<property name="build.mono" value="false"/>
<property name="build.win32" value="true"/>
<property name="nant.settings.currentframework" value="net-1.0"/>
<property name="zip.runtime.suffix" value="-net-1.0"/>
<property name="msi.runtime.suffix" value="-net-1.0"/>
</target>
<target name="set-net-1.1-runtime-config">
<property name="runtime.config" value="net"/>
<property name="runtime.version" value="1.1"/>
<property name="build.mono" value="false"/>
<property name="build.win32" value="true"/>
<property name="nant.settings.currentframework" value="net-1.1"/>
<property name="zip.runtime.suffix" value="-net-1.1"/>
<!-- no suffix for the msi - we can only do it for 1.1 anyway -->
<property name="msi.runtime.suffix" value=""/>
</target>
<target name="set-net-2.0-runtime-config">
<property name="runtime.config" value="net"/>
<property name="runtime.version" value="2.0"/>
<property name="build.mono" value="false"/>
<property name="build.win32" value="true"/>
<property name="nant.settings.currentframework" value="net-2.0"/>
<property name="zip.runtime.suffix" value="-net-2.0"/>
<!-- no suffix for the msi - we can only do it for 1.1 anyway -->
<property name="msi.runtime.suffix" value=""/>
</target>
<target name="set-mono-1.0-runtime-config">
<property name="runtime.config" value="mono"/>
<property name="runtime.version" value="1.0"/>
<property name="build.mono" value="true"/>
<property name="build.win32" value="false"/>
<property name="nant.settings.currentframework" value="mono-1.0"/>
<property name="zip.runtime.suffix" value="-mono"/>
<property name="msi.runtime.suffix" value="-mono"/>
</target>
<!-- Set up the build directory -->
<target name="set-build-dir" depends="set-build-config,set-runtime-config">
<property name="build.dir" value="${project.build.dir}/${runtime.config}-${runtime.version}/${build.config}"/>
<property name="bin.dir" value="${build.dir}/bin"/>
<property name="src.dir" value="${build.dir}/src"/>
<property name="doc.dir" value="${build.dir}/doc"/>
</target>
<!-- Setup the package configuration info -->
<target name="set-package-config" depends="set-build-config,set-runtime-config">
<property name="zip.file.name" value="${package.name}${zip.runtime.suffix}${zip.build.suffix}.zip"/>
<property name="msi.file.name" value="${package.name}${msi.runtime.suffix}${msi.build.suffix}.msi"/>
<property name="zipped.src.file.name" value="${package.name}-src.zip"/>
</target>
<!-- Dump configuration settings for debugging -->
<target name="dump-settings" depends="set-build-dir,set-package-config">
<echo>Configuration</echo>
<echo> Config: ${build.config}</echo>
<echo> Runtime: ${runtime.config}-${runtime.version}</echo>
<echo> Version: ${package.version}</echo>
<echo> Package name: ${package.name}</echo>
<echo> Zip file: ${zip.file.name}</echo>
<echo> Msi file: ${msi.file.name}</echo>
<echo> Source zip: ${zipped.src.file.name}</echo>
<echo></echo>
<echo>Project Directories</echo>
<echo> Base: ${nant.project.basedir}</echo>
<echo> Build: ${project.build.dir}</echo>
<echo> Package: ${project.package.dir}</echo>
<echo></echo>
<echo>Current Directories</echo>
<echo> Build: ${build.dir}</echo>
<echo> Package: ${package.dir}</echo>
<echo></echo>
<echo>System Directories</echo>
<echo> Framework: ${nant.settings.currentframework.frameworkdirectory}</echo>
<echo> SDK: ${nant.settings.currentframework.sdkdirectory}</echo>
<echo> VS 2002: ${vs.2002.path}</echo>
<echo> VS 2003: ${vs.2003.path}</echo>
</target>
</project>
|