kiss4web/build-libjar.xml

163 lines
5.8 KiB
XML
Raw Normal View History

2013-06-26 01:15:40 +02:00
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
2016-09-21 14:27:25 +02:00
<project default="dist" name="Build-libjar">
2013-06-26 01:15:40 +02:00
<!--ANT 1.7 is required -->
2016-09-21 14:27:25 +02:00
<property name="buildjar.version" value="1.5" />
2013-06-26 01:15:40 +02:00
<property file="build.properties" />
<property name="build.dir" value="${basedir}/build" />
<property name="build.src" value="${basedir}/src" />
<property name="build.classes" value="${build.dir}/classes" />
<property name="build.javadoc" value="${build.dir}/javadoc" />
<property name="test.src" value="${basedir}/test" />
<property name="test.classes" value="${build.dir}/test-classes" />
<property name="debug" value="on" />
<path id="build.classpath">
<fileset dir="lib" includes="**/*.jar" />
</path>
<path id="test.classpath.compile">
<path refid="build.classpath" />
<pathelement path="${build.classes}" />
</path>
<path id="test.classpath.run">
<path refid="test.classpath.compile" />
<pathelement path="${test.classes}" />
</path>
<!-- ***** Help ***** -->
<target name="help" description="Display detailed usage information">
<echo>Type ant -p</echo>
</target>
2016-09-21 14:27:25 +02:00
<!-- ***** Clear ***** -->
<target name="clear" description="Clean temporary directories before work">
<delete dir="${build.dir}" />
</target>
2013-06-26 01:15:40 +02:00
<!-- ***** Clean ***** -->
2016-09-21 14:27:25 +02:00
<target name="clean" description="Clean temporary directories afeter work">
2013-06-26 01:15:40 +02:00
<delete dir="${build.dir}" />
</target>
<!-- ***** Compile ***** -->
<target name="compile" description="Compile main code">
2016-09-21 14:27:25 +02:00
<delete dir="${build.classes}" />
<mkdir dir="${build.classes}" />
2013-06-26 01:15:40 +02:00
<javac srcdir="${build.src}" destdir="${build.classes}" debug="${debug}" deprecation="on" includeantruntime="false">
2016-09-21 14:27:25 +02:00
<classpath refid="build.classpath" />
2013-06-26 01:15:40 +02:00
</javac>
2016-09-21 14:27:25 +02:00
<copy todir="${build.classes}">
<fileset dir="${build.src}" excludes="**/*.java" />
</copy>
2013-06-26 01:15:40 +02:00
</target>
<!-- ***** Compile test ***** -->
<target name="compile-test" description="Compile test code">
<mkdir dir="${test.classes}" />
<javac srcdir="${test.src}" destdir="${test.classes}" debug="${debug}" deprecation="on" includeantruntime="false">
<classpath refid="test.classpath.compile" />
</javac>
2016-09-21 14:27:25 +02:00
<copy todir="${test.classes}">
<fileset dir="${test.src}" excludes="**/*.java" />
</copy>
2013-06-26 01:15:40 +02:00
</target>
<!-- ***** Test ***** -->
2016-09-21 14:27:25 +02:00
<target name="test" description="Run unit tests" depends="clear,compile,compile-test">
2013-06-26 01:15:40 +02:00
<mkdir dir="${build.dir}/test-reports" />
<junit printsummary="yes" haltonfailure="no">
<classpath refid="test.classpath.run" />
<formatter type="plain" usefile="true" />
<batchtest fork="yes" todir="${build.dir}/test-reports/">
<fileset dir="test">
<include name="**/*Test.java" />
</fileset>
</batchtest>
</junit>
</target>
<!-- ***** JavaDoc ***** -->
<target name="javadoc" description="Javadoc construction">
<javadoc sourcepath="${build.src}" destdir="${build.javadoc}">
<classpath>
<fileset dir="lib" includes="**/*.jar" />
</classpath>
</javadoc>
</target>
<!-- ***** Dist ***** -->
2016-09-21 14:27:25 +02:00
<target name="dist" description="Build distribution" depends="clear,compile,javadoc">
2013-06-26 01:15:40 +02:00
<!-- AUTOMATIC MANAGEMENT -->
2016-09-21 14:27:25 +02:00
<buildnumber file="build.num" description="Id of the build" />
2013-06-26 01:15:40 +02:00
<property name="dist.version" value="${product.revision.major}.${product.revision.minor}.${build.number}" />
<property name="dist.name" value="${product.name}-${dist.version}" />
<property name="dist.dir" value="${basedir}/dist/${dist.name}" />
<!-- -->
2016-09-21 14:27:25 +02:00
<copy file="LICENSE" todir="${dist.dir}/" overwrite="true" failonerror="false" />
<copy file="README" todir="${dist.dir}/" overwrite="true" failonerror="false" />
<copy file="README.md" todir="${dist.dir}/" overwrite="true" failonerror="false" />
2013-06-29 15:40:00 +02:00
2013-06-26 01:15:40 +02:00
<!-- Package main -->
<property name="dist.jar" value="${dist.dir}/${dist.name}.jar" />
<tstamp>
<!-- TODAY -->
2016-09-21 14:27:25 +02:00
<format property="dist.time" pattern="dd/MM/yyyy HH:mm:ss" />
2013-06-26 01:15:40 +02:00
</tstamp>
<jar destfile="${dist.jar}">
<manifest>
<attribute name="Built-By" value="${user.name} using ant" />
<attribute name="Built-Date" value="${dist.time}" />
</manifest>
<service type="javax.annotation.processing.Processor" provider="fr.devinsy.kiss4web.dispatcher.annotation.KissServletProcessor" />
2013-06-26 01:15:40 +02:00
<fileset dir="${build.classes}" />
</jar>
<!-- Package sources -->
<property name="dist.srczip" value="${dist.dir}/${dist.name}-sources.zip" />
<zip destfile="${dist.srczip}" update="true" preserve0permissions="true">
<fileset dir="${basedir}/src" />
<zipfileset dir="${basedir}/" includes="LICENSE" />
</zip>
<!-- Package Javadoc -->
<property name="dist.javadoc.zip" value="${dist.dir}/${dist.name}-javadoc.zip" />
2016-09-21 14:27:25 +02:00
<zip destfile="${dist.javadoc.zip}" update="true">
2013-06-26 01:15:40 +02:00
<fileset dir="${build.javadoc}" />
<zipfileset dir="${basedir}/" includes="LICENSE" />
</zip>
2016-09-21 14:27:25 +02:00
<!-- Zip package -->
<property name="dist.zip" value="${basedir}/dist/${dist.name}.zip" />
<!--
<property name="dist.zip" value="${basedir}/dist/${dist.name}.zip" />
<zip destfile="${dist.zip}" update="true">
<fileset dir="${dist.dir}" />
<zipfileset filemode="755" dir="${dist.dir}/" includes="*.sh *.command" />
</zip>
-->
2013-06-26 01:15:40 +02:00
</target>
2016-09-21 14:27:25 +02:00
<!-- ***** Build and GIT ***** -->
<target name="buildandgit" depends="dist,clean">
<echo message="Commit build.num" />
<exec executable="git" outputproperty="git.commit.out" failifexecutionfails="true">
<arg line="commit -m 'Build ${dist.version}' build.num" />
</exec>
<echo message="${git.commit.out}" />
2016-09-21 14:27:25 +02:00
<echo message="Tag" />
<exec executable="git" outputproperty="git.tag.out" failifexecutionfails="true">
<arg line="tag -a ${dist.version} -m 'Build ${dist.version}'" />
</exec>
<echo message="${git.tag.out}" />
2016-09-21 14:27:25 +02:00
<echo message="Push" />
<exec executable="git" outputproperty="git.push.out" failifexecutionfails="true">
<arg line="push --follow-tags" />
</exec>
<echo message="${git.push.out}" />
</target>
2013-06-26 01:15:40 +02:00
</project>