[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"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project basedir="." default="build" name="scenarium-logger" xmlns:jacoco="antlib:org.jacoco.ant"> <project basedir="." default="build" name="scenarium-logger" xmlns:jacoco="antlib:org.jacoco.ant">
<property environment="env"/> <property environment="env"/>
<property name="colos-network.location" value="../spearhead/colos"/> <property name="debuglevel" value="source,lines,vars"/>
<property name="plugin-manager.location" value="../plugin-manager"/> <!-- configure dependency of JAVA -->
<property name="scenarium-base.location" value="../scenarium-base"/> <property name="target" value="14"/>
<property name="scenarium-core.location" value="../scenarium-core/core"/> <property name="source" value="14"/>
<property name="scenarium-river.location" value="../scenarium-river"/>
<property name="scenarium-run.location" value="../scenarium-run"/> <property name="result.dir" location="./out/ant/" />
<property name="junit.output.dir" value="junit"/> <property name="result.juint.dir" location="${result.dir}/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.classes.dir" location="${result.dir}/classes" />
<property name="result.report.dir" location="${result.dir}/site/jacoco" /> <property name="result.report.dir" location="${result.dir}/site/jacoco" />
<property name="result.exec.file" location="${result.dir}/jacoco.exec" /> <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"> <taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">
<classpath path="/home/heero/jacoco/jacocoant.jar" /> <classpath path="/home/heero/jacoco/jacocoant.jar" />
</taskdef> </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/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 wget https://repo1.maven.org/maven2/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar
--> -->
<path id="junit.classpath"> <path id="junit.classpath">
<pathelement location="${basedir}/extern/lib/junit-jupiter-api-5.6.2.jar"/> <!-- keep all lib in this directiry-->
<pathelement location="${basedir}/extern/lib/junit-jupiter-engine-5.6.2.jar"/> <fileset dir="${basedir}/extern/lib/"/>
<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-jupiter-api-5.6.2.jar"/>
<pathelement location="${basedir}/extern/lib/junit-platform-commons-1.6.2.jar"/> <pathelement location="${basedir}/extern/lib/junit-jupiter-engine-5.6.2.jar"/>
<pathelement location="${basedir}/extern/lib/junit-platform-engine-1.6.2.jar"/> <pathelement location="${basedir}/extern/lib/junit-jupiter-migrationsupport-5.6.2.jar"/>
<pathelement location="${basedir}/extern/lib/junit-platform-launcher-1.6.2.jar"/> <pathelement location="${basedir}/extern/lib/junit-jupiter-params-5.6.2.jar"/>
<pathelement location="${basedir}/extern/lib/junit-jupiter-runner-5.6.2.jar"/> <pathelement location="${basedir}/extern/lib/junit-platform-commons-1.6.2.jar"/>
<pathelement location="${basedir}/extern/lib/junit-platform-suite-api-1.6.2.jar"/> <pathelement location="${basedir}/extern/lib/junit-platform-engine-1.6.2.jar"/>
<pathelement location="${basedir}/extern/lib/junit-vintage-engine-5.6.2.jar"/> <pathelement location="${basedir}/extern/lib/junit-platform-launcher-1.6.2.jar"/>
<pathelement location="${basedir}/extern/lib/opentest4j-1.2.0.jar"/> <pathelement location="${basedir}/extern/lib/junit-jupiter-runner-5.6.2.jar"/>
<pathelement location="${basedir}/extern/lib/apiguardian-api-1.1.0.jar"/> <pathelement location="${basedir}/extern/lib/junit-platform-suite-api-1.6.2.jar"/>
<pathelement location="${basedir}/extern/lib/junit-4.13.jar"/> <pathelement location="${basedir}/extern/lib/junit-vintage-engine-5.6.2.jar"/>
<pathelement location="${basedir}/extern/lib/hamcrest-core-1.3.jar"/> <pathelement location="${basedir}/extern/lib/opentest4j-1.2.0.jar"/>
</path> <pathelement location="${basedir}/extern/lib/apiguardian-api-1.1.0.jar"/>
<path id="scenarium-logger.classpath"> <pathelement location="${basedir}/extern/lib/junit-4.13.jar"/>
<pathelement location="target/classes"/> <pathelement location="${basedir}/extern/lib/hamcrest-core-1.3.jar"/>
<pathelement location="target/test-classes"/> -->
<path refid="junit.classpath"/> </path>
</path> <path id="scenarium-logger.classpath">
<path id="run.TestBasicLog.classpath"> <pathelement location="target/classes"/>
<path refid="scenarium-logger.classpath"/> <pathelement location="target/test-classes"/>
<path refid="junit.classpath"/> <path refid="junit.classpath"/>
</path> </path>
<target name="init"> <path id="run.TestBasicLog.classpath">
<mkdir dir="target/classes"/> <path refid="scenarium-logger.classpath"/>
<mkdir dir="target/test-classes"/> <path refid="junit.classpath"/>
<copy includeemptydirs="false" todir="target/classes"> </path>
<fileset dir="src"> <target name="init">
<exclude name="**/*.launch"/> <mkdir dir="target/classes"/>
<exclude name="**/*.java"/> <mkdir dir="target/test-classes"/>
</fileset> <copy includeemptydirs="false" todir="target/classes">
</copy> <fileset dir="src">
<copy includeemptydirs="false" todir="target/test-classes"> <exclude name="**/*.launch"/>
<fileset dir="test/src"> <exclude name="**/*.java"/>
<include name="**/*.java"/> </fileset>
<exclude name="**/*.launch"/> </copy>
<exclude name="**/*.java"/> <copy includeemptydirs="false" todir="target/test-classes">
</fileset> <fileset dir="test/src">
</copy> <include name="**/*.java"/>
</target> <exclude name="**/*.launch"/>
<target name="clean"> <exclude name="**/*.java"/>
<delete dir="target/classes"/> </fileset>
<delete dir="target/test-classes"/> </copy>
</target> </target>
<target depends="clean" name="cleanall"/> <target name="clean">
<target depends="build-subprojects,build-project" name="build"/> <delete dir="target/classes"/>
<target name="build-subprojects"/> <delete dir="target/test-classes"/>
<target depends="init" name="build-project"> </target>
<echo message="${ant.project.name}: ${ant.file}"/> <target depends="clean" name="cleanall"/>
<javac debug="true" debuglevel="${debuglevel}" destdir="target/classes" includeantruntime="false" source="${source}" target="${target}"> <target depends="build-subprojects,build-project" name="build"/>
<src path="src"/> <target name="build-subprojects"/>
<classpath refid="scenarium-logger.classpath"/> <target depends="init" name="build-project">
</javac> <echo message="${ant.project.name}: ${ant.file}"/>
<javac debug="true" debuglevel="${debuglevel}" destdir="target/test-classes" includeantruntime="false" source="${source}" target="${target}"> <javac debug="true" debuglevel="${debuglevel}" destdir="target/classes" includeantruntime="false" source="${source}" target="${target}">
<src path="test/src"/> <src path="src"/>
<include name="**/*.java"/> <classpath refid="scenarium-logger.classpath"/>
<classpath refid="scenarium-logger.classpath"/> </javac>
</javac> <javac debug="true" debuglevel="${debuglevel}" destdir="target/test-classes" includeantruntime="false" source="${source}" target="${target}">
</target> <src path="test/src"/>
<target description="Build all projects which reference this project. Useful to propagate changes." name="build-refprojects"> <include name="**/*.java"/>
<ant antfile="build_old.xml" dir="${colos-network.location}" inheritAll="false" target="clean"/> <classpath refid="scenarium-logger.classpath"/>
<ant antfile="build_old.xml" dir="${colos-network.location}" inheritAll="false" target="build"> </javac>
<propertyset> </target>
<propertyref name="build.compiler"/> <target description="compile project with Eclipse compiler" name="build-eclipse-compiler">
</propertyset> <property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/>
</ant> <antcall target="build"/>
<ant antfile="build_old.xml" dir="${plugin-manager.location}" inheritAll="false" target="clean"/> </target>
<ant antfile="build_old.xml" dir="${plugin-manager.location}" inheritAll="false" target="build"> <target name="TestBasicLog">
<propertyset> <mkdir dir="${result.juint.dir}"/>
<propertyref name="build.compiler"/> <jacoco:coverage destfile="${result.exec.file}">
</propertyset> <junit fork="yes" printsummary="withOutAndErr">
</ant> <formatter type="xml"/>
<ant antfile="build_old.xml" dir="${scenarium-base.location}" inheritAll="false" target="clean"/> <test name="test.scenarium.logger.TestBasicLog" todir="${result.juint.dir}"/>
<ant antfile="build_old.xml" dir="${scenarium-base.location}" inheritAll="false" target="build"> <jvmarg line="-ea"/>
<propertyset> <classpath refid="run.TestBasicLog.classpath"/>
<propertyref name="build.compiler"/> </junit>
</propertyset> </jacoco:coverage>
</ant> </target>
<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 name="test" depends="TestBasicLog">
</target> </target>
<target name="report" depends="test"> <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" /> <csv destfile="${result.report.dir}/report.csv" />
<xml destfile="${result.report.dir}/report.xml" /> <xml destfile="${result.report.dir}/report.xml" />
</jacoco:report> </jacoco:report>
<junitreport todir="${junit.output.dir}"> <junitreport todir="${result.juint.dir}">
<fileset dir="${junit.output.dir}"> <fileset dir="${result.juint.dir}">
<include name="TEST-*.xml"/> <include name="TEST-*.xml"/>
</fileset> </fileset>
<report format="frames" todir="${junit.output.dir}"/> <report format="frames" todir="${result.juint.dir}"/>
</junitreport> </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> </target>
</project> </project>