[DEV] ant is 9°% of the basis
This commit is contained in:
parent
487cba9ccb
commit
3966c55232
6
.gitignore
vendored
6
.gitignore
vendored
@ -9,5 +9,9 @@ ScenariumConfig.txt
|
||||
*.class
|
||||
*~
|
||||
*.bck
|
||||
|
||||
build.number
|
||||
/extern/
|
||||
/out/
|
||||
/.settings/
|
||||
/junit/
|
||||
/target/
|
||||
|
196
build.xml
196
build.xml
@ -1,21 +1,31 @@
|
||||
<?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="version" value="0.1.0" />
|
||||
|
||||
<property name="debuglevel" value="source,lines,vars"/>
|
||||
<!-- configure dependency of JAVA -->
|
||||
<property name="target" value="14"/>
|
||||
<property name="source" value="14"/>
|
||||
|
||||
<property name="source.lib.dir" location="./src/" />
|
||||
<property name="source.test.dir" location="./test/src/" />
|
||||
|
||||
<property name="result.dir" location="./out/ant/" />
|
||||
<property name="result.jar.dir" location="${result.dir}/package" />
|
||||
<property name="result.javadoc.dir" location="${result.dir}/javadoc" />
|
||||
<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" />
|
||||
<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" />
|
||||
<!-- Import JaCoCo Ant tasks -->
|
||||
<!-- https://www.eclemma.org/jacoco/-->
|
||||
<taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">
|
||||
<classpath path="/home/heero/jacoco/jacocoant.jar" />
|
||||
<classpath path="${basedir}/extern/jacoco/jacocoant.jar" />
|
||||
</taskdef>
|
||||
<property name="libPath" value="${user.home}"/>
|
||||
<property name="libPath" value="${basedir}/extern/lib/"/> <!--value="${user.home}"-->
|
||||
<!--
|
||||
mkdir -p extern/lib
|
||||
cd extern/lib
|
||||
@ -37,109 +47,168 @@ wget https://repo1.maven.org/maven2/org/hamcrest/hamcrest-core/1.3/hamcrest-core
|
||||
-->
|
||||
<path id="junit.classpath">
|
||||
<!-- keep all lib in this directiry-->
|
||||
<fileset dir="${basedir}/extern/lib/"/>
|
||||
<fileset dir="${libPath}"/>
|
||||
<!--
|
||||
<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"/>
|
||||
<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"/>
|
||||
-->
|
||||
</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 id="io.scenarium.logger.classpath">
|
||||
<pathelement location="${result.classes.lib.dir}"/>
|
||||
</path>
|
||||
<path id="test.scenarium.logger.classpath">
|
||||
<path refid="io.scenarium.logger.classpath"/>
|
||||
<pathelement location="${result.classes.test.dir}"/>
|
||||
<path refid="junit.classpath"/>
|
||||
</path>
|
||||
|
||||
<!-- =========================================================================== -->
|
||||
<!-- initialize the build system -->
|
||||
<!-- =========================================================================== -->
|
||||
<target name="init">
|
||||
<mkdir dir="target/classes"/>
|
||||
<mkdir dir="target/test-classes"/>
|
||||
<copy includeemptydirs="false" todir="target/classes">
|
||||
<fileset dir="src">
|
||||
<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}">
|
||||
<exclude name="**/*.launch"/>
|
||||
<exclude name="**/*.java"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
<copy includeemptydirs="false" todir="target/test-classes">
|
||||
<fileset dir="test/src">
|
||||
<copy includeemptydirs="false" todir="${result.classes.test.dir}">
|
||||
<fileset dir="${source.test.dir}">
|
||||
<include name="**/*.java"/>
|
||||
<exclude name="**/*.launch"/>
|
||||
<exclude name="**/*.java"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
</target>
|
||||
|
||||
<!-- =========================================================================== -->
|
||||
<!-- clean all the build-tree -->
|
||||
<!-- =========================================================================== -->
|
||||
<target name="clean">
|
||||
<delete dir="target/classes"/>
|
||||
<delete dir="target/test-classes"/>
|
||||
<delete dir="${result.dir}/"/>
|
||||
</target>
|
||||
<target depends="clean" name="cleanall"/>
|
||||
<target depends="build-subprojects,build-project" name="build"/>
|
||||
<target name="build-subprojects"/>
|
||||
<target depends="init" name="build-project">
|
||||
|
||||
<!-- =========================================================================== -->
|
||||
<!-- Build all the applications -->
|
||||
<!-- =========================================================================== -->
|
||||
<target depends="init" name="build-lib">
|
||||
<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 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"/>
|
||||
</javac>
|
||||
<javac debug="true" debuglevel="${debuglevel}" destdir="target/test-classes" includeantruntime="false" source="${source}" target="${target}">
|
||||
<src path="test/src"/>
|
||||
</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}"/>
|
||||
<include name="**/*.java"/>
|
||||
<classpath refid="scenarium-logger.classpath"/>
|
||||
<classpath refid="test.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"/>
|
||||
|
||||
<!-- =========================================================================== -->
|
||||
<!-- Build all the applications -->
|
||||
<!-- =========================================================================== -->
|
||||
<target depends="build-lib,build-test" name="build">
|
||||
</target>
|
||||
<target name="TestBasicLog">
|
||||
|
||||
<!-- =========================================================================== -->
|
||||
<!-- 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 © 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">
|
||||
</target>
|
||||
|
||||
<!-- =========================================================================== -->
|
||||
<!-- test the whole application -->
|
||||
<!-- =========================================================================== -->
|
||||
<target name="test">
|
||||
<mkdir dir="${result.juint.dir}"/>
|
||||
<jacoco:coverage destfile="${result.exec.file}">
|
||||
<jacoco:coverage destfile="${result.coverage.work-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"/>
|
||||
<classpath refid="test.scenarium.logger.classpath"/>
|
||||
</junit>
|
||||
</jacoco:coverage>
|
||||
</target>
|
||||
<target name="test" depends="TestBasicLog">
|
||||
</target>
|
||||
<target name="report" depends="test">
|
||||
<!-- creat all the test report -->
|
||||
<target name="report">
|
||||
<!-- Step 3: Create coverage report -->
|
||||
<jacoco:report>
|
||||
|
||||
<!-- This task needs the collected execution data and ... -->
|
||||
<executiondata>
|
||||
<file file="${result.exec.file}" />
|
||||
<file file="${result.coverage.work-file}" />
|
||||
</executiondata>
|
||||
|
||||
<!-- the class files and optional source files ... -->
|
||||
<structure name="JaCoCo Ant Example">
|
||||
<classfiles>
|
||||
<fileset dir="${result.classes.dir}" />
|
||||
<fileset dir="${result.classes.lib.dir}" />
|
||||
</classfiles>
|
||||
<sourcefiles encoding="UTF-8">
|
||||
<fileset dir="src" />
|
||||
<fileset dir="${source.lib.dir}" />
|
||||
</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" />
|
||||
<html destdir="${result.coverage.report.dir}" />
|
||||
<csv destfile="${result.coverage.report.dir}/report.csv" />
|
||||
<xml destfile="${result.coverage.report.dir}/report.xml" />
|
||||
</jacoco:report>
|
||||
<junitreport todir="${result.juint.dir}">
|
||||
<fileset dir="${result.juint.dir}">
|
||||
@ -148,7 +217,10 @@ wget https://repo1.maven.org/maven2/org/hamcrest/hamcrest-core/1.3/hamcrest-core
|
||||
<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"/>
|
||||
@ -158,4 +230,8 @@ wget https://repo1.maven.org/maven2/org/hamcrest/hamcrest-core/1.3/hamcrest-core
|
||||
<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>
|
||||
</project>
|
||||
|
Loading…
Reference in New Issue
Block a user