AirScout/BouncyCastle/crypto/NBuild.build

248 wiersze
10 KiB
XML

<?xml version="1.0"?>
<project name="bccrypto-csharp" default="compile-release" basedir=".">
<!-- Source control properties -->
<property name="GITURL" value="ssh://git@gitlab.cryptoworkshop.com:1022/root/bc-csharp" />
<property name="GITCMD" value="C:/Program Files/Git/bin/git.exe" />
<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="test-libpath" value="./test/lib" />
<property name="test-binpath" value="./test/bin"/>
<property name="dist-path" value="./dist"/>
<!-- Version -->
<property name="version" value="1.9.0"/>
<property name="name" value="BouncyCastle.Crypto"/>
<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_2_0" />
<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-3.5-framework-props">
<property name="compile-defines" value="NET_2_0" />
<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-4.0-framework-props">
<property name="compile-defines" value="NET_2_0" />
<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_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-net-3.5-framework-props">
<property name="compile-defines" value="NET_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-net-4.0-framework-props">
<property name="compile-defines" value="NET_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-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}">
<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}">
<sources>
<include name="${test-srcpath}/**/*.cs"/>
</sources>
<resources prefix="crypto" dynamicprefix="true">
<include name="${test-datapath}/**/*.*"/>
<exclude name="${test-datapath}/**/README.txt"/>
<exclude name="${test-datapath}/tls/*.tmpl"/>
</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}">
<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}"/>
<exec program="${GITCMD}" verbose="true" workingdir="..">
<arg value="archive" />
<arg line="--format zip" />
<arg value="--output" />
<arg path="${dist-path}/bccrypto-csharp-${version}-src.zip" />
<arg value="--prefix" />
<arg value="bccrypto-csharp-${version}/" />
<arg value="--remote" />
<arg value="${GITURL}" />
<arg value="release-${version}" />
<arg value="-9" />
</exec>
<unzip zipfile="${dist-path}/bccrypto-csharp-${version}-src.zip" todir="${dist-path}/src" />
<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/bccrypto-csharp-${version}/crypto/${api-srcpath}/**/*.cs"/>
<include name="${dist-path}/src/bccrypto-csharp-${version}/crypto/${bzip2-srcpath}/**/*.cs"/>
</sources>
<references>
<include name="mscorlib.dll"/>
<include name="System.dll"/>
</references>
</csc>
<zip zipfile="${dist-path}/bccrypto-csharp-${version}-bin.zip" ziplevel="9">
<fileset basedir="${dist-path}">
<include name="${name}.dll" />
</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>