scenarium-logger/build.xml

238 lines
11 KiB
XML
Raw Normal View History

2020-09-06 21:37:08 +02:00
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project basedir="." default="build" name="scenarium-logger" xmlns:jacoco="antlib:org.jacoco.ant">
2020-09-06 21:48:32 +02:00
<property environment="env"/>
2020-09-06 23:05:15 +02:00
<property name="version" value="0.1.0" />
2020-09-06 21:48:32 +02:00
<property name="debuglevel" value="source,lines,vars"/>
<!-- configure dependency of JAVA -->
<property name="target" value="14"/>
<property name="source" value="14"/>
2020-09-06 23:05:15 +02:00
<property name="source.lib.dir" location="./src/" />
<property name="source.test.dir" location="./test/src/" />
2020-09-06 21:48:32 +02:00
<property name="result.dir" location="./out/ant/" />
2020-09-06 23:05:15 +02:00
<property name="result.jar.dir" location="${result.dir}/package" />
<property name="result.javadoc.dir" location="${result.dir}/javadoc" />
2020-09-06 21:48:32 +02:00
<property name="result.juint.dir" location="${result.dir}/junit" />
2020-09-06 23:05:15 +02:00
<property name="result.classes.lib.dir" location="${result.dir}/classes-lib" />
<property name="result.classes.test.dir" location="${result.dir}/classes-test" />
<property name="result.coverage.report.dir" location="${result.dir}/coverage/site" />
<property name="result.coverage.work-file" location="${result.dir}/coverage/jacoco.exec" />
2020-09-06 21:48:32 +02:00
<!-- Import JaCoCo Ant tasks -->
2020-09-06 23:05:15 +02:00
<!-- https://www.eclemma.org/jacoco/-->
2020-09-06 21:37:08 +02:00
<taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">
2020-09-06 23:05:15 +02:00
<classpath path="${basedir}/extern/jacoco/jacocoant.jar" />
2020-09-06 21:37:08 +02:00
</taskdef>
2020-09-06 23:05:15 +02:00
<property name="libPath" value="${basedir}/extern/lib/"/> <!--value="${user.home}"-->
2020-09-06 21:37:08 +02:00
<!--
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
-->
2020-09-06 21:48:32 +02:00
<path id="junit.classpath">
<!-- keep all lib in this directiry-->
2020-09-06 23:05:15 +02:00
<fileset dir="${libPath}"/>
2020-09-06 21:48:32 +02:00
<!--
2020-09-06 23:05:15 +02:00
<pathelement location="${basedir}/junit-jupiter-api-5.6.2.jar"/>
<pathelement location="${basedir}/junit-jupiter-engine-5.6.2.jar"/>
<pathelement location="${basedir}/junit-jupiter-migrationsupport-5.6.2.jar"/>
<pathelement location="${basedir}/junit-jupiter-params-5.6.2.jar"/>
<pathelement location="${basedir}/junit-platform-commons-1.6.2.jar"/>
<pathelement location="${basedir}/junit-platform-engine-1.6.2.jar"/>
<pathelement location="${basedir}/junit-platform-launcher-1.6.2.jar"/>
<pathelement location="${basedir}/junit-jupiter-runner-5.6.2.jar"/>
<pathelement location="${basedir}/junit-platform-suite-api-1.6.2.jar"/>
<pathelement location="${basedir}/junit-vintage-engine-5.6.2.jar"/>
<pathelement location="${basedir}/opentest4j-1.2.0.jar"/>
<pathelement location="${basedir}/apiguardian-api-1.1.0.jar"/>
<pathelement location="${basedir}/junit-4.13.jar"/>
<pathelement location="${basedir}/hamcrest-core-1.3.jar"/>
2020-09-06 21:48:32 +02:00
-->
</path>
2020-09-06 23:05:15 +02:00
<path id="io.scenarium.logger.classpath">
<pathelement location="${result.classes.lib.dir}"/>
2020-09-06 21:48:32 +02:00
</path>
2020-09-06 23:05:15 +02:00
<path id="test.scenarium.logger.classpath">
<path refid="io.scenarium.logger.classpath"/>
<pathelement location="${result.classes.test.dir}"/>
2020-09-06 21:48:32 +02:00
<path refid="junit.classpath"/>
</path>
2020-09-06 23:05:15 +02:00
<!-- =========================================================================== -->
<!-- initialize the build system -->
<!-- =========================================================================== -->
2020-09-06 21:48:32 +02:00
<target name="init">
2020-09-06 23:05:15 +02:00
<mkdir dir="${result.classes.lib.dir}"/>
<mkdir dir="${result.classes.test.dir}"/>
<copy includeemptydirs="false" todir="${result.classes.lib.dir}">
<fileset dir="${source.lib.dir}">
2020-09-06 21:48:32 +02:00
<exclude name="**/*.launch"/>
<exclude name="**/*.java"/>
</fileset>
</copy>
2020-09-06 23:05:15 +02:00
<copy includeemptydirs="false" todir="${result.classes.test.dir}">
<fileset dir="${source.test.dir}">
2020-09-06 21:48:32 +02:00
<include name="**/*.java"/>
<exclude name="**/*.launch"/>
<exclude name="**/*.java"/>
</fileset>
</copy>
</target>
2020-09-06 23:05:15 +02:00
<!-- =========================================================================== -->
<!-- clean all the build-tree -->
<!-- =========================================================================== -->
2020-09-06 21:48:32 +02:00
<target name="clean">
2020-09-06 23:05:15 +02:00
<delete dir="${result.dir}/"/>
2020-09-06 21:48:32 +02:00
</target>
2020-09-06 23:05:15 +02:00
<!-- =========================================================================== -->
<!-- Build all the applications -->
<!-- =========================================================================== -->
<target depends="init" name="build-lib">
2020-09-06 21:48:32 +02:00
<echo message="${ant.project.name}: ${ant.file}"/>
2020-09-06 23:05:15 +02:00
<javac debug="true" debuglevel="${debuglevel}" destdir="${result.classes.lib.dir}" includeantruntime="false" source="${source}" target="${target}">
<src path="${source.lib.dir}"/>
<classpath refid="io.scenarium.logger.classpath"/>
2020-09-06 21:48:32 +02:00
</javac>
2020-09-06 23:05:15 +02:00
</target>
<target depends="init" name="build-test">
<echo message="${ant.project.name}: ${ant.file}"/>
<javac debug="true" debuglevel="${debuglevel}" destdir="${result.classes.test.dir}" includeantruntime="false" source="${source}" target="${target}">
<src path="${source.test.dir}"/>
2020-09-06 21:48:32 +02:00
<include name="**/*.java"/>
2020-09-06 23:05:15 +02:00
<classpath refid="test.scenarium.logger.classpath"/>
2020-09-06 21:48:32 +02:00
</javac>
</target>
2020-09-06 23:05:15 +02:00
<!-- =========================================================================== -->
<!-- Build all the applications -->
<!-- =========================================================================== -->
<target depends="build-lib,build-test" name="build">
</target>
<!-- =========================================================================== -->
<!-- javadoc generation -->
<!-- =========================================================================== -->
<target name="javadoc">
<javadoc destdir="${result.javadoc.dir}"
author="true"
version="true"
use="true"
windowtitle="Scenarium library API: ${ant.project.name}">
<fileset dir="${source.lib.dir}" defaultexcludes="yes">
<include name="io/scenarium/**"/>
</fileset>
<doctitle><![CDATA[<h1>Scenarium library: ${ant.project.name}</h1>]]></doctitle>
<bottom><![CDATA[<i>Copyright &#169; 2020 Scenarium. All Rights Reserved.</i>]]></bottom>
<!--
<tag name="todo" scope="all" description="To do:"/>
<group title="Group 1 Packages" packages="com.dummy.test.a*"/>
<group title="Group 2 Packages" packages="com.dummy.test.b*:com.dummy.test.c*"/>
<link offline="true" href="https://docs.oracle.com/javase/8/docs/api/" packagelistLoc="C:\tmp"/>
<link href="https://scenarium.io/"/>
-->
</javadoc>
</target>
<!-- =========================================================================== -->
<!-- package binary, source and javadoc in 3 jar -->
<!-- =========================================================================== -->
<target name="package-lib" depends="build" description="Package compile java in a jar">
<buildnumber />
<jar destfile="${result.jar.dir}/${ant.project.name}-${version}.jar" indexMetaInf="true" basedir="${result.classes.lib.dir}" />
</target>
<target name="package-src" description="Package sources in a jar">
<buildnumber />
<jar destfile="${result.jar.dir}/${ant.project.name}-${version}-sources.jar" basedir="${source.lib.dir}" />
</target>
<target name="package-javadoc" depends="javadoc" description="Package javadoc in a jar">
<buildnumber />
<jar destfile="${result.jar.dir}/${ant.project.name}-${version}-javadoc.jar" basedir="${result.javadoc.dir}" />
</target>
<target name="package" depends="package-lib,package-src,package-javadoc" description="generate all jar">
2020-09-06 21:48:32 +02:00
</target>
2020-09-06 23:05:15 +02:00
<!-- =========================================================================== -->
<!-- test the whole application -->
<!-- =========================================================================== -->
<target name="test">
2020-09-06 21:48:32 +02:00
<mkdir dir="${result.juint.dir}"/>
2020-09-06 23:05:15 +02:00
<jacoco:coverage destfile="${result.coverage.work-file}">
2020-09-06 21:48:32 +02:00
<junit fork="yes" printsummary="withOutAndErr">
<formatter type="xml"/>
<test name="test.scenarium.logger.TestBasicLog" todir="${result.juint.dir}"/>
<jvmarg line="-ea"/>
2020-09-06 23:05:15 +02:00
<classpath refid="test.scenarium.logger.classpath"/>
2020-09-06 21:48:32 +02:00
</junit>
</jacoco:coverage>
</target>
2020-09-06 23:05:15 +02:00
<!-- creat all the test report -->
<target name="report">
2020-09-06 21:37:08 +02:00
<!-- Step 3: Create coverage report -->
<jacoco:report>
<!-- This task needs the collected execution data and ... -->
<executiondata>
2020-09-06 23:05:15 +02:00
<file file="${result.coverage.work-file}" />
2020-09-06 21:37:08 +02:00
</executiondata>
<!-- the class files and optional source files ... -->
<structure name="JaCoCo Ant Example">
<classfiles>
2020-09-06 23:05:15 +02:00
<fileset dir="${result.classes.lib.dir}" />
2020-09-06 21:37:08 +02:00
</classfiles>
<sourcefiles encoding="UTF-8">
2020-09-06 23:05:15 +02:00
<fileset dir="${source.lib.dir}" />
2020-09-06 21:37:08 +02:00
</sourcefiles>
</structure>
<!-- to produce reports in different formats. -->
2020-09-06 23:05:15 +02:00
<html destdir="${result.coverage.report.dir}" />
<csv destfile="${result.coverage.report.dir}/report.csv" />
<xml destfile="${result.coverage.report.dir}/report.xml" />
2020-09-06 21:37:08 +02:00
</jacoco:report>
2020-09-06 21:48:32 +02:00
<junitreport todir="${result.juint.dir}">
<fileset dir="${result.juint.dir}">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="${result.juint.dir}"/>
</junitreport>
</target>
2020-09-06 23:05:15 +02:00
<!-- =========================================================================== -->
2020-09-06 21:48:32 +02:00
<!-- generate by eclipse do not understand why -->
2020-09-06 23:05:15 +02:00
<!-- =========================================================================== -->
2020-09-06 21:48:32 +02:00
<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>
2020-09-06 21:37:08 +02:00
</target>
2020-09-06 23:05:15 +02:00
<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>
2020-09-06 21:37:08 +02:00
</project>