From 4364598cc9997cbe7b0f1e6cf24f51c6101ab014 Mon Sep 17 00:00:00 2001 From: Charlie Poole Date: Fri, 11 Mar 2011 20:07:59 -0800 Subject: [PATCH] Add build and package scripts for Linux; rename build/package directories to builds/packages; refactor other scripts --- .bzrignore | 6 +- build | 126 ++++++++++++++++++++++++++++++++++ build.bat | 8 ++- nant | 3 +- nant.bat | 4 +- package | 110 +++++++++++++++++++++++++++++ package.bat | 10 +-- scripts/nunit.common.targets | 33 ++++----- scripts/nunit.package.targets | 2 +- src/PNUnit/runpnunit.bat | 2 +- 10 files changed, 272 insertions(+), 32 deletions(-) create mode 100755 build create mode 100755 package diff --git a/.bzrignore b/.bzrignore index 5a5d3b45..511c4180 100644 --- a/.bzrignore +++ b/.bzrignore @@ -17,10 +17,10 @@ solutions/*/NUnitCore/tests/* solutions/*/NUnitFramework/tests/* solutions/*/NUnitFramework/framework/* solutions/*/tests/loadtest-assembly/* -build +builds *.db *.VisualState.xml -package +packages GeneratedAssemblyInfo.cs debug release @@ -29,4 +29,4 @@ Release *.pidb *.resources *.userprefs -_ReSharper* \ No newline at end of file +_ReSharper* diff --git a/build b/build new file mode 100755 index 00000000..e165dd66 --- /dev/null +++ b/build @@ -0,0 +1,126 @@ +#!/bin/sh +# build - Builds and tests NUnit + +NANT="tools/nant-0.90/bin/NAnt.exe" +options="-f:scripts/nunit.build.targets" +config="" +runtime="" +clean="" +commands="" +passthru=false + +for arg in $@ +do + if [ $passthru = true ] + then + commands="$commands $arg" + continue + fi + + case "$arg" in + debug|release) + config="$arg" + ;; + + mono-1.0|1.0) + runtime="mono-1.0" + ;; + + mono-2.0|2.0) + runtime="mono-2.0" + ;; + + mono-3.5|3.5) + runtime="mono-3.5" + ;; + + mono-4.0|4.0) + runtime="mono-4.0" + ;; + + clean) + clean="clean" + ;; + + clean-all) + clean="clean-all" + ;; + + samples|tools|all) + commands="$commands build-$arg" + ;; + + test|gui-test) + commands="$commands $arg" + ;; + + -h|--help) + echo "Builds and tests NUnit" + echo + echo "usage: BUILD [option [...] ]" + echo + echo "Options may be any of the following, in any order..." + echo + echo " debug Builds debug configuration (default)" + echo " release Builds release configuration" + echo + echo " mono-4.0, 4.0 Builds using Mono 4.0 profile (future)" + echo " mono-3.5, 3.5 Builds using Mono 3.5 profile (default)" + echo " mono-2.0, 2.0 Builds using Mono 2.0 profile" + echo " mono-1.0, 1.0 Builds using Mono 1.0 profile" + echo + echo " clean Cleans the output directory before building" + echo " clean-all Removes output directories for all runtimes" + echo + echo " samples Builds the NUnit samples" + echo " tools Builds the NUnit tools" + echo + echo " test Runs tests for a build using the console runner" + echo " gui-test Runs tests for a build using the NUnit gui" + echo + echo " -h, --help Displays this help message" + echo + echo "Notes:" + echo + echo " 1. The default Mono profile to be used is selected automatically" + echo " by the NAnt script based on the version of Mono installed" + echo + echo " 2. When building under the 3.5 or higher profile, the 2.0" + echo " runtime version is targeted for NUnit itself. Tests use" + echo " the specified higher level framework." + echo + exit; + ;; + + --) + passthru=true + ;; + + *) + echo "Invalid argument: $arg" + echo + echo "Use $0 -h for more info" + echo + exit; + ;; + esac +done + +if [ "$commands" = "" ] +then + commands="build" +fi + +if [ "$config" != "" ] +then + options="$options -D:build.config=$config" +fi + +if [ "$runtime" != "" ] +then + options="$options -D:runtime.config=$runtime" +fi + +exec mono "$NANT" $options $clean $commands + + diff --git a/build.bat b/build.bat index 3ad3a41f..2a99693d 100755 --- a/build.bat +++ b/build.bat @@ -10,7 +10,7 @@ set CONFIG= set RUNTIME= set CLEAN= set COMMANDS= -set FLAG= +set PASSTHRU= goto start :shift @@ -20,7 +20,7 @@ shift /1 IF "%1" EQU "" goto execute -IF "%FLAG%" NEQ "" set COMMANDS=%COMMANDS% %1&goto shift +IF "%PASSTHRU%" EQU "TRUE" set COMMANDS=%COMMANDS% %1&goto shift IF /I "%1" EQU "?" goto usage IF /I "%1" EQU "/h" goto usage @@ -44,12 +44,13 @@ IF /I "%1" EQU "mono-3.5" set RUNTIME=mono-3.5&goto shift IF /I "%1" EQU "mono-4.0" set RUNTIME=mono-4.0&goto shift if /I "%1" EQU "clean" set CLEAN=clean&goto shift +if /I "%1" EQU "clean-all" set CLEAN=clean-all&goto shift IF /I "%1" EQU "samples" set COMMANDS=%COMMANDS% build-samples&goto shift IF /I "%1" EQU "tools" set COMMANDS=%COMMANDS% build-tools&goto shift IF /I "%1" EQU "test" set COMMANDS=%COMMANDS% test&goto shift IF /I "%1" EQU "gui-test" set COMMANDS=%COMMANDS% gui-test&goto shift -IF "%1" EQU "--" set FLAG=1&goto shift +IF "%1" EQU "--" set PASSTHRU=TRUE&goto shift echo Invalid option: %1 echo. @@ -94,6 +95,7 @@ echo net Builds using default .NET version echo mono Builds using default Mono profile echo. echo clean Cleans the output directory before building +echo clean-all Removes output directories for all runtimes echo. echo samples Builds the NUnit samples echo tools Builds the NUnit tools diff --git a/nant b/nant index 7ac03a93..5d4cc56c 100755 --- a/nant +++ b/nant @@ -1,2 +1,3 @@ #!/bin/sh -exec /usr/bin/cli ./tools/nant-0.90/bin/NAnt.exe "$@" +exec mono tools/nant-0.90/bin/NAnt.exe $@ + diff --git a/nant.bat b/nant.bat index 2a4a1320..003c2306 100755 --- a/nant.bat +++ b/nant.bat @@ -1,2 +1,2 @@ -tools\nant-0.90\bin\nant.exe %* - +tools\nant-0.90\bin\nant.exe %* + diff --git a/package b/package new file mode 100755 index 00000000..b6330051 --- /dev/null +++ b/package @@ -0,0 +1,110 @@ +#!/bin/sh +# PACKAGE - Packages NUnit + +NANT="tools/nant-0.90/bin/NAnt.exe" +options="-f:scripts/nunit.package.targets" +config="" +runtime="" +commands="" +passthru=false + +for arg in $@ +do + if [ $passthru = true ] + then + commands="$commands $arg" + continue + fi + + case "$arg" in + debug|release) + config="$arg" + ;; + + mono-1.0|1.0) + runtime="mono-1.0" + ;; + + mono-2.0|2.0) + runtime="mono-2.0" + ;; + + mono-3.5|3.5) + runtime="mono-3.5" + ;; + + mono-4.0|4.0) + runtime="mono-4.0" + ;; + + src|docs|zip|all) + commands="$commands package-$arg" + ;; + + source) + commands="$commands package-src" + ;; + + -h|--help) + echo "Builds one or more NUnit packages for distribution" + echo + echo "usage: PACKAGE [option [...] ] [ -- nantoptions ]" + echo + echo "Options may be any of the following, in any order..." + echo + echo " debug Builds debug packages (default)" + echo " release Builds release packages" + echo + echo " mono-4.0, 4.0 Builds package using Mono 4.0 profile (future)" + echo " mono-3.5, 3.5 Builds package using Mono 3.5 profile (default)" + echo " mono-2.0, 2.0 Builds package using Mono 2.0 profile" + echo " mono-1.0, 1.0 Builds package using Mono 1.0 profile" + echo + echo " src, source Builds the source package" + echo " docs Builds the documentation package" + echo " zip Builds a binary package in zipped form" + echo " all Builds source, documentation, 3.5 and 1.0 packages" + echo + echo " -h, --help Displays this help message" + echo + echo "In addition, any valid target in the NAnt script may" + echo "be supplied as an argument. This requires some degree" + echo "of familiarity with the script, in order to avoid" + echo "use of incompatible options." + echo + exit; + ;; + + --) + passthru=true; + ;; + + *) + echo "Invalid argument: $arg" + echo + echo "Use $0 -h for more info" + echo + exit; + ;; + esac +done + +if [ "$commands" = "" ] +then + commands="package" +fi + + +if [ "$config" != "" ] +then + options="$options -D:build.config=$config" +fi + +if [ "$runtime" != "" ] +then + options="$options -D:runtime.config=$runtime" +fi + +exec mono $NANT $options $clean $commands + + diff --git a/package.bat b/package.bat index 3125898a..3e1f0741 100644 --- a/package.bat +++ b/package.bat @@ -9,7 +9,7 @@ set OPTIONS=-f:scripts/nunit.package.targets set CONFIG= set RUNTIME= set COMMANDS= -set FLAG= +set PASSTHRU= goto start :shift @@ -19,7 +19,7 @@ shift /1 IF "%1" EQU "" goto execute -IF "%FLAG%" NEQ "" set COMMANDS=%COMMANDS% %1&goto shift +IF "%PASSTHRU%" NEQ "" set COMMANDS=%COMMANDS% %1&goto shift IF /I "%1" EQU "?" goto usage IF /I "%1" EQU "/h" goto usage @@ -47,7 +47,7 @@ IF /I "%1" EQU "src" set COMMANDS=%COMMANDS% package-src&goto shift IF /I "%1" EQU "zip" set COMMANDS=%COMMANDS% package-zip&goto shift IF /I "%1" EQU "msi" set COMMANDS=%COMMANDS% package-msi&goto shift -IF "%1" EQU "--" set FLAG=1&goto shift +IF "%1" EQU "--" set PASSTHRU=1&goto shift echo Invalid option: %1 echo. @@ -76,7 +76,7 @@ echo. echo Options may be any of the following, in any order... echo. echo debug Builds debug packages (default) -echo release Builds packages for release +echo release Builds release packages echo. echo net-4.0 Builds package using .NET 4.0 build (future) echo net-3.5 Builds package using .NET 3.5 build (default) @@ -92,7 +92,7 @@ echo src, source Builds the source package echo docs Builds the documentation package echo zip Builds a binary package in zipped form echo msi Builds a windows installer (msi) package -echo all +echo all Builds source, documentation, 3.5 and 1.1 packages echo. echo ?, /h, /help Displays this help message echo. diff --git a/scripts/nunit.common.targets b/scripts/nunit.common.targets index 1861fdfb..a22051e4 100644 --- a/scripts/nunit.common.targets +++ b/scripts/nunit.common.targets @@ -39,10 +39,13 @@ The first .NET and Mono frameworks found are the respective net and mono defaults. --> + value="net-3.5,net-2.0,net-4.0,net-1.1,net-1.0,mono-3.5,mono-2.0,mono-1.0"/> - + + @@ -60,9 +63,9 @@ + value="${path::combine(project.base.dir,'builds')}"/> + value="${path::combine(project.base.dir,'packages')}"/> - @@ -202,17 +204,6 @@ - - @@ -254,6 +245,16 @@ + + + + + + + + + + diff --git a/scripts/nunit.package.targets b/scripts/nunit.package.targets index 112f9092..ded1a725 100644 --- a/scripts/nunit.package.targets +++ b/scripts/nunit.package.targets @@ -80,7 +80,7 @@ description="Create a package using the current or default config"> - + diff --git a/src/PNUnit/runpnunit.bat b/src/PNUnit/runpnunit.bat index a05cbb7d..6efc8b44 100644 --- a/src/PNUnit/runpnunit.bat +++ b/src/PNUnit/runpnunit.bat @@ -1,2 +1,2 @@ -start pnunit-agent agent.conf +start pnunit-agent agent.conf pnunit-launcher test.conf \ No newline at end of file