Split plugin ant targets into a abstract build.xml file

This commit is contained in:
Ziver Koc 2017-08-29 15:45:47 +02:00
parent 279c19272e
commit 26ed8584c8
3 changed files with 127 additions and 144 deletions

100
build_plugin.xml Executable file
View file

@ -0,0 +1,100 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="abstract plugin build file" >
<!-- ________________________ PROPERTIES AND SETTINGS ________________________ -->
<!-- ____________ (THESE SHOULD BE SET BY IMPORTING BUILD SCRIPT) ____________ -->
<!--common properties-->
<!--
<property name="root" value="." />
<property name="srcDir" value="${root}/src" />
<property name="testDir" value="${root}/test" />
<property name="libDir" value="${root}/lib" />
<property name="buildRoot" value="${root}/build" />
<property name="compileDir" value="${buildRoot}/production" />
<property name="compileTestDir" value="${buildRoot}/test" />
<property name="releaseDir" value="${buildRoot}/release" />
<property name="releaseJar" value="tellstick.jar" />
<property name="reportsDir" value="../../${buildRoot}/reports" />
-->
<!-- ________________________ CLASSPATH ________________________ -->
<!--define standard arguments for javac-->
<presetdef name="javac">
<javac includeantruntime="false" />
</presetdef>
<!--classpath included when building-->
<path id="classpath.build">
<fileset dir="${libDir}" erroronmissingdir="false">
<include name="**/*.jar"/>
</fileset>
<pathelement location="${compileDir}" />
<!-- Hal core -->
<pathelement location="../../build/production" />
<fileset dir="../../lib">
<include name="**/*.jar"/>
</fileset>
</path>
<path id="classpath.test">
<pathelement location="${compileTestDir}" />
<pathelement location="../../${compileTestDir}" />
<!--include libraries used for building-->
<path refid="classpath.build"/>
</path>
<!-- ________________________ EXECUTION TARGETS ________________________ -->
<target name="test" depends="build-test">
<mkdir dir="${reportsDir}" />
<junit printsummary="yes" haltonfailure="false" fork="true">
<classpath refid="classpath.test" />
<formatter type="plain" usefile="false" /> <!-- to screen -->
<formatter type="xml" /> <!-- to file -->
<batchtest todir="${reportsDir}" skipNonTests="true">
<fileset dir="${compileTestDir}" includes="**/*Test*.class" erroronmissingdir="false"/>
</batchtest>
</junit>
</target>
<!-- ________________________ BUILD TARGETS ________________________ -->
<!--clean all build paths-->
<target name="clean">
<delete includeemptydirs="true" failonerror="false">
<fileset dir="${buildRoot}" includes="**/*"/>
</delete>
</target>
<!--build product code-->
<target name="build">
<mkdir dir="${compileDir}" />
<javac srcdir="${srcDir}" destdir="${compileDir}" debug="yes" debugLevel="lines,vars,source" fork="yes">
<classpath refid="classpath.build" />
<include name="**/*.java" />
</javac>
<copy todir="${compileDir}">
<fileset dir="${srcDir}"
excludes="**/*.java" />
</copy>
</target>
<available file="${testDir}" property="testDirAvailable" value=""/>
<target name="build-test" depends="build" if="testDirAvailable">
<mkdir dir="${compileTestDir}" />
<javac srcdir="${testDir}" destdir="${compileTestDir}" debug="yes" debugLevel="lines,vars,source" fork="yes">
<classpath refid="classpath.test" />
<include name="**/*.java" />
</javac>
</target>
<target name="package" depends="build">
<jar destfile="${releaseDir}/${releaseJar}" basedir="${compileDir}" />
</target>
</project>

View file

