agirstatool/build-appjar.xml

178 lines
7.3 KiB
XML
Raw Permalink Normal View History

2020-01-05 17:24:43 +01:00
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project default="main" name="Build-appjar">
<!--ANT 1.7 is required -->
<property name="buildjar.version" value="1.8" />
<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="project.libs">
<fileset dir="${basedir}/lib" includes="**/*.jar" excludes="*sources* *src*" />
<!--fileset dir="${basedir}/lib/Logs" includes="**.jar" excludes="*sources* *src*" /-->
</path>
<property name="classpath.absolute" value="${toString:project.libs}" />
<manifestclasspath property="classpath.relative" jarfile="agirstatool.jar">
<classpath refid="project.libs" />
</manifestclasspath>
<!-- ***** Main ***** -->
<target name="main" description="Manage distribution build" depends="dist, clean">
<echo>Done.</echo>
</target>
<!-- ***** Help ***** -->
<target name="help" description="Display detailed usage information">
<echo>Type ant -p</echo>
</target>
<!-- ***** Clear ***** -->
<target name="clear" description="Clear temporary directories before work">
<delete dir="${build.dir}" />
</target>
<!-- ***** Clean ***** -->
<target name="clean" description="Clear temporary directories after work">
<delete dir="${build.dir}" />
</target>
<!-- ***** Compile ***** -->
<target name="compile" description="Compile project">
<delete dir="${build.classes}" />
<mkdir dir="${build.classes}" />
<echo>classpath=${toString:project.libs}</echo>
<javac srcdir="${build.src}" destdir="${build.classes}" classpath="${toString:project.libs}" debug="${debug}" deprecation="on" includeantruntime="no" />
</target>
<!-- ***** copy stuff ***** -->
<target name="copysourcestuff" description="Copy source files other than Java">
<copy todir="${build.classes}">
<fileset dir="${build.src}" excludes="**/*.java" />
</copy>
</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 ***** -->
<target name="dist" description="Build distribution directory" depends="clear,compile,copysourcestuff,javadoc">
<!--echo message="==========>Build Classpath: ${classpath.absolute}" /-->
<!--echo message="==========>Manifest Classpath: ${classpath.relative}" /-->
<!-- AUTOMATIC MANAGEMENT -->
<buildnumber file="build.num" description="Id of the build"/>
<property name="dist.version" value="${product.revision.major}.${product.revision.minor}.${build.number}${dist.snapshot}" />
<property name="dist.name" value="${product.name}-${dist.version}" />
<property name="dist.dir" value="${basedir}/dist/${product.name}-${dist.version}" />
<tstamp>
<format property="dist.time" pattern="dd/MM/yyyy HH:mm:ss" />
</tstamp>
<!-- -->
<delete dir="${dist.dir}" />
<mkdir dir="${dist.dir}"/>
<!-- Update build_information.properties file -->
<property name="build.information.file" value="${build.classes}/org/april/agirstatool/build_information.properties" />
<propertyfile file="${build.information.file}" >
<entry key="product.name" value="${product.name}"/>
<entry key="product.revision.major" value="${product.revision.major}"/>
<entry key="product.revision.minor" value="${product.revision.minor}"/>
<entry key="product.revision.build" value="${build.number}"/>
<entry key="product.revision.snapshot" value="${dist.snapshot}"/>
<entry key="product.revision.date" type="date" value="now"/>
<entry key="product.revision.generator" value="Ant"/>
<entry key="product.revision.author" value="${user.name}"/>
</propertyfile>
<!-- Build the jar file list. -->
<!-- Package jar -->
<property name="dist.jar" value="${dist.dir}/${product.name}.jar" />
<jar destfile="${dist.jar}">
<restrict>
<name regex=".*/*\.(class|pom|properties|xsd)"/>
<archives>
<zips>
<fileset dir="${basedir}/lib" includes="**/*.jar" excludes="*sources* *src*" />
</zips>
</archives>
</restrict>
<manifest>
<attribute name="Built-By" value="${user.name} using ant" />
<attribute name="Built-Date" value="${dist.time}" />
<attribute name="Main-Class" value = "org.april.agirstatool.AgirStatoolLauncher"/>
</manifest>
<fileset dir="${build.classes}" />
<!--zipfileset dir="${basedir}/lib" includes="${toString:project.libs}" /-->
</jar>
<!-- Package sources -->
<property name="dist.srczip" value="${dist.dir}/${dist.name}-sources.zip" />
<zip destfile="${dist.srczip}" update="true" preserve0permissions="true">
<fileset dir="${build.src}" />
<zipfileset dir="${basedir}/" includes="LICENSE" />
</zip>
<!-- Package Javadoc -->
<property name="dist.javadoc.zip" value="${dist.dir}/${dist.name}-javadoc.zip" />
<zip destfile="${dist.javadoc.zip}" update="true">
<fileset dir="${build.javadoc}" />
<zipfileset dir="${basedir}/" includes="LICENSE" />
</zip>
<!-- Copy stuff -->
<copy file="resources/scripts/${product.name}.sh" todir="${dist.dir}/" overwrite="true" />
<chmod file="${dist.dir}/${product.name}.sh" perm="ugo+rx" />
<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" />
<!--copy file="scripts/log4j.properties" todir="${dist.dir}/" overwrite="true" /-->
<mkdir dir="${dist.dir}/conf" />
<copy todir="${dist.dir}/conf">
<fileset dir="${basedir}/resources/conf" includes="*" />
</copy>
2020-01-23 08:56:01 +01:00
<!--
2020-01-05 17:24:43 +01:00
<mkdir dir="${dist.dir}/man"/>
<copy todir="${dist.dir}/man">
<fileset dir="${basedir}/resources/man" includes="*" />
</copy>
2020-01-23 08:56:01 +01:00
-->
2020-01-05 17:24:43 +01:00
<delete file="${build.information.file}" />
</target>
<!-- ***** 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}" />
<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}" />
<echo message="Push" />
<exec executable="git" outputproperty="git.push.out" failifexecutionfails="true">
<arg line="push --follow-tags" />
</exec>
<echo message="${git.push.out}" />
</target>
</project>