Files
spring-net/build-support/solutions.build.nant
2012-12-21 10:41:06 -05:00

178 lines
7.4 KiB
XML

<?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="root.dir" value="${project::get-base-directory()}\.." overwrite="false" />
<!--
Ensure use of 32 bits version of frameworks and IDE to avoid the error
[MSB6003: The specified task executable "ResGen.exe" could not be run...]
on "Win 7 64".
-->
<property name="reg.software.prefix" value="SOFTWARE\Microsoft"/>
<readregistry property="wow6432node" key="SOFTWARE\Wow6432Node\" hive="LocalMachine" failonerror="false"/>
<if test="${property::exists('wow6432node')}">
<property name="reg.software.prefix" value="SOFTWARE\Wow6432Node\Microsoft"/>
</if>
<readregistry property="net35.install.dir" key="${reg.software.prefix}\NET Framework Setup\NDP\v3.5\InstallPath" hive="LocalMachine" failonerror="true"/>
<readregistry property="net40.install.dir" key="${reg.software.prefix}\NET Framework Setup\NDP\v4\Full\InstallPath" hive="LocalMachine" failonerror="true"/>
<readregistry property="vs2008.install.dir" key="${reg.software.prefix}\VisualStudio\9.0\InstallDir" hive="LocalMachine" failonerror="false"/>
<if test="${not property::exists('vs2008.install.dir')}">
<readregistry property="vs2010.install.dir" key="${reg.software.prefix}\VWDExpress\9.0\InstallDir" hive="LocalMachine" failonerror="false"/>
</if>
<readregistry property="vs2010.install.dir" key="${reg.software.prefix}\VisualStudio\10.0\InstallDir" hive="LocalMachine" failonerror="false"/>
<if test="${not property::exists('vs2010.install.dir')}">
<readregistry property="vs2010.install.dir" key="${reg.software.prefix}\VWDExpress\10.0\InstallDir" hive="LocalMachine" failonerror="false"/>
</if>
<property name="msbuild.exe" value="${net40.install.dir}\msbuild.exe"/>
<property name="buildconfiguration" value="Debug" />
<echo message="reg.software.prefix: '${reg.software.prefix}'"/>
<echo message="vs2008.install.dir: '${vs2008.install.dir}'"/>
<echo message="vs2010.install.dir: '${vs2010.install.dir}'"/>
<echo message="msbuild.exe: '${msbuild.exe}'"/>
<target name="RebuildAllSolutions" description="Rebuild all Solutions">
<!--
Forcing use of specific SDK to avoid the error "TRK0002: Failed to execute
command ResGen ..." on "Win 7 64".
See: http://social.msdn.microsoft.com/Forums/en-US/msbuild/thread/e8c1d26a-5e77-4422-bbc8-f0b7f25702d2/
-->
<property name="msbuild.exe" value="${net35.install.dir}\msbuild.exe"/>
<call target="RebuildAllSolutions-3.5" if="${property::exists('vs2008.install.dir')}" />
<property name="msbuild.exe" value="${net40.install.dir}\msbuild.exe"/>
<call target="RebuildAllSolutions-4.0" if="${property::exists('vs2010.install.dir')}" />
</target>
<target name="Clean">
<foreach item="Folder" property="dirname">
<in>
<items basedir="${root.dir}">
<include name="examples/**/obj" />
<include name="examples/**/PreCompiledWeb" />
<include name="build/VS.NET.*" />
</items>
</in>
<do>
<delete dir="${dirname}" failonerror="false"/>
<sleep seconds="2"/>
<delete dir="${dirname}" />
</do>
</foreach>
<delete>
<fileset basedir="${root.dir}">
<include name="examples/**/bin/**/*.*" />
<exclude name="examples/**/bin/*.refresh" />
</fileset>
</delete>
</target>
<target name="RebuildAllSolutions-3.5" depends="Clean">
<!-- build "main" solution -->
<property name="solutionfile" value="${root.dir}/Spring.NET.2008.sln" />
<property name="solutionconfiguration" value="${buildconfiguration}" />
<call target="RebuildSolution-3.5" />
<foreach item="File" property="filename">
<in>
<items basedir="${root.dir}">
<include name="examples/Spring/**/*.2008.sln" />
<include name="examples/Spring/Spring.Data.NHibernate/Spring.Northwind.sln" />
<!-- Does not build on bamboo server SPRNET-1283 -->
<exclude name="examples/Spring/Spring.MsmqQuickStart/**/*.2005.sln"/>
<exclude name="examples/Spring/Spring.Calculator/**/*.2008.sln"/>
<!-- <include name="*.2005.sln" /> -->
<include name="*.2008.sln" />
<exclude name="Spring.NET.2008.sln"/>
<exclude name="examples/Spring/Spring.EmsQuickStart/**/*.sln" unless="${build-ems}"/>
<exclude name="examples/**/Spring.Examples.Pool.2008.sln"/>
</items>
</in>
<do>
<property name="solutionfile" value="${filename}" />
<property name="solutionconfiguration" value="${buildconfiguration}" />
<call target="RebuildSolution-3.5" />
</do>
</foreach>
</target>
<target name="RebuildAllSolutions-4.0" depends="Clean">
<!-- build "main" solution -->
<property name="solutionfile" value="${root.dir}/Spring.NET.2010.sln" />
<property name="solutionconfiguration" value="${buildconfiguration}" />
<call target="RebuildSolution-4.0" />
<foreach item="File" property="filename">
<in>
<items basedir="${root.dir}">
<!-- <include name="examples/Spring/**/*.2005.sln" /> -->
<include name="examples/Spring/**/*.2010.sln" />
<exclude name="examples/Spring/Spring.Calculator/**/*.2010.sln"/>
<exclude name="Spring.NET.2010.sln"/>
<exclude name="examples/Spring/Spring.EmsQuickStart/**/*.sln" unless="${build-ems}"/>
<exclude name="examples/**/Spring.Examples.Pool.2010.sln"/>
</items>
</in>
<do>
<property name="solutionfile" value="${filename}" />
<property name="solutionconfiguration" value="${buildconfiguration}" />
<call target="RebuildSolution-4.0" />
</do>
</foreach>
</target>
<target name="RebuildSolution-3.5" description="rebuilds a given VS2008 solution file">
<echo message="Rebuilding .NET 3.5 Solution ${solutionfile}" />
<exec program="${msbuild.exe}">
<arg value="${solutionfile}"/>
<arg line="/nologo" />
<arg line="/verbosity:minimal" />
<arg line="/property:Configuration=${solutionconfiguration}"/>
<!--Specifying mandatory property in SDK 7-->
<arg line='/property:Platform="Any CPU"'/>
</exec>
</target>
<target name="RebuildSolution-4.0" description="rebuilds a given VS2010 solution file">
<echo message="Rebuilding .NET 4.0 Solution ${solutionfile}" />
<exec program="${msbuild.exe}" verbose="true">
<arg value="${solutionfile}"/>
<arg line="/nologo" />
<arg line="/verbosity:minimal" />
<arg line="/property:Configuration=${solutionconfiguration}"/>
<!--Specifying mandatory property in SDK 7-->
<arg line='/property:Platform="Any CPU"'/>
</exec>
</target>
</project>