Skip to content

Commit

Permalink
major overhaul of build files in preparation for build 3.
Browse files Browse the repository at this point in the history
Thanks to NAnt for providing a good build file that I shamelessly used to
make up NHibernate's build files.


SVN: trunk@515
  • Loading branch information
Mike Doerfler committed May 14, 2004
1 parent a3b9471 commit 5d5318c
Show file tree
Hide file tree
Showing 6 changed files with 349 additions and 236 deletions.
256 changes: 256 additions & 0 deletions NHibernateSolution.build
@@ -0,0 +1,256 @@
<?xml version="1.0" ?>

<project
name="NHibernateSolution"
default="build"
xmlns="http://nant.sf.net/schemas/nant-0.84.win32.net-1.0.xsd"
>

<!-- global project settings -->
<property name="project.name" value="nhibernate" />
<property name="project.version" value="0.0.5000.3" />

<!-- default configuration -->
<property name="project.config" value="debug" />

<!-- debug|release -->
<property name="build.defines" value="" />

<!-- named project configurations -->
<target name="debug" description="Perform a 'debug' build">
<property name="project.config" value="debug" />
<property name="build.debug" value="true" />
<property name="build.dir" value="${nant.project.basedir}/build/${project.name}-${project.version}-${project.config}" />
</target>

<target name="release" description="Perform a 'release' build">
<property name="project.config" value="release" />
<property name="build.debug" value="false" />
<property name="build.dir" value="${nant.project.basedir}/build/${project.name}-${project.version}" />
</target>

<target name="init" description="Initializes build properties">
<call target="${project.config}" />
<call target="set-runtime-configuration" />
</target>

<target name="clean" depends="init" description="Deletes current build">
<delete dir="${build.dir}" failonerror="false" />
</target>

<target name="cleanall" description="Deletes every build configuration">
<echo message="Deleting all builds from all configurations" />
<delete dir="build" failonerror="false" />
</target>

<target name="build" depends="init" description="Builds current configuration">
<echo message="Current Directory is ${nant.project.basedir}" />

<echo message="Build Directory is ${build.dir}" />

<!-- prepare build directory -->
<mkdir dir="${build.dir}/bin" />

<!-- copy framework-nuetral libraries -->
<copy todir="${build.dir}/bin">
<fileset basedir="external-bin">
<includes name="log4net.*" />
<includes name="DotNetMock.*" />
<includes name="nunit.framework.*" />
</fileset>
</copy>

<!-- copy framework-specific libraries -->
<!-- note that we are not targeting diff versions - only 1.1 and not mono yet -->

<nant
buildfile="src/NHibernate/NHibernate.build"
target="build"
/>
<nant
buildfile="src/NHibernate.DomainModel/NHibernate.DomainModel.build"
target="build"
/>
<nant
buildfile="src/NHibernate.Test/NHibernate.Test.build"
target="build"
/>

</target>

<target name="test" depends="build" description="Runs the tests contained in NHibernate.Test" >
<!--
Tell nhibernate how to connect to the test database.
-->
<xmlpoke
file="${build.dir}/bin/NHibernate.Test.dll.config"
xpath="/configuration/nhibernate/add[@key='hibernate.dialect']/@value"
value="${nhibernate.dialect}"
/>
<xmlpoke
file="${build.dir}/bin/NHibernate.Test.dll.config"
xpath="/configuration/nhibernate/add[@key='hibernate.connection.driver_class']/@value"
value="${nhibernate.connection.driver_class}"
/>
<xmlpoke
file="${build.dir}/bin/NHibernate.Test.dll.config"
xpath="/configuration/nhibernate/add[@key='hibernate.connection.connection_string']/@value"
value="${nhibernate.connection.connection_string}"
/>

<nant
buildfile="src/NHibernate.Test/NHibernate.Test.build"
target="test"
/>

<!--
Remove the connnection string information that was just entered...
-->
<xmlpoke
file="${build.dir}/bin/NHibernate.Test.dll.config"
xpath="/configuration/nhibernate/add[@key='hibernate.connection.connection_string']/@value"
value="conn string here"
/>

</target>

<target name="set-runtime-configuration">
<!--
We are not building for anything but the .net 1.1 framework right now
-->

