[DEV] basic ant file
This commit is contained in:
parent
eb831f6804
commit
58dfb8f59f
199
build.xml
Normal file
199
build.xml
Normal file
@ -0,0 +1,199 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<project basedir="." default="build" name="scenarium-logger" xmlns:jacoco="antlib:org.jacoco.ant">
|
||||
<property environment="env"/>
|
||||
<property name="colos-network.location" value="../spearhead/colos"/>
|
||||
<property name="plugin-manager.location" value="../plugin-manager"/>
|
||||
<property name="scenarium-base.location" value="../scenarium-base"/>
|
||||
<property name="scenarium-core.location" value="../scenarium-core/core"/>
|
||||
<property name="scenarium-river.location" value="../scenarium-river"/>
|
||||
<property name="scenarium-run.location" value="../scenarium-run"/>
|
||||
<property name="junit.output.dir" value="junit"/>
|
||||
<property name="debuglevel" value="source,lines,vars"/>
|
||||
<property name="target" value="14"/>
|
||||
<property name="source" value="14"/>
|
||||
|
||||
<property name="result.dir" location="./target" />
|
||||
<property name="result.classes.dir" location="${result.dir}/classes" />
|
||||
<property name="result.report.dir" location="${result.dir}/site/jacoco" />
|
||||
<property name="result.exec.file" location="${result.dir}/jacoco.exec" />
|
||||
<!-- Step 1: Import JaCoCo Ant tasks -->
|
||||
<taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">
|
||||
<classpath path="/home/heero/jacoco/jacocoant.jar" />
|
||||
</taskdef>
|
||||
<property name="libPath" value="${user.home}"/>
|
||||
<!--
|
||||
mkdir -p extern/lib
|
||||
cd extern/lib
|
||||
wget https://repo1.maven.org/maven2/org/junit/platform/junit-platform-commons/1.6.2/junit-platform-commons-1.6.2.jar
|
||||
wget https://repo1.maven.org/maven2/org/junit/platform/junit-platform-engine/1.6.2/junit-platform-engine-1.6.2.jar
|
||||
wget https://repo1.maven.org/maven2/org/junit/platform/junit-platform-launcher/1.6.2/junit-platform-launcher-1.6.2.jar
|
||||
wget https://repo1.maven.org/maven2/org/opentest4j/opentest4j/1.2.0/opentest4j-1.2.0.jar
|
||||
wget https://repo1.maven.org/maven2/junit/junit/4.13/junit-4.13.jar
|
||||
wget https://repo1.maven.org/maven2/org/apiguardian/apiguardian-api/1.1.0/apiguardian-api-1.1.0.jar
|
||||
wget https://repo1.maven.org/maven2/org/junit/jupiter/junit-jupiter-api/5.6.2/junit-jupiter-api-5.6.2.jar
|
||||
wget https://repo1.maven.org/maven2/org/junit/jupiter/junit-jupiter-engine/5.6.2/junit-jupiter-engine-5.6.2.jar
|
||||
wget https://repo1.maven.org/maven2/org/junit/vintage/junit-vintage-engine/5.6.2/junit-vintage-engine-5.6.2.jar
|
||||
wget https://repo1.maven.org/maven2/org/junit/jupiter/junit-jupiter-params/5.6.2/junit-jupiter-params-5.6.2.jar
|
||||
wget https://repo1.maven.org/maven2/org/junit/platform/junit-platform-runner/1.6.2/junit-platform-runner-1.6.2.jar
|
||||
wget https://repo1.maven.org/maven2/org/junit/jupiter/junit-jupiter-migrationsupport/5.6.2/junit-jupiter-migrationsupport-5.6.2.jar
|
||||
wget https://repo1.maven.org/maven2/org/hamcrest/hamcrest-core/2.2/hamcrest-core-2.2.jar
|
||||
wget https://repo1.maven.org/maven2/org/junit/platform/junit-platform-suite-api/1.6.2/junit-platform-suite-api-1.6.2.jar
|
||||
wget https://repo1.maven.org/maven2/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar
|
||||
-->
|
||||
<path id="junit.classpath">
|
||||
<pathelement location="${basedir}/extern/lib/junit-jupiter-api-5.6.2.jar"/>
|
||||
<pathelement location="${basedir}/extern/lib/junit-jupiter-engine-5.6.2.jar"/>
|
||||
<pathelement location="${basedir}/extern/lib/junit-jupiter-migrationsupport-5.6.2.jar"/>
|
||||
<pathelement location="${basedir}/extern/lib/junit-jupiter-params-5.6.2.jar"/>
|
||||
<pathelement location="${basedir}/extern/lib/junit-platform-commons-1.6.2.jar"/>
|
||||
<pathelement location="${basedir}/extern/lib/junit-platform-engine-1.6.2.jar"/>
|
||||
<pathelement location="${basedir}/extern/lib/junit-platform-launcher-1.6.2.jar"/>
|
||||
<pathelement location="${basedir}/extern/lib/junit-jupiter-runner-5.6.2.jar"/>
|
||||
<pathelement location="${basedir}/extern/lib/junit-platform-suite-api-1.6.2.jar"/>
|
||||
<pathelement location="${basedir}/extern/lib/junit-vintage-engine-5.6.2.jar"/>
|
||||
<pathelement location="${basedir}/extern/lib/opentest4j-1.2.0.jar"/>
|
||||
<pathelement location="${basedir}/extern/lib/apiguardian-api-1.1.0.jar"/>
|
||||
<pathelement location="${basedir}/extern/lib/junit-4.13.jar"/>
|
||||
<pathelement location="${basedir}/extern/lib/hamcrest-core-1.3.jar"/>
|
||||
</path>
|
||||
<path id="scenarium-logger.classpath">
|
||||
<pathelement location="target/classes"/>
|
||||
<pathelement location="target/test-classes"/>
|
||||
<path refid="junit.classpath"/>
|
||||
</path>
|
||||
<path id="run.TestBasicLog.classpath">
|
||||
<path refid="scenarium-logger.classpath"/>
|
||||
<path refid="junit.classpath"/>
|
||||
</path>
|
||||
<target name="init">
|
||||
<mkdir dir="target/classes"/>
|
||||
<mkdir dir="target/test-classes"/>
|
||||
<copy includeemptydirs="false" todir="target/classes">
|
||||
<fileset dir="src">
|
||||
<exclude name="**/*.launch"/>
|
||||
<exclude name="**/*.java"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
<copy includeemptydirs="false" todir="target/test-classes">
|
||||
<fileset dir="test/src">
|
||||
<include name="**/*.java"/>
|
||||
<exclude name="**/*.launch"/>
|
||||
<exclude name="**/*.java"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
</target>
|
||||
<target name="clean">
|
||||
<delete dir="target/classes"/>
|
||||
<delete dir="target/test-classes"/>
|
||||
</target>
|
||||
<target depends="clean" name="cleanall"/>
|
||||
<target depends="build-subprojects,build-project" name="build"/>
|
||||
<target name="build-subprojects"/>
|
||||
<target depends="init" name="build-project">
|
||||
<echo message="${ant.project.name}: ${ant.file}"/>
|
||||
<javac debug="true" debuglevel="${debuglevel}" destdir="target/classes" includeantruntime="false" source="${source}" target="${target}">
|
||||
<src path="src"/>
|
||||
<classpath refid="scenarium-logger.classpath"/>
|
||||
</javac>
|
||||
<javac debug="true" debuglevel="${debuglevel}" destdir="target/test-classes" includeantruntime="false" source="${source}" target="${target}">
|
||||
<src path="test/src"/>
|
||||
<include name="**/*.java"/>
|
||||
<classpath refid="scenarium-logger.classpath"/>
|
||||
</javac>
|
||||
</target>
|
||||
<target description="Build all projects which reference this project. Useful to propagate changes." name="build-refprojects">
|
||||
<ant antfile="build_old.xml" dir="${colos-network.location}" inheritAll="false" target="clean"/>
|
||||
<ant antfile="build_old.xml" dir="${colos-network.location}" inheritAll="false" target="build">
|
||||
<propertyset>
|
||||
<propertyref name="build.compiler"/>
|
||||
</propertyset>
|
||||
</ant>
|
||||
<ant antfile="build_old.xml" dir="${plugin-manager.location}" inheritAll="false" target="clean"/>
|
||||
<ant antfile="build_old.xml" dir="${plugin-manager.location}" inheritAll="false" target="build">
|
||||
<propertyset>
|
||||
<propertyref name="build.compiler"/>
|
||||
</propertyset>
|
||||
</ant>
|
||||
<ant antfile="build_old.xml" dir="${scenarium-base.location}" inheritAll="false" target="clean"/>
|
||||
<ant antfile="build_old.xml" dir="${scenarium-base.location}" inheritAll="false" target="build">
|
||||
<propertyset>
|
||||
<propertyref name="build.compiler"/>
|
||||
</propertyset>
|
||||
</ant>
|
||||
<ant antfile="build_old.xml" dir="${scenarium-core.location}" inheritAll="false" target="clean"/>
|
||||
<ant antfile="build_old.xml" dir="${scenarium-core.location}" inheritAll="false" target="build">
|
||||
<propertyset>
|
||||
<propertyref name="build.compiler"/>
|
||||
</propertyset>
|
||||
</ant>
|
||||
<ant antfile="build_old.xml" dir="${scenarium-river.location}" inheritAll="false" target="clean"/>
|
||||
<ant antfile="build_old.xml" dir="${scenarium-river.location}" inheritAll="false" target="build">
|
||||
<propertyset>
|
||||
<propertyref name="build.compiler"/>
|
||||
</propertyset>
|
||||
</ant>
|
||||
<ant antfile="build_old.xml" dir="${scenarium-run.location}" inheritAll="false" target="clean"/>
|
||||
<ant antfile="build_old.xml" dir="${scenarium-run.location}" inheritAll="false" target="build">
|
||||
<propertyset>
|
||||
<propertyref name="build.compiler"/>
|
||||
</propertyset>
|
||||
</ant>
|
||||
</target>
|
||||
<target description="copy Eclipse compiler jars to ant lib directory" name="init-eclipse-compiler">
|
||||
<copy todir="${ant.library.dir}">
|
||||
<fileset dir="${ECLIPSE_HOME}/plugins" includes="org.eclipse.jdt.core_*.jar"/>
|
||||
</copy>
|
||||
<unzip dest="${ant.library.dir}">
|
||||
<patternset includes="jdtCompilerAdapter.jar"/>
|
||||
<fileset dir="${ECLIPSE_HOME}/plugins" includes="org.eclipse.jdt.core_*.jar"/>
|
||||
</unzip>
|
||||
</target>
|
||||
<target description="compile project with Eclipse compiler" name="build-eclipse-compiler">
|
||||
<property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/>
|
||||
<antcall target="build"/>
|
||||
</target>
|
||||
<target name="TestBasicLog">
|
||||
<mkdir dir="${junit.output.dir}"/>
|
||||
<jacoco:coverage destfile="${result.exec.file}">
|
||||
<junit fork="yes" printsummary="withOutAndErr">
|
||||
<formatter type="xml"/>
|
||||
<test name="test.scenarium.logger.TestBasicLog" todir="${junit.output.dir}"/>
|
||||
<jvmarg line="-ea"/>
|
||||
<classpath refid="run.TestBasicLog.classpath"/>
|
||||
</junit>
|
||||
</jacoco:coverage>
|
||||
</target>
|
||||
<target name="test" depends="TestBasicLog">
|
||||
</target>
|
||||
<target name="report" depends="test">
|
||||
<!-- Step 3: Create coverage report -->
|
||||
<jacoco:report>
|
||||
|
||||
<!-- This task needs the collected execution data and ... -->
|
||||
<executiondata>
|
||||
<file file="${result.exec.file}" />
|
||||
</executiondata>
|
||||
|
||||
<!-- the class files and optional source files ... -->
|
||||
<structure name="JaCoCo Ant Example">
|
||||
<classfiles>
|
||||
<fileset dir="${result.classes.dir}" />
|
||||
</classfiles>
|
||||
<sourcefiles encoding="UTF-8">
|
||||
<fileset dir="src" />
|
||||
</sourcefiles>
|
||||
</structure>
|
||||
|
||||
<!-- to produce reports in different formats. -->
|
||||
<html destdir="${result.report.dir}" />
|
||||
<csv destfile="${result.report.dir}/report.csv" />
|
||||
<xml destfile="${result.report.dir}/report.xml" />
|
||||
</jacoco:report>
|
||||
<junitreport todir="${junit.output.dir}">
|
||||
<fileset dir="${junit.output.dir}">
|
||||
<include name="TEST-*.xml"/>
|
||||
</fileset>
|
||||
<report format="frames" todir="${junit.output.dir}"/>
|
||||
</junitreport>
|
||||
</target>
|
||||
</project>
|
Loading…
Reference in New Issue
Block a user