PDA

View Full Version : Spring build targets


steinard
03-16-2007, 09:43 PM
Hi!

Since I'm using enterprise services as well as remoting and WS, I need to have signed debug assemblies so that I have the possibility to step into the code on the remote server (by attaching the debugger to the process).

Therefore it would be really great if this buildtarget could be inserted into Spring.Net's build script:


<target name="signed-debug-net-2.0" description="Builds and signes DLLs and provides PDBs for debugging for .NET Framework 2.0 version"
depends="set-net-2.0-runtime-configuration, check-spring-basedir, clean-current-bin-dir, TestInit">
<property name="temp.build.skip" value="false"/>
<call target="copyDebugKeys"/>
<if test="${not temp.build.skip}">
<property name="lib.dir"
value="${spring.basedir}/lib/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}"/>
<call target="copylibs"/>
<nant buildfile="src/Spring/Spring.Core/Spring.Core.build" target="build"/>
<nant buildfile="src/Spring/Spring.Aop/Spring.Aop.build" target="build" if="${build-aop}"/>
<nant buildfile="src/Spring/Spring.Web/Spring.Web.build" target="build" if="${build-web}"/>
<nant buildfile="src/Spring/Spring.Data/Spring.Data.build" target="build" if="${build-data}"/>
<nant buildfile="src/Spring/Spring.Services/Spring.Services.build" target="build" if="${build-services}"/>
<nant buildfile="src/Spring/Spring.Testing/Spring.Testing.build" target="build" if="${build-testing}"/>

<!-- has dependencies on sandbox Spring.Threading....
<nant buildfile="src/Spring/Spring.Services/Spring.Services.WindowsService.Common.build" target="build"
if="${build-winservices}"/>
<nant buildfile="src/Spring/Spring.Services/Spring.Services.WindowsService.Process.build" target="build"
if="${build-winservices}"/>
<nant buildfile="src/Spring/Spring.Services/Spring.Services.WindowsService.Gui.build" target="build"
if="${build-winservices}"/>
<nant buildfile="src/Spring/Spring.Services/Spring.Services.WindowsService.Installer.build" target="build"
if="${build-winservices}"/>
-->

<nant buildfile="examples/Spring/Spring.Examples.build" target="build">
<!-- over ride setting -->
<properties>
<!-- TODO some compile errors... ignore for now. -->
<property name="build-web" value="false"/>
</properties>
</nant>

<nant buildfile="sandbox/Spring.Sandbox.build" target="build" if="${build-sandbox}">
<!-- over ride setting -->
<properties>
<!-- TODO some compile errors... ignore for now. -->
<property name="build-data" value="false"/>
<property name="nowarn.numbers" value="${nowarn.numbers},0419"/>
</properties>
</nant>

<nant buildfile="test/Spring/Spring.Core.Tests/Spring.Core.Tests.build" target="test"/>
<nant buildfile="test/Spring/Spring.Aop.Tests/Spring.Aop.Tests.build" target="test" if="${build-aop}"/>
<nant buildfile="test/Spring/Spring.Data.Tests/Spring.Data.Tests.build" target="test" if="${build-data}"/>
<nant buildfile="test/Spring/Spring.Data.Integration.Tests/Spring.Data.Integration.Tests.build" target="test" if="${build-data}"/>
<nant buildfile="test/Spring/Spring.Services.Tests/Spring.Services.Tests.build" target="test" if="${build-services}"/>
<nant buildfile="test/Spring/Spring.Web.Tests/Spring.Web.Tests.build" target="test" if="${build-web}"/>

<nant buildfile="sandbox/Spring.Sandbox.build" target="test" if="${build-sandbox}">
<!-- over ride setting -->
<properties>
<!-- TODO some compile errors... ignore for now. -->
<property name="build-data" value="false"/>
<property name="nowarn.numbers.test" value="${nowarn.numbers.test},1718"/>
</properties>
</nant>
</if>
</target>

