nant scripts for testing release distributions

This commit is contained in:
eeichinger
2008-10-15 16:17:40 +00:00
parent cda7baf8e7
commit ef7e379dbc
2 changed files with 264 additions and 0 deletions

View File

@@ -0,0 +1,118 @@
<?xml version="1.0" ?>
<!--
Rebuilding Solutions using Nant and "solutions.build":
1) Move Spring.Calculator.snk -> $root/Spring.Calculator.snk
2) Create virtual directories in IIS
/Spring.Calculator.2003 -> $root\examples\Spring\Spring.Calculator\src\Spring.Calculator.Web.2003
/SpringAir.2003 -> $root\examples\Spring\SpringAir\src\SpringAir.Web.2003
3) Place solutions.build into $root/Solutions.build
4) execute "nant -f:solutions.build"
5) SpringAir.2003 unfort. doesn't work with this script :-(( - You need to check it manually (I'm working on it...)
-->
<project name="Spring.NET Examples" default="RebuildAllSolutions">
<property name="vs2003.install.dir.key" value="SOFTWARE\Microsoft\VisualStudio\7.1\InstallDir"/>
<readregistry property="vs2003.install.dir" key="${vs2003.install.dir.key}" hive="LocalMachine" failonerror="false"/>
<property name="devenv11.exe" value="${vs2003.install.dir}devenv.exe" />
<property name="msbuild.exe" value="C:\WINDOWS\Microsoft.NET\Framework\v3.5\msbuild.exe"/>
<property name="buildconfiguration" value="Debug" />
<target name="RebuildAllSolutions" description="Rebuild all Solutions">
<call target="RebuildAllSolutions-1.1" />
<call target="RebuildAllSolutions-2.0" />
</target>
<target name="Clean">
<delete>
<fileset basedir="examples">
<include name="**/bin/**/*.*" />
<include name="**/obj/**/*.*" />
<exclude name="**/bin/*.refresh" />
</fileset>
</delete>
</target>
<target name="RebuildAllSolutions-1.1" depends="Clean">
<!-- build examples -->
<foreach item="File" property="filename">
<in>
<items basedir="examples">
<include name="**/*.2003.sln" />
<exclude name="**/SpringAir.2003.sln" /> <!-- unfort. doesn't work -->
</items>
</in>
<do>
<property name="solutionfile" value="${filename}" />
<property name="solutionconfiguration" value="${buildconfiguration}" />
<call target="RebuildSolution-1.1" />
</do>
</foreach>
<!-- build "main" solution (extra call because of configuration 'debug-1.1') -->
<property name="solutionfile" value="Spring.NET.2003.sln" />
<property name="solutionconfiguration" value="${buildconfiguration}-1.1" />
<call target="RebuildSolution-1.1" />
</target>
<target name="RebuildAllSolutions-2.0" dependes="Clean">
<foreach item="File" property="filename">
<in>
<items basedir="examples">
<include name="**/*.2005.sln" />
</items>
</in>
<do>
<property name="solutionfile" value="${filename}" />
<property name="solutionconfiguration" value="${buildconfiguration}" />
<call target="RebuildSolution-2.0" />
</do>
</foreach>
<!-- build "main" solution (extra call because of configuration 'debug-1.1') -->
<property name="solutionfile" value="Spring.NET.2005.sln" />
<property name="solutionconfiguration" value="${buildconfiguration}" />
<call target="RebuildSolution-2.0" />
</target>
<target name="RebuildSolution-1.1" description="rebuilds a given VS2003 solution file">
<!-- "c:\Program Files\Microsoft Visual Studio .NET 2003\Common7\IDE\devenv.exe" Spring.NET.2003.sln /rebuild Debug-1.1 /out solutions.build-1.1.log -->
<echo message="Rebuilding VS2003 Solution ${solutionfile}" />
<exec program="${devenv11.exe}" basedir="${devenv11.exe}">
<arg value="${solutionfile}" />
<arg line="/rebuild ${solutionconfiguration}" />
<arg line="/out solutions.build-1.1.log" />
</exec>
<!--
<solution configuration="${solutionconfiguration}" solutionfile="${solutionfile}">
<webmap>
<map url="http://localhost/Spring.Calculator.2003" path="examples\Spring\Spring.Calculator\src\Spring.Calculator.Web.2003" />
<map url="http://localhost/SpringAir.2003" path="examples\Spring\SpringAir\src\SpringAir.Web.2003" />
</webmap>
</solution>
-->
</target>
<target name="RebuildSolution-2.0" description="rebuilds a given VS2005 solution file">
<echo message="Rebuilding VS2005 Solution ${solutionfile}" />
<exec program="${msbuild.exe}">
<!--
<arg value="/property:OutDir=${output.dir}/"/>
-->
<arg value="${solutionfile}"/>
<arg line="/nologo" />
<arg line="/property:Configuration=${solutionconfiguration}"/>
</exec>
</target>
</project>

View File