<call target="set-net-1.1-runtime-configuration" />
<!--
<ifnot propertyexists="current.runtime.config">
<ifnot propertyexists="nant.settings.currentframework">
<fail message="No runtime configuration was specified and the default NAnt runtime is not available." />
</ifnot>
<ifnot targetexists="set-${nant.settings.currentframework}-runtime-configuration">
<fail message="No runtime configuration was specified and the current runtime (${nant.settings.currentframework}) is not supported by NAnt." />
</ifnot>
<call target="set-${nant.settings.currentframework}-runtime-configuration"/>
</ifnot>
<ifnot propertyexists="current.runtime.version">
<ifnot propertyexists="nant.settings.currentframework">
<fail message="No runtime configuration was specified and the default NAnt runtime is not available." />
</ifnot>
<ifnot targetexists="set-${nant.settings.currentframework}-runtime-configuration">
<fail message="No runtime configuration was specified and the current runtime (${nant.settings.currentframework}) is not supported by NDoc." />
</ifnot>
<call target="set-${nant.settings.currentframework}-runtime-configuration" />
</ifnot>
<ifnot targetexists="set-${current.runtime.config}-${current.runtime.version}-runtime-configuration">
<fail message="The ${current.runtime.config}-${current.runtime.version} runtime is not supported by NDoc." />
</ifnot>
<call target="set-${current.runtime.config}-${current.runtime.version}-runtime-configuration"/>
-->
</target>

<target name="set-runtime-configuration-flags">
<property name="current.runtime.config.net" value="false" />
<property name="current.runtime.config.netcf" value="false" />
<property name="current.runtime.config.mono" value="false" />
<property name="current.runtime.config.sscli" value="false" />
<property name="current.runtime.config.${current.runtime.config}" value="true" />
<property name="current.runtime.net-1.0" value="false" />
<property name="current.runtime.net-1.1" value="false" />
<property name="current.runtime.net-1.2" value="false" />
<property name="current.runtime.netcf-1.0" value="false" />
<property name="current.runtime.mono-1.0" value="false" />
<property name="current.runtime.sscli-1.0" value="false" />
<property name="current.runtime.${current.runtime.config}-${current.runtime.version}" value="true" />
</target>

<target name="set-net-1.1-runtime-configuration">
<property name="current.runtime.config" value="net" />
<property name="current.runtime.version" value="1.1" />
<property name="current.runtime.description" value="Microsoft .NET Framework 1.1" />
<property name="current.build.defines" value="${build.defines}NET,NET_1_1" />
<property name="link.sdkdoc.version" value="SDK_v1_1" />
<property name="lib.dir" value="lib/${current.runtime.config}/${current.runtime.version}" />
<property name="nant.settings.currentframework" value="${current.runtime.config}-${current.runtime.version}" />
<call target="set-runtime-configuration-flags" />
</target>

<target name="sdkdoc" depends="init" description="Generates MSDN sytle documentation">
<ndoc>
<assemblies basedir="${build.dir}/bin">
<includes name="NHibernate.dll" />
</assemblies>

<documenters>
<documenter name="MSDN">
<property name="OutputDirectory" value="${build.dir}/doc/sdk" />
<property name="HtmlHelpName" value="NHibernate-SDK" />
<property name="IncludeFavorites" value="False" />
<property name="Title" value="NHibernate Class Library - v.${project.version}" />
<property name="SplitTOCs" value="False" />
<property name="DefaulTOC" value="" />
<property name="IncludeHierarchy" value="False" />
<property name="ShowVisualBasic" value="False" />
<property name="RootPageContainsNamespaces" value="False" />
<property name="SortTOCByNamespace" value="True" />
<property name="OutputTarget" value="HtmlHelp" />
<property name="HeaderHtml" value="" />
<property name="FooterHtml" value="" />
<property name="FilesToInclude" value="" />
<property name="LinkToSdkDocVersion" value="SDK_v1_1" />
<property name="ShowMissingSummaries" value="${build.debug}" />
<property name="ShowMissingRemarks" value="${build.debug}" />
<property name="ShowMissingParams" value="${build.debug}" />
<property name="ShowMissingReturns" value="${build.debug}" />
<property name="ShowMissingValues" value="${build.debug}" />
<property name="DocumentInternals" value="False" />
<property name="DocumentProtected" value="True" />
<property name="DocumentPrivates" value="False" />
<property name="DocumentProtectedInternalAsProtected" value="False" />
<property name="DocumentEmptyNamespaces" value="False" />
<property name="IncludeAssemblyVersion" value="False" />
<property name="CopyrightText" value="" />
<property name="CopyrightHref" value="" />
<property name="ReferencesPath" value="" />
<property name="SkipNamespacesWithoutSummaries" value="False" />
<property name="UseNamespaceDocSummaries" value="False" />
<property name="AutoPropertyBackerSummaries" value="False" />
<property name="AutoDocumentConstructors" value="True" />
<property name="DocumentAttributes" value="False" />
<property name="ShowTypeIdInAttributes" value="False" />
<property name="DocumentedAttributes" value="" />
<property name="GetExternalSummaries" value="True" />
<property name="EditorBrowsableFilter" value="Off" />
<property name="UseNDocXmlFile" value="" />
</documenter>
</documenters>
</ndoc>
</target>


