summary refs log tree commit diff
path: root/crypto/NBuild.build
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/NBuild.build')
-rw-r--r--crypto/NBuild.build265
1 files changed, 265 insertions, 0 deletions
diff --git a/crypto/NBuild.build b/crypto/NBuild.build
new file mode 100644
index 000000000..9c4488c38
--- /dev/null
+++ b/crypto/NBuild.build
@@ -0,0 +1,265 @@
+<?xml version="1.0"?>
+<project name="bccrypto-csharp" default="compile-release" basedir=".">
+
+	<!-- Source control properties -->
+	<property name="CVSROOT"
+		value=":pserver:anonymous@cvs.bouncycastle.org:/home/users/bouncy/cvsroot" />
+	<property name="sourcecontrol.usesharpcvslib" value="false" />
+	<property name="CVSCMD" value="C:/Program Files (x86)/CVSNT/cvs.exe" />
+  <!--<property name="CVSCMD" value="C:/Program Files/CVSNT/cvs.exe" />-->
+  <!--<property name="CVSCMD" value="/usr/bin/cvs" />-->
+
+	<property name="api-debugpath" value="./api/bin/debug" />
+	<property name="api-releasepath" value="./api/bin/release" />
+	<property name="api-srcpath" value="./src" />
+	<property name="bzip2-srcpath" value="./bzip2/src" />
+	<property name="test-srcpath" value="./test/src" />
+	<property name="test-datapath" value="./test/data" />
+	<property name="api-spikepath" value="./spike" />
+	<property name="test-libpath" value="./test/lib" />
+	<property name="test-binpath" value="./test/bin"/>
+	<property name="dist-path" value="./dist"/>
+
+	<!-- Version -->
+	<property name="version" value="1.7"/>
+	<property name="name" value="BouncyCastle.Crypto"/>
+	<property name="name-ext" value="BouncyCastle.CryptoExt"/>
+
+	<property name="OPTIONAL_INCLUDE_IDEA" value="" />
+	<if test="${file::exists(api-srcpath + '/crypto/engines/IdeaEngine.cs')}">
+		<echo>Include extended algorithm set (IDEA)</echo> 
+		<property name="OPTIONAL_INCLUDE_IDEA" value=";INCLUDE_IDEA" />
+	</if>
+
+	<property name="OPTIONAL_STRONG_NAME" value="" />
+	<if test="${property::exists('use-strong-name') and use-strong-name}">
+		<echo>Compile targets will be signed using keyfile ../BouncyCastle.snk</echo> 
+		<property name="OPTIONAL_STRONG_NAME" value=";STRONG_NAME" />
+	</if>
+
+	<target name="init">
+		<call target="set-framework-props" />
+	</target>
+
+	<target name="set-framework-props">
+		<if test="${not(target::exists('set-'+framework::get-target-framework()+'-framework-props'))}">
+			<fail message="Unsupported framework: '${framework::get-target-framework()}'." />
+		</if>
+		<call target="set-${framework::get-target-framework()}-framework-props" />
+	</target>
+	<target name="set-mono-1.0-framework-props">
+		<property name="compile-defines" value="NET_1_1" />
+		<property name="debug-extension" value="dll.mdb" />
+		<property name="enable-nostdlib" value="false" />
+		<property name="nunit-console" value="nunit-console" />
+		<property name="switch" value="-" />
+	</target>
+	<target name="set-mono-2.0-framework-props">
+		<property name="compile-defines" value="NET_1_1" />
+		<property name="debug-extension" value="dll.mdb" />
+		<property name="enable-nostdlib" value="false" />
+		<property name="nunit-console" value="nunit-console" />
+		<property name="switch" value="-" />
+	</target>
+	<target name="set-net-1.1-framework-props">
+		<property name="compile-defines" value="NET_1_1" />
+		<property name="debug-extension" value="pdb" />
+		<property name="enable-nostdlib" value="true" />
+		<property name="nunit-console" value="nunit-console.exe" />
+		<property name="switch" value="/" />
+	</target>
+	<target name="set-net-2.0-framework-props">
+		<property name="compile-defines" value="NET_1_1" />
+		<property name="debug-extension" value="pdb" />
+		<property name="enable-nostdlib" value="true" />
+		<property name="nunit-console" value="nunit-console.exe" />
+		<property name="switch" value="/" />
+	</target>
+	<target name="set-net-3.5-framework-props">
+		<property name="compile-defines" value="NET_1_1" />
+		<property name="debug-extension" value="pdb" />
+		<property name="enable-nostdlib" value="true" />
+		<property name="nunit-console" value="nunit-console.exe" />
+		<property name="switch" value="/" />
+	</target>
+	<target name="set-net-4.0-framework-props">
+		<property name="compile-defines" value="NET_1_1" />
+		<property name="debug-extension" value="pdb" />
+		<property name="enable-nostdlib" value="true" />
+		<property name="nunit-console" value="nunit-console.exe" />
+		<property name="switch" value="/" />
+	</target>
+	<target name="set-netcf-1.0-framework-props">
+		<property name="compile-defines" value="NETCF_1_0" />
+		<property name="debug-extension" value="pdb" />
+		<property name="enable-nostdlib" value="true" />
+		<property name="nunit-console" value="nunit-console.exe" />
+		<property name="switch" value="/" />
+	</target>
+	<target name="set-netcf-2.0-framework-props">
+		<property name="compile-defines" value="NETCF_2_0" />
+		<property name="debug-extension" value="pdb" />
+		<property name="enable-nostdlib" value="true" />
+		<property name="nunit-console" value="nunit-console.exe" />
+		<property name="switch" value="/" />
+	</target>
+	<target name="set-silverlight-2.0-framework-props">
+		<property name="compile-defines" value="SILVERLIGHT" />
+		<property name="debug-extension" value="pdb" />
+		<property name="enable-nostdlib" value="true" />
+		<property name="nunit-console" value="nunit-console.exe" />
+		<property name="switch" value="/" />
+	</target>
+	<target name="set-silverlight-3.0-framework-props">
+		<property name="compile-defines" value="SILVERLIGHT" />
+		<property name="debug-extension" value="pdb" />
+		<property name="enable-nostdlib" value="true" />
+		<property name="nunit-console" value="nunit-console.exe" />
+		<property name="switch" value="/" />
+	</target>
+	<target name="set-silverlight-4.0-framework-props">
+		<property name="compile-defines" value="SILVERLIGHT" />
+		<property name="debug-extension" value="pdb" />
+		<property name="enable-nostdlib" value="true" />
+		<property name="nunit-console" value="nunit-console.exe" />
+		<property name="switch" value="/" />
+	</target>
+
+	<target name="clean">
+		<delete failonerror="false" dir="./api" />
+		<delete failonerror="false" dir="${dist-path}" />
+		<delete failonerror="false" dir="${test-binpath}" />
+		<delete failonerror="false" file="./TestResult.xml" />
+	</target>
+
+	<!-- Compile api in debug mode and compile tests -->
+	<target name="compile-debug" depends="init">
+		<echo message="Compiling Debug"/>
+		<echo message="Compiling API in debug mode."/>
+		<mkdir dir="${api-debugpath}"/>
+		<csc target="library" noconfig="true" nostdlib="${enable-nostdlib}" output="${api-debugpath}/${name}.dll"
+			verbose="false" debug="true" define="${compile-defines}${OPTIONAL_STRONG_NAME}${OPTIONAL_INCLUDE_IDEA}">
+			<sources>
+				<include name="${api-srcpath}/**/*.cs"/>
+				<include name="${bzip2-srcpath}/**/*.cs"/>
+			</sources>
+			<references>
+				<include name="mscorlib.dll"/>
+				<include name="System.dll"/>
+			</references>
+		</csc>
+
+		<copy todir="${test-binpath}">
+			<fileset basedir="${test-libpath}">
+				<include name="*.dll" />
+			</fileset>
+		</copy>
+		<copy file="${api-debugpath}/${name}.dll" tofile="${test-binpath}/${name}.dll" />
+		<copy file="${api-debugpath}/${name}.${debug-extension}"
+				tofile="${test-binpath}/${name}.${debug-extension}" />
+
+		<echo message="Compiling Tests."/>
+		<mkdir dir="${api-debugpath}"/>
+		<csc target="library" noconfig="true" nostdlib="${enable-nostdlib}" output="${test-binpath}/BCTest.dll"
+			verbose="false" debug="true" define="${compile-defines}${OPTIONAL_STRONG_NAME}${OPTIONAL_INCLUDE_IDEA}">
+			<sources>
+				<include name="${test-srcpath}/**/*.cs"/>
+			</sources>
+			<resources prefix="crypto" dynamicprefix="true">
+				<include name="${test-datapath}/**/*.*"/>
+				<exclude name="${test-datapath}/**/README.txt"/>
+			</resources>
+			<references>
+				<include name="mscorlib.dll"/>
+				<include name="System.dll"/>
+				<include name="${test-libpath}/*.dll"/>
+				<include name="${test-binpath}/${name}.dll"/>
+			</references>
+		</csc>
+	</target>
+
+	<!-- Compile Release.-->
+	<target name="compile-release" depends="init">
+		<echo message="Compiling Release"/>
+		<echo message="Compiling API in release mode."/>
+		<mkdir dir="${api-releasepath}"/>
+		<csc target="library" noconfig="true" nostdlib="${enable-nostdlib}" output="${api-releasepath}/${name}.dll"
+			verbose="false" debug="false" optimize="true" define="${compile-defines}${OPTIONAL_STRONG_NAME}${OPTIONAL_INCLUDE_IDEA}">
+			<sources>
+				<include name="${api-srcpath}/**/*.cs"/>
+				<include name="${bzip2-srcpath}/**/*.cs"/>
+			</sources>
+			<references>
+				<include name="mscorlib.dll"/>
+				<include name="System.dll"/>
+			</references>
+		</csc>
+	</target>
+
+	<!-- Make distribution.-->
+	<target name="dist" depends="init">
+		<echo message="Building signed assemblies for release ${version}"/>
+		<mkdir dir="${dist-path}"/>
+		<cvs-export cvsfullpath="${CVSCMD}" cvsroot="${CVSROOT}"
+			destination="${dist-path}/src" module="csharp" revision="release-${string::replace(version,'.','_')}" />
+
+		<!-- One version without the IDEA stuff -->
+		<csc target="library" noconfig="true" nostdlib="${enable-nostdlib}" output="${dist-path}/${name}.dll"
+			verbose="false" debug="false" optimize="true" define="${compile-defines};STRONG_NAME">
+			<sources>
+				<include name="${dist-path}/src/csharp/crypto/${api-srcpath}/**/*.cs"/>
+				<include name="${dist-path}/src/csharp/crypto/${bzip2-srcpath}/**/*.cs"/>
+				<exclude name="${dist-path}/src/csharp/crypto/${api-srcpath}/asn1/misc/IDEACBCPar.cs"/>
+				<exclude name="${dist-path}/src/csharp/crypto/${api-srcpath}/crypto/engines/IdeaEngine.cs"/>
+			</sources>
+			<references>
+				<include name="mscorlib.dll"/>
+				<include name="System.dll"/>
+			</references>
+		</csc>
+		<zip zipfile="${dist-path}/bccrypto-net-${version}-bin.zip">
+			<fileset basedir="${dist-path}">
+				<include name="${name}.dll" />
+			</fileset>
+		</zip>
+		<zip zipfile="${dist-path}/bccrypto-net-${version}-src.zip">
+			<fileset basedir="${dist-path}/src">
+				<include name="**/*"/>
+				<exclude name="csharp/crypto/${api-srcpath}/asn1/misc/IDEACBCPar.cs"/>
+				<exclude name="csharp/crypto/${api-srcpath}/crypto/engines/IdeaEngine.cs"/>
+				<exclude name="csharp/crypto/${test-srcpath}/crypto/test/IDEATest.cs"/>
+			</fileset>
+		</zip>
+
+		<!-- One version with everything -->
+		<csc target="library" noconfig="true" nostdlib="${enable-nostdlib}" output="${dist-path}/${name-ext}.dll"
+			verbose="false" debug="false" optimize="true" define="${compile-defines};STRONG_NAME;INCLUDE_IDEA">
+			<sources>
+				<include name="${dist-path}/src/csharp/crypto/${api-srcpath}/**/*.cs"/>
+				<include name="${dist-path}/src/csharp/crypto/${bzip2-srcpath}/**/*.cs"/>
+			</sources>
+			<references>
+				<include name="mscorlib.dll"/>
+				<include name="System.dll"/>
+			</references>
+		</csc>
+		<zip zipfile="${dist-path}/bccrypto-net-${version}-bin-ext.zip">
+			<fileset basedir="${dist-path}">
+				<include name="${name-ext}.dll" />
+			</fileset>
+		</zip>
+		<zip zipfile="${dist-path}/bccrypto-net-${version}-src-ext.zip">
+			<fileset basedir="${dist-path}/src">
+				<include name="**/*"/>
+			</fileset>
+		</zip>
+
+	</target>
+
+	<target name="all" depends="compile-debug, compile-release"/>
+
+	<target name="test" depends="compile-debug">
+		<exec program="${nunit-console}" commandline="${switch}labels testcfg.nunit" workingdir="${nant.project.basedir}"></exec>
+	</target>
+
+</project>