@@ -0,0 +1,146 @@
<?xml version="1.0" ?>
<!--
Contains tests for Spring.NET Release Distributions
Requirements:
This script uses tasks from nantcontrib
Steps to perform for running tests:
- Copy this script to Spring.NET installation root directory
- Open Command Prompt within root directory
- execute nant -f:test.release.nant
-->
<project name="Spring.NET Release Tests" default="TestAll">
<property name="spring.basedir" value="${project::get-base-directory()}"/>
<property name="spring.version.major" value="1" />
<property name="spring.version.minor" value="2" />
<property name="spring.version.build" value="0" />
<property name="spring.version.revision" value="287" />
<property name="spring.version.display" value="${spring.version.major}.${spring.version.minor}.${spring.version.build}" />
<target name="TestAll">
<call target="CheckAssemblies" />
</target>
<target name="CheckAssemblies">
<call target="CheckAssemblies-net-1.0" />
<call target="CheckAssemblies-net-1.1" />
<call target="CheckAssemblies-net-2.0" />
<call target="CheckAssemblies-net-3.0" />
</target>
<target name="CheckAssemblies-net-1.0">
<property name="platform.displayname" value=".NET" />
<property name="platform.name" value="net" />
<property name="platform.version.major" value="1" />
<property name="platform.version.minor" value="0" />
<call target="_set-platform-common" />
<call target="_check-assemblies" />
</target>
<target name="CheckAssemblies-net-1.1">
<property name="platform.displayname" value=".NET" />
<property name="platform.name" value="net" />
<property name="platform.version.major" value="1" />
<property name="platform.version.minor" value="1" />
<call target="_set-platform-common" />
<call target="_check-assemblies" />
</target>
<target name="CheckAssemblies-net-2.0">
<property name="platform.displayname" value=".NET" />
<property name="platform.name" value="net" />
<property name="platform.version.major" value="2" />
<property name="platform.version.minor" value="0" />
<call target="_set-platform-common" />
<call target="_check-assemblies" />
</target>
<target name="CheckAssemblies-net-3.0">
<property name="platform.displayname" value=".NET" />
<property name="platform.name" value="net" />
<property name="platform.version.major" value="3" />
<property name="platform.version.minor" value="0" />
<call target="_set-platform-common" />
<!-- call target="_check-assemblies" / -->
</target>
<target name="_set-platform-common">
<property name="platform.binaries.path" value="${spring.basedir}/bin/${platform.name}/${platform.version.major}.${platform.version.minor}" />
<property name="platform.binaries.path.release" value="${platform.binaries.path}/release" />
<property name="platform.binaries.path.debug" value="${platform.binaries.path}/debug" />
</target>
<!--
Checks all assemblies for a specific platform version
-->
<target name="_check-assemblies">
<echo message="------------------------------------------" />
<echo message="Checking assemblies for ${platform.displayname} ${platform.version.major}.${platform.version.minor}" />
<echo message="------------------------------------------" />
<echo message="" />
<foreach item="File" property="currentAssembly.codebase">
<in>
<items>
<include name="${platform.binaries.path.release}/*.dll"/>
<include name="${platform.binaries.path.debug}/*.dll"/>
</items>
</in>
<do>
<property name="currentAssembly.fullname" value="${assemblyname::get-full-name(assemblyname::get-assembly-name(currentAssembly.codebase))}" />
<property name="currentAssembly.name" value="${assemblyname::get-name(assemblyname::get-assembly-name(currentAssembly.codebase))}" />
<!-- perform checks -->
<echo message="checking '${currentAssembly.codebase}' '=> ${currentAssembly.fullname}" />
<call target="CheckAssemblySignature" />
<call target="CheckFileVersionInfo" if="${string::starts-with(currentAssembly.name, 'Spring.')}" />
</do>
</foreach>
</target>
<!--
Checks the assemblies are signed using the right key
Expects:
currentAssembly.fullname: current assembly's display name
currentAssembly.name: current assembly's simple display name
-->
<target name="CheckAssemblySignature">
<!-- set public key -->
<property name="expectedPublicKeyToken" value="65e474d141e25e07" />
<property name="expectedPublicKeyToken" value="af08829b84f0328e" if="${currentAssembly.name == 'Common.Logging'}" />
<fail message="assembly '${currentAssembly.codebase}' is not signed" if="${not string::ends-with(currentAssembly.fullname, 'PublicKeyToken='+expectedPublicKeyToken)}" />
<!-- try GAC install/uninstall -->
<gac-install force="true">
<assemblies><include name="${currentAssembly.codebase}" /></assemblies>
</gac-install>
<gac-uninstall>
<assemblies><assembly name="${currentAssembly.fullname}" /></assemblies>
</gac-uninstall>
</target>
<!--
Expects:
currentAssembly.fullname: current assembly's display name
currentAssembly.name: current assembly's simple display name
-->
<target name="CheckFileVersionInfo">
<property name="expected.companyname" value="SpringSource" />
<property name="expected.fileversion" value="${spring.version.display}.${platform.version.major}${platform.version.minor}${spring.version.revision}" />
<property name="expected.productname" value="Spring.NET Framework ${spring.version.display} for ${platform.displayname} ${platform.version.major}.${platform.version.minor}" />
<property name="expected.productversion" value="${expected.fileversion}" />
<property name="actual.fileversion" value="${fileversioninfo::get-file-version(fileversioninfo::get-version-info(currentAssembly.codebase))}" />
<property name="actual.companyname" value="${fileversioninfo::get-company-name(fileversioninfo::get-version-info(currentAssembly.codebase))}" />
<property name="actual.productname" value="${fileversioninfo::get-product-name(fileversioninfo::get-version-info(currentAssembly.codebase))}" />
<property name="actual.productversion" value="${fileversioninfo::get-product-version(fileversioninfo::get-version-info(currentAssembly.codebase))}" />
<echo if="${ expected.companyname != actual.companyname }" message="WARNING: 'Company Name' mismatch: ${actual.companyname}" />
<echo if="${ expected.fileversion != actual.fileversion }" message="WARNING: 'Fileversion' mismatch: ${actual.fileversion}, expected ${expected.fileversion}" />
<echo if="${ expected.productname != actual.productname }" message="WARNING: 'Product Name' mismatch: ${actual.productname}" />
<echo if="${ expected.productversion != actual.productversion }" message="WARNING: 'Product Version' mismatch: ${actual.productversion}" />
</target>
</project>