NHibernate In Action

Hibernating with Example

NHibernate Project.Build a sample

tinggalkan komentar »

NHibernate Project.Build a sample

<?xml version="1.0"?>
<project name="Sampel.NHibernate" default="run-tests">
<property name="build.dir" value="build" />
<property name="asm.test.name" value="fatur.sample.NHibernateHelloWorldTest" />
<property name="src.test.dir" value="src/test"/>
<property name="build.debug" value="true"/>
<property name="lib.dir" value="lib"/>
<property name="asm.app.name" value="fatur.sample.NHibernateHelloWorld" />
<property name="src.app.dir" value="src/app"/>
<property name="nhibernate.lib.dir" value="tools/nhibernate/bin/net-2.0"/>
<property name="npsql.lib.dir" value="tools/postgres"/>

		<fileset id="app.sources" failonempty="true">
			<include name="${src.app.dir}/*/*.cs" />
		</fileset>
		<fileset id="test.sources" failonempty="true">
			<include name="${src.test.dir}/*/*.cs" />
		</fileset>

		<assemblyfileset basedir="${build.dir}" id="test.references">
			<include name="System.dll" />
			<include name="nunit.framework.dll"/>
			<include name="NMock2.dll"/>
			<include name="${asm.app.name}.dll"/>
			<include name="NHibernate.dll"/>

		</assemblyfileset>
		<assemblyfileset basedir="${build.dir}" id="app.references">
			<include name="System.dll" />
		</assemblyfileset>

		<target name="build-test" depends="build-app, copy-asm, copy-nhibernate-lib" description="Compile test sources into library">
			<csc target="library" debug="${build.debug}" output="${build.dir}/${asm.test.name}.dll">
				<sources refid="test.sources"/>
				<references refid="test.references" />
			</csc>
		</target>

		<target name="build-app" description="Compile application sources into library">
			<csc target="library" debug="${build.debug}" output="${build.dir}/${asm.app.name}.dll">
				<sources refid="app.sources"/>
				<references refid="app.references" />
			</csc>
		</target>

		<target name="run-tests" depends="build-test, copy-hbm-file, copy-nhibernate-config, copy-npgsql-lib" description="Run NUnit tests">
			<nunit2>
				<formatter type="Xml" usefile="true" extension=".xml" outputdir="${build.dir}"/>
				<test assemblyname="${build.dir}/${asm.test.name}.dll"/>
			</nunit2>
		</target>

		<target name="copy-asm" description="Copy library from lib to build for references">
			<copy todir="${build.dir}">
				<fileset basedir="${lib.dir}">
					<include name="nunit.framework.dll" />
					<include name="NMock2.dll" />
				</fileset>
			</copy>
		</target>

		<target name="copy-nhibernate-lib" description="Copy NHibernate library from lib to build for references">
			<copy todir="${build.dir}">
				<fileset basedir="${nhibernate.lib.dir}">
					<include name="*.dll" />
				</fileset>
			</copy>
		</target>

		<target name="copy-nhibernate-config" description="Copy Nhibernate config to build for nunit run test">
			<copy todir="${build.dir}">
				<fileset basedir="${src.test.dir}/fatur.sample.NHibernateHelloWorldTest">
					<include name="hibernate.cfg.xml" />
				</fileset>
			</copy>
		</target>

		<target name="copy-hbm-file" description="Copy hbm file to build for mapping run test">
			<copy todir="${build.dir}">
				<fileset basedir="${src.app.dir}/fatur.sample.NHibernateHelloWorld/mapping">
					<include name="Product.hbm.xml" />
				</fileset>
			</copy>
		</target>

		<target name="copy-npgsql-lib" description="Copy npgsql lib to build for db connection run test">
			<copy todir="${build.dir}">
				<fileset basedir="${npsql.lib.dir}">
					<include name="*.dll" />
				</fileset>
			</copy>
		</target>
	</project>

Ditulis oleh h4kun4m4t4t4

Februari 9, 2009 pada 3:38 am

Ditulis dalam Uncategorized

Tinggalkan Balasan

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Ubah )

Twitter picture

You are commenting using your Twitter account. Log Out / Ubah )

Facebook photo

You are commenting using your Facebook account. Log Out / Ubah )

Connecting to %s

Ikuti

Get every new post delivered to your Inbox.