@ -16,81 +16,8 @@
<property name="releaseJar" value="tellstick.jar" />
<property name="reportsDir" value="../../${buildRoot}/reports" /> <!-- Use Hal reports folder -->
<!-- ________________________ CLASSPATH ________________________ -->
<!-- ________________________ TARGETS ________________________ -->
<!--define standard arguments for javac-->
<presetdef name="javac">
<javac includeantruntime="false" />
</presetdef>
<!--classpath included when building-->
<path id="classpath.build">
<fileset dir="${libDir}" erroronmissingdir="false">
<include name="**/*.jar"/>
</fileset>
<pathelement location="${compileDir}" />
<!-- Hal core -->
<pathelement location="../../build/production" />
<fileset dir="../../lib">
<include name="**/*.jar"/>
</fileset>
</path>
<path id="classpath.test">
<pathelement location="${compileTestDir}" />
<pathelement location="../../${compileTestDir}" />
<!--include libraries used for building-->
<path refid="classpath.build"/>
</path>
<!-- ________________________ EXECUTION TARGETS ________________________ -->
<target name="test" depends="build-test">
<mkdir dir="${reportsDir}" />
<junit printsummary="yes" haltonfailure="false" fork="true">
<classpath refid="classpath.test" />
<formatter type="plain" usefile="false" /> <!-- to screen -->
<formatter type="xml" /> <!-- to file -->
<batchtest todir="${reportsDir}" skipNonTests="true">
<fileset dir="${compileTestDir}" includes="**/*Test*.class" />
</batchtest>
</junit>
</target>
<!-- ________________________ BUILD TARGETS ________________________ -->
<!--clean all build paths-->
<target name="clean">
<delete includeemptydirs="true" failonerror="false">
<fileset dir="${buildRoot}" includes="**/*"/>
</delete>
</target>
<!--build product code-->
<target name="build">
<mkdir dir="${compileDir}" />
<javac srcdir="${srcDir}" destdir="${compileDir}" debug="yes" debugLevel="lines,vars,source" fork="yes">
<classpath refid="classpath.build" />
<include name="**/*.java" />
</javac>
<copy todir="${compileDir}">
<fileset dir="${srcDir}"
excludes="**/*.java" />
</copy>
</target>
<target name="build-test" depends="build">
<mkdir dir="${compileTestDir}" />
<javac srcdir="${testDir}" destdir="${compileTestDir}" debug="yes" debugLevel="lines,vars,source" fork="yes">
<classpath refid="classpath.test" />
<include name="**/*.java" />
</javac>
</target>
<target name="package" depends="build">
<jar destfile="${releaseDir}/${releaseJar}" basedir="${compileDir}" />
</target>
<import file="../../build_plugin.xml"/>
</project>

View file

@ -6,62 +6,18 @@
<!--common properties-->
<property name="root" value="." />
<property name="srcDir" value="${root}/src" />
<property name="testDir" value="${root}/test" />
<property name="libDir" value="${root}/lib" />
<property name="buildRoot" value="${root}/build" />
<property name="compileDir" value="${buildRoot}/production" />
<property name="compileTestDir" value="${buildRoot}/test" />
<property name="releaseDir" value="${buildRoot}/release" />
<property name="releaseJar" value="zwave.jar" />
<property name="reportsDir" value="../../${buildRoot}/reports" /> <!-- Use Hal reports folder -->
<!-- ________________________ TARGETS ________________________ -->
<!-- ________________________ CLASSPATH ________________________ -->
<!--define standard arguments for javac-->
<presetdef name="javac">
<javac includeantruntime="false" />
</presetdef>
<!--classpath included when building-->
<path id="classpath.build">
<fileset dir="${libDir}" erroronmissingdir="false">
<include name="**/*.jar"/>
</fileset>
<pathelement location="${compileDir}" />
<!-- Hal core -->
<pathelement location="../../build/production" />
<fileset dir="../../lib">
<include name="**/*.jar"/>
</fileset>
</path>
<!-- ________________________ EXECUTION TARGETS ________________________ -->
<target name="test" />
<!-- ________________________ BUILD TARGETS ________________________ -->
<!--clean all build paths-->
<target name="clean">
<delete includeemptydirs="true" failonerror="false">
<fileset dir="${buildRoot}" includes="**/*"/>
</delete>
</target>
<!--build product code-->
<target name="build">
<mkdir dir="${compileDir}" />
<javac srcdir="${srcDir}" destdir="${compileDir}" debug="yes" debugLevel="lines,vars,source" fork="yes">
<classpath refid="classpath.build" />
<include name="**/*.java" />
</javac>
<copy todir="${compileDir}">
<fileset dir="${srcDir}"
excludes="**/*.java" />
</copy>
</target>
<target name="package" depends="build">
<jar destfile="${releaseDir}/${releaseJar}" basedir="${compileDir}" />
</target>
<import file="../../build_plugin.xml"/>
</project>