I split my build files up based on common functionality (compile.build, test.build, database.build, helpers.build, analysis.build, etc) and include them all at the top of my main.build file. This causes me some problems because loading all the build files (and related task assemblies) is rather slow. Is there a best practices on how to split build files up while still having easy to use targets?
With tasks it's easy because if a task isn't defined (the assembly for it hasn't been loaded), nant ignores it until it tries to execute it. With targets however, if the target isn't defined in the current context - even if it isn't used in the target call tree - the build fails immediately. I don't want to remove my depends and change them to call's either, if possible. Also, I use a build.bat file on development machines to quickly call targets. My build server on the other hand uses the build files directly. I could change this around if need be but I really don't like the idea of having to do something like (build -a fxcop) where -a tells it to load analysis.build. For example, if I want to run just the compile targets currently, it still loads all the other build files, assemblies, and targets. Current Ex: ======================== build.bat ======================= @echo off cls tools\nant\bin\NAnt.exe -f:main.build %* ========================== main.build ===================== <include buildfile="properties.xml" /> <!-- Sets global properties and includes task assemblies for fxcop, stylecop, nantcontrib, etc --> <include buildfile="compile.build" /> <!-- Defines compile targets compile.be, compile.bll --> <include buildfile="test.build" /> <!-- Defines targets for compiling test assemblies and running with nunit --> <include buildfile="analysis.build" /> <-- Defines targets for FxCop, StyleCop, CAT.NET, etc --> <target name="all" depends="compile test analyze" <target name="test" depends="test.setup test.execute" /> <target name="analyze" depends="test fxcop stylecop catnet" /> <!-- This is the problem definition in main.build because it depends on targets defined in other build files --> ======================================================== What I'm looking for is a way to do the following: ========= main.build =========== <include buildfile="properties.xml" /> <target name="test" depends="test.setup test.execute" /> <target name="analyze" depends="fxcop stylecop catnet" /> ============================= C:\project> build test ### looks up buildfiles for test.setup and test.execute at runtime and runs tests --> C:\project> build fxcop ### Loads fxcop target from some buildfile and execute, without having loaded the test buildfile Thanks, Ben ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ NAnt-users mailing list NAnt-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nant-users