<target name="package" depends="test sdkdoc" description="Creates Zip files for the File Release System on SourceForge">
<copy todir="${build.dir}">
<fileset>
<!-- exclude the UnitTesting project that is no longer used -->
<excludes name="src/UnitTesting/**" />

<includes name="src/**" />

<!-- exclude VS.NET stuff -->
<excludes name="**/*.suo" />
<excludes name="**/*j.user" />
<excludes name="**/bin/**" />
<excludes name="**/obj/**" />

</fileset>
</copy>
<property name="project.zip-path" value="${nant.project.basedir}/build/${project.name}-${project.version}.zip" />

<zip zipfile="${project.zip-path}">
<fileset basedir="${build.dir}">
<includes name="**/*" />
</fileset>
</zip>

<echo message="Create a '${project.config}' package ast file://${project.zip-path}" />

</target>

</project>
15 changes: 15 additions & 0 deletions sample build commands.txt
@@ -0,0 +1,15 @@
##
## This file contains sample commands to build NHibernate using the build files.
## It should be run from the nhibernate directory that contains the
## NHibernateSolution.build file.
##
## If you are going to run the Test make sure to set the connection information.
##
##


NAnt -D:project.config=release clean build >output-release-build.log

NAnt clean build >output-debug-build.log

NAnt -D:project.config=release -D:nhibernate.dialect="NHibernate.Dialect.MsSql2000Dialect" -D:nhibernate.connection.driver_class="NHibernate.Driver.SqlClientDriver" -D:nhibernate.connection.connection_string="Server=localhost;initial catalog=nhibernate;User ID=blah;Password=blah;Min Pool Size=2" clean package >output-release-package.log
54 changes: 23 additions & 31 deletions src/NHibernate.DomainModel/NHibernate.DomainModel.build
@@ -1,47 +1,39 @@
<?xml version="1.0" ?>
<project name="NHibernate.DomainModel" default="buildDebug" basedir="." xmlns="http://nant.sf.net/schemas/nant-0.84.win32.net-1.0.xsd">

<property name="nant.settings.currentframework" value="net-1.1" />
<property name="externalBin" value="../../external-bin" />


<target name="buildDebug">

<project
name="NHibernate.DomainModel"
default="build"
xmlns="http://nant.sf.net/schemas/nant-0.84.win32.net-1.0.xsd"
>

<!--
Required properties:
* build.dir - (path) root level to build to, assemblies will go in ${build.dir}/bin
* build.debug - (true|false) debug build?
* current.build.defines - framework-specific build defines
-->
<target name="build" description="Build the DomainModel that will be used by the Tests">

<delete dir="bin/Debug" failonerror="false" />
<mkdir dir="bin/Debug" />
<csc
target="library"
define="${current.build.defines}"
debug="${build.debug}"
output="${build.dir}/bin/${nant.project.name}.dll"
>

<csc target="library" output="bin/Debug/NHibernate.DomainModel.dll" debug="true">
<references>
<includes name="System.dll" />
<includes name="System.XML.dll" />
<includes name="System.Data.dll" />
<includes name="${build.dir}/bin/NHibernate.dll" />
</references>

<resources prefix="NHibernate.DomainModel" dynamicprefix="true">
<includes name="**/*.xml" />
<excludes name="bin/**/*.xml" />
</resources>
<sources>
<includes name="**/*.cs" />
</sources>
</csc>

</target>

<target name="buildRelease">

<delete dir="bin/Release" failonerror="false" />
<mkdir dir="bin/Release" />

<csc target="library" output="bin/Release/NHibernate.DomainModel.dll" debug="false">
<references>
<includes name="System.dll" />
<includes name="System.XML.dll" />
<includes name="System.Data.dll" />
</references>
<resources prefix="NHibernate.DomainModel" dynamicprefix="true">
<includes name="**/*.xml" />
</resources>
<sources>
<sources failonempty="true">
<includes name="**/*.cs" />
</sources>
</csc>
Expand Down

0 comments on commit 5d5318c

Please sign in to comment.