[DEV] basic version of ant

This commit is contained in:
Edouard DUPIN 2020-09-06 21:48:32 +02:00
parent 58dfb8f59f
commit 487cba9ccb

248
build.xml
View File

@ -1,22 +1,17 @@
<?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 environment="env"/>
<property name="debuglevel" value="source,lines,vars"/>
<!-- configure dependency of JAVA -->
<property name="target" value="14"/>
<property name="source" value="14"/>
<property name="result.dir" location="./out/ant/" />
<property name="result.juint.dir" location="${result.dir}/junit" />
<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 -->
<!-- Import JaCoCo Ant tasks -->
<taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">
<classpath path="/home/heero/jacoco/jacocoant.jar" />
</taskdef>
@ -40,129 +35,86 @@ wget https://repo1.maven.org/maven2/org/hamcrest/hamcrest-core/2.2/hamcrest-core
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>
<path id="junit.classpath">
<!-- keep all lib in this directiry-->
<fileset dir="${basedir}/extern/lib/"/>
<!--
<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="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="${result.juint.dir}"/>
<jacoco:coverage destfile="${result.exec.file}">
<junit fork="yes" printsummary="withOutAndErr">
<formatter type="xml"/>
<test name="test.scenarium.logger.TestBasicLog" todir="${result.juint.dir}"/>
<jvmarg line="-ea"/>
<classpath refid="run.TestBasicLog.classpath"/>
</junit>
</jacoco:coverage>
</target>
<target name="test" depends="TestBasicLog">
</target>
<target name="report" depends="test">
@ -189,11 +141,21 @@ wget https://repo1.maven.org/maven2/org/hamcrest/hamcrest-core/1.3/hamcrest-core
<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>
<junitreport todir="${result.juint.dir}">
<fileset dir="${result.juint.dir}">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="${result.juint.dir}"/>
</junitreport>
</target>
<!-- generate by eclipse do not understand why -->
<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>
</project>