<target name="copyDebugKeys">
<if test="${current.build.config.debug}">
<if test="${not file::exists(spring.basedir + '/Spring.Net.snk')}">
<if test="${property::exists('project.build.package') and project.build.package}">
<fail message="Key file not found."/>
</if>
<if test="${not(property::exists('project.build.package') and project.build.package)}">
<echo message="Key file not found. You can generate a key file by running 'sn -k Spring.Net.snk'."/>
<echo message="The generated key file should be stored in the Spring.Net base directory."/>
<echo message="The release build will be skipped."/>
<property name="temp.build.skip" value="true"/>
</if>
</if>
<if test="${file::exists(spring.basedir + '/Spring.Net.snk')}">
<!-- copy the Spring key file to the location where the compiler expects it to be -->
<copy file="Spring.Net.snk" todir="${current.bin.dir}"/>
<copy file="Spring.Net.snk" todir="sandbox"/>
</if>
<!-- for release on .NET 2.0 need to provide keyfile argument to compiler -->
<if test="${net-2.0}">
<property name="compiler.args" value="/keyfile:..\..\..\Spring.Net.snk"/>
</if>
</if>
</target>


I hope this is possible because it would really save me some time. If you would like to refactor the target's, then thats fine by me as long as I get signed dll's and pdb files in one go.

Cheers,
Steinar.

Bruno Baia
03-16-2007, 09:58 PM
Hi,


We planned to sign both debug and release binaries in nighlty builds and releases.


Bruno

steinard
03-16-2007, 10:13 PM
Hi Bruno!

If you know the guy responsible for the build system then please persuade him to include such a target, if he don't have the time to make one then try to make him paste in the two targets above around line 445 as they work (at least they just did here on my box, compiling my 1 hour old cvs update).

I guess it's 2 weeks since I last compiled Spring, and I seem to remember that debug compile gives me the PDBs but not signed assemblies and release gives me signed assemblies but of course not the PDBs. I need the mix... ;)

Thanks,
Steinar.

steinard
09-30-2007, 10:44 PM
Hi!

For those who is interested in a signed-debug assemblies build target, then I updated the old one for RC1. There are probably simpler ways of doing this then what I've done, but I'm no expert on NAnt. Anyway, here is the modification, which you can insert at line 499 in the build script:



<target name="signed-debug-net-2.0" description="Builds and signes DLLs and provides PDBs for debugging for .NET Framework 2.0 version"
depends="set-net-2.0-runtime-configuration, check-spring-basedir, clean-current-bin-dir, TestInit">
<property name="temp.build.skip" value="false"/>
<call target="copyDebugKeys"/>
<if test="${not temp.build.skip}">
<property name="lib.dir" value="${spring.basedir}/lib/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}"/>
<property name="nh.lib.dir" value="${spring.basedir}/lib/NHibernate10/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}"/>
<property name="nh12.lib.dir" value="${spring.basedir}/lib/NHibernate12/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}"/>
<call target="copylibs"/>
<call target="compile-test" />
</if>
</target>

<target name="copyDebugKeys">
<if test="${current.build.config.debug}">
<if test="${not file::exists(spring.basedir + '/Spring.Net.snk')}">
<if test="${property::exists('project.build.package') and project.build.package}">
<fail message="Key file not found."/>
</if>
<if test="${not(property::exists('project.build.package') and project.build.package)}">
<echo message="Key file not found. You can generate a key file by running 'sn -k Spring.Net.snk'."/>
<echo message="The generated key file should be stored in the Spring.Net base directory."/>
<echo message="The release build will be skipped."/>
<property name="temp.build.skip" value="true"/>
</if>
</if>
<if test="${file::exists(spring.basedir + '/Spring.Net.snk')}">
<!-- copy the Spring key file to the location where the compiler expects it to be -->
<copy file="Spring.Net.snk" todir="${current.bin.dir}"/>
<copy file="Spring.Net.snk" todir="sandbox"/>
</if>
<!-- for release on .NET 2.0 need to provide keyfile argument to compiler -->
<if test="${net-2.0}">
<property name="compiler.args" value="/keyfile:..\..\..\Spring.Net.snk"/>
</if>
</if>
</target>


Cheers,
Steinar.