mirror of https://github.com/jlizier/jidt
280 lines
12 KiB
XML
Executable File
280 lines
12 KiB
XML
Executable File
<?xml version="1.0" encoding="UTF-8"?>
|
|
<project basedir="." default="build" name="Java Information Dynamics Toolkit" xmlns:if="ant:if">
|
|
<description>
|
|
Build file for the Java Information Dynamics Toolkit
|
|
</description>
|
|
|
|
<!-- set global properties for this build -->
|
|
<property name="version" value="1.3"/>
|
|
<property name="mainfilename" value="infodynamics"/>
|
|
<property name="jarplainname" value="${mainfilename}.jar" />
|
|
<property name="jarversiondistnamezip" value="${mainfilename}-jar-${version}.zip" />
|
|
<property name="distname" value="${mainfilename}-dist-${version}" />
|
|
<property name="distnamezip" value="${distname}.zip" />
|
|
<property name="src" location="java/source"/>
|
|
<property name="bin" location="bin"/>
|
|
<property name="unittestsouttoplevel" location="unittests"/>
|
|
<property name="unittestssrc" location="java/unittests"/>
|
|
<property name="unittestsbin" location="${unittestsouttoplevel}/bin"/>
|
|
<property name="reports.tests" location="${unittestsouttoplevel}/reports"/>
|
|
<property name="javadocsdir" location="javadocs"/>
|
|
<property name="versionfile" value="version-${version}.txt"/>
|
|
<!-- To enable GPU code, uncomment from here... -->
|
|
<property name="enablegpu" value="true"/>
|
|
<!-- ...to here -->
|
|
|
|
<path id="project.classpath">
|
|
<pathelement location="bin"/>
|
|
</path>
|
|
|
|
<path id="apache-classpath">
|
|
<pathelement path="./share/commons-math3-3.5.jar"/>
|
|
</path>
|
|
|
|
<!-- Make required directories -->
|
|
<target name="init" description="Create the compiled code directories">
|
|
<mkdir dir="${bin}"/>
|
|
<mkdir dir="${unittestsbin}"/>
|
|
<mkdir dir="${reports.tests}"/>
|
|
</target>
|
|
|
|
<!-- Compile the java toolkit -->
|
|
<target name="compile" depends="init" description="compile the source and unittests">
|
|
<!-- Compile to Java 7 to provide compatibility for users with older JREs.
|
|
Caveat: The flags here only check the language compatibility, but
|
|
may still use newer libraries which may cause issues for users with JDK 7.
|
|
Indeed, one gets the warning: "bootstrap class path not set in conjunction with -source 1.7"
|
|
To fix this, one would use the bootstrap classpath to point our JDK to an rt.jar
|
|
for Java 7.
|
|
At this stage, I'm sure I'm not using new library calls from Java 8, so we can
|
|
ignore the warning, and I don't want to bother installing Java 7 just to compile
|
|
like this. I'll endeavour not to use JDK 8 libraries so as not to cause
|
|
any issues here ... -->
|
|
<javac srcdir="${src}" destdir="${bin}" includeAntRuntime="false" target="1.7" source="1.7">
|
|
<classpath refid="apache-classpath"/>
|
|
</javac>
|
|
|
|
<!-- Compiling Cpp code -->
|
|
<antcall target="gpu" if:true="${enablegpu}">
|
|
<param name="DEBUG" value="0"/>
|
|
</antcall>
|
|
|
|
</target>
|
|
|
|
<!-- Jar the toolkit -->
|
|
<target name="jar" depends="compile" description="Create the jar for distribution">
|
|
<!-- Put everything in ${bin} into the infodynamics-${version}.jar file -->
|
|
<jar jarfile="${jarplainname}" basedir="${bin}" excludes="**/cuda/"/>
|
|
</target>
|
|
|
|
<!-- Compile and run the JUnit tests -->
|
|
<target name="junit" depends="compile" description="Run the junit tests and make sure they compile">
|
|
|
|
<!-- Compile the junit tests first -->
|
|
<javac destdir="${unittestsbin}" includeAntRuntime="true" debug="true">
|
|
<!-- Need includeAntRuntime=true if you want to pick up junit.jar and ant-junit.jar in ANT_HOME/lib;
|
|
Otherwise you will need to set the classpath to include these here. -->
|
|
<src path="${unittestssrc}"/>
|
|
<classpath refid="project.classpath"/>
|
|
<classpath refid="apache-classpath"/>
|
|
</javac>
|
|
|
|
<!-- Run the junit tests and make sure they complete ok -->
|
|
<junit printsummary="yes" showoutput="yes" fork="true" forkmode="once" haltonfailure="yes" haltonerror="yes" includeantruntime="true">
|
|
<classpath>
|
|
<path refid="project.classpath"/>
|
|
<pathelement path="${unittestsbin}"/>
|
|
<pathelement location="${basedir}/clover.jar"/>
|
|
</classpath>
|
|
<formatter type="plain"/>
|
|
<batchtest todir="${reports.tests}"> <!-- Writes full reports with stdout and stderr to ${reports.tests} -->
|
|
<fileset dir="${unittestsbin}">
|
|
<include name="**/*.class"/>
|
|
<exclude name="**/*AbstractTester.class"/>
|
|
<exclude name="**/ActiveInfoStorageCalculatorCorrelationIntegrals.class"/>
|
|
<exclude name="**/ActiveInfoStorageCalculatorKernelDirect.class"/>
|
|
</fileset>
|
|
</batchtest>
|
|
</junit>
|
|
|
|
<!-- If applicable, run also GPU tests -->
|
|
<antcall target="gputest" if:true="${enablegpu}"/>
|
|
|
|
</target>
|
|
|
|
<!-- Make javadocs, excluding the classes we've derived from Apache Commons Math -->
|
|
<target name="javadocs" depends="compile" description="Make the javadocs for the toolkit">
|
|
<delete dir="${javadocsdir}"/>
|
|
<javadoc destdir="${javadocsdir}">
|
|
<fileset dir="${src}">
|
|
<include name="**/*.java"/>
|
|
<exclude name="**/commonsmath3/*.java"/>
|
|
<exclude name="**/commonsmath3/**/*.java"/>
|
|
</fileset>
|
|
</javadoc>
|
|
<!-- Change some of the style in the javadocs css for our lists: -->
|
|
<concat destfile="${javadocsdir}/stylesheet.css" append="true">
|
|
.block ul li {list-style:disc; margin-left: 20px;}
|
|
.block ol li {list-style:decimal; margin-left: 40px;}
|
|
.block ol li ol li {list-style:lower-alpha; margin-left: 40px;}
|
|
.block ol li ul li {list-style:disc; margin-left: 40px;}
|
|
.block ol li ul li ol li {list-style:lower-alpha; margin-left: 40px;}
|
|
.block ol li ol li ol li {list-style:lower-roman; margin-left: 40px;}
|
|
.block ul li ol li {list-style:decimal; margin-left: 20px;}
|
|
</concat>
|
|
</target>
|
|
|
|
<!-- Clean up -->
|
|
<target name="clean">
|
|
<!-- Delete the compiled code directories -->
|
|
<delete dir="${bin}"/>
|
|
<delete dir="${unittestsbin}"/>
|
|
<delete dir="${reports.tests}"/>
|
|
<delete dir="${unittestsouttoplevel}"/>
|
|
<delete dir="${javadocsdir}"/>
|
|
<delete dir="demos/clojure/target"/>
|
|
<delete file="demos/clojure/pom.xml"/>
|
|
<delete file="demos/clojure/pom.xml.asc"/>
|
|
<delete file="demos/clojure/project.clj"/>
|
|
<delete file="${jarversiondistnamezip}"/>
|
|
<delete file="${distnamezip}"/>
|
|
<delete file="${jarplainname}"/>
|
|
<delete>
|
|
<fileset dir="demos/AutoAnalyser" includes="GeneratedCalculator.*"/>
|
|
</delete>
|
|
<delete>
|
|
<fileset dir="demos/java/infodynamics/demos/autoanalysis" includes="GeneratedCalculator.*"/>
|
|
</delete>
|
|
<antcall target="gpuclean"/>
|
|
<!-- Don't delete the readme and version files - the user may not have the template to recreate them from -->
|
|
</target>
|
|
|
|
<!-- Build the project jar for users -->
|
|
<target name="build" depends="jar" description="user: build the project jar file">
|
|
<echo message="${ant.project.name}: ${ant.file}"/>
|
|
</target>
|
|
|
|
<!--
|
|
***********************************
|
|
|
|
Developer builds below here
|
|
|
|
***********************************
|
|
-->
|
|
|
|
<!-- Compile and jar the toolkit with debug symbols -->
|
|
<target name="debug" depends="init" description="compile and jar with debug symbols">
|
|
<echo message="Compiling for debug"/>
|
|
<javac srcdir="${src}" destdir="${bin}" includeAntRuntime="false" target="1.7" source="1.7" debug="true">
|
|
<classpath refid="apache-classpath"/>
|
|
</javac>
|
|
|
|
<!-- Compiling Cpp code -->
|
|
<antcall target="gpu" if:true="${enablegpu}">
|
|
<param name="DEBUG" value="1"/>
|
|
</antcall>
|
|
|
|
<jar jarfile="${jarplainname}" basedir="${bin}"/>
|
|
</target>
|
|
|
|
<!-- Compile GPU code -->
|
|
<target name="gpu" depends="init" description="compile only C/C++ GPU code">
|
|
<exec executable="make" dir="${src}/infodynamics/measures/continuous/kraskov/cuda/">
|
|
<env key="DEBUG" value="${DEBUG}"/>
|
|
</exec>
|
|
<move todir="${bin}/infodynamics/measures/continuous/kraskov/cuda">
|
|
<filelist dir="${src}/infodynamics/measures/continuous/kraskov/cuda">
|
|
<file name="gpuKnnLibrary.o"/>
|
|
<file name="libgpuKnnLibrary.a"/>
|
|
<file name="libKraskov.so"/>
|
|
</filelist>
|
|
</move>
|
|
</target>
|
|
|
|
<!-- Clean GPU code -->
|
|
<target name="gpuclean" description="clean only C/C++ GPU code">
|
|
<exec executable="make" dir="${src}/infodynamics/measures/continuous/kraskov/cuda/">
|
|
<arg value="clean"/>
|
|
</exec>
|
|
</target>
|
|
|
|
<!-- Test GPU code -->
|
|
<target name="gputest" description="compile and run C unit tests for GPU code">
|
|
|
|
<!-- Compile the GPU unit tests -->
|
|
<exec executable="make" dir="${src}/infodynamics/measures/continuous/kraskov/cuda/">
|
|
<arg value="test"/>
|
|
</exec>
|
|
<move todir="${unittestsbin}/infodynamics/measures/continuous/kraskov/cuda"
|
|
file="${src}/infodynamics/measures/continuous/kraskov/cuda/unittest"/>
|
|
<copy todir="${unittestsbin}/infodynamics/measures/continuous/kraskov/cuda"
|
|
file="${bin}/infodynamics/measures/continuous/kraskov/cuda/libKraskov.so"/>
|
|
|
|
<exec executable="./unittest" dir="${unittestsbin}/infodynamics/measures/continuous/kraskov/cuda/"/>
|
|
|
|
</target>
|
|
|
|
<!-- Developer build - creates readme and version files -->
|
|
<target name="readmefiles" description="developer: create the readme and version files from templates">
|
|
<tstamp>
|
|
<format property="TODAY_DATE" pattern="dd/MM/yyyy" locale="en,UK"/>
|
|
<format property="TODAY_YEAR" pattern="yyyy" locale="en,UK"/>
|
|
</tstamp>
|
|
<copy file="readme-template.txt" toFile="readme.txt" failonerror="false" overwrite="true">
|
|
<!-- The template file only exists in SVN - this won't crash ant
|
|
if users try to run it though because failonerror="false" -->
|
|
<filterset>
|
|
<filter token="YEAR" value="${TODAY_YEAR}"/>
|
|
<filter token="DATE" value="${TODAY_DATE}"/>
|
|
<filter token="VERSION" value="${version}"/>
|
|
</filterset>
|
|
</copy>
|
|
<copy file="version-template.txt" toFile="${versionfile}" failonerror="false">
|
|
<!-- The template file only exists in SVN - this won't crash ant
|
|
if users try to run it though because failonerror="false" -->
|
|
<filterset>
|
|
<filter token="YEAR" value="${TODAY_YEAR}"/>
|
|
<filter token="DATE" value="${TODAY_DATE}"/>
|
|
<filter token="VERSION" value="${version}"/>
|
|
</filterset>
|
|
</copy>
|
|
<copy file="demos/clojure/deploy/project-template.clj" toFile="demos/clojure/deploy/project.clj" failonerror="false" overwrite="true">
|
|
<!-- The template file only exists in SVN - this won't crash ant
|
|
if users try to run it though because failonerror="false" -->
|
|
<filterset>
|
|
<filter token="VERSION" value="${version}"/>
|
|
</filterset>
|
|
</copy>
|
|
</target>
|
|
|
|
<!-- Developer build - builds everything and makes the jar only distribution file -->
|
|
<target name="jardist" depends="build,readmefiles" description="developer: generate the jar distribution">
|
|
<zip destfile="${jarversiondistnamezip}">
|
|
<fileset file="${jarplainname}"/>
|
|
<fileset file="license-gplv3.txt"/>
|
|
<fileset file="readme.txt"/>
|
|
<fileset file="${versionfile}"/>
|
|
<zipfileset dir="notices" includes="**/*.*,**/*" prefix="notices"/>
|
|
</zip>
|
|
</target>
|
|
|
|
<!-- Developer build - builds everything and makes the full distribution file -->
|
|
<target name="dist" depends="jar,junit,javadocs,readmefiles" description="developer: generate the full distribution">
|
|
<echo message="${ant.project.name}: ${ant.file}"/>
|
|
<zip destfile="${distnamezip}">
|
|
<fileset file="build.xml"/>
|
|
<fileset file="${jarplainname}"/>
|
|
<fileset file="license-gplv3.txt"/>
|
|
<fileset file="readme.txt"/>
|
|
<fileset file="InfoDynamicsToolkit.pdf"/>
|
|
<fileset file="${versionfile}"/>
|
|
<zipfileset dir="java" includes="**/*.java" prefix="java"/>
|
|
<zipfileset dir="demos" includes="**/*.*,**/*" excludes="clojure/deploy,clojure/deploy/*.*,python/*.pyc" prefix="demos"/>
|
|
<zipfileset dir="javadocs" includes="**/*.*,**/*" prefix="javadocs"/>
|
|
<zipfileset dir="notices" includes="**/*.*,**/*" prefix="notices"/>
|
|
<zipfileset dir="tutorial" prefix="tutorial"/>
|
|
<zipfileset dir="web" includes="JIDT-logo.png" prefix=""/>
|
|
</zip>
|
|
</target>
|
|
</project>
|