Improved build.
This commit is contained in:
parent
92cb043e84
commit
c362d77fed
3 changed files with 150 additions and 144 deletions
279
build-libjar.xml
279
build-libjar.xml
|
@ -1,160 +1,161 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<project default="dist" name="Create Library Jar">
|
||||
<!--ANT 1.7 is required -->
|
||||
<property name="buildjar.version" value="1.5" />
|
||||
<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" />
|
||||
<project default="dist" name="Build-libjar">
|
||||
<!--ANT 1.7 is required -->
|
||||
<property name="buildjar.version" value="1.5" />
|
||||
<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="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.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>
|
||||
<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>
|
||||
<!-- ***** Help ***** -->
|
||||
<target name="help" description="Display detailed usage information">
|
||||
<echo>Type ant -p</echo>
|
||||
</target>
|
||||
|
||||
<!-- ***** Clear ***** -->
|
||||
<target name="clear" description="Clean temporary directories before work">
|
||||
<delete dir="${build.dir}" />
|
||||
</target>
|
||||
<!-- ***** Clear ***** -->
|
||||
<target name="clear" description="Clean temporary directories before work">
|
||||
<delete dir="${build.dir}" />
|
||||
</target>
|
||||
|
||||
<!-- ***** Clean ***** -->
|
||||
<target name="clean" description="Clean temporary directories afeter work">
|
||||
<delete dir="${build.dir}" />
|
||||
</target>
|
||||
<!-- ***** Clean ***** -->
|
||||
<target name="clean" description="Clean temporary directories afeter work">
|
||||
<delete dir="${build.dir}" />
|
||||
</target>
|
||||
|
||||
<!-- ***** Compile ***** -->
|
||||
<target name="compile" description="Compile main code">
|
||||
<delete dir="${build.classes}" />
|
||||
<mkdir dir="${build.classes}" />
|
||||
<javac srcdir="${build.src}" destdir="${build.classes}" debug="${debug}" deprecation="on" includeantruntime="false">
|
||||
<classpath refid="build.classpath" />
|
||||
</javac>
|
||||
<copy todir="${build.classes}">
|
||||
<fileset dir="${build.src}" excludes="**/*.java" />
|
||||
</copy>
|
||||
</target>
|
||||
<!-- ***** Compile ***** -->
|
||||
<target name="compile" description="Compile main code">
|
||||
<delete dir="${build.classes}" />
|
||||
<mkdir dir="${build.classes}" />
|
||||
<javac srcdir="${build.src}" destdir="${build.classes}" debug="${debug}" deprecation="on" includeantruntime="false">
|
||||
<classpath refid="build.classpath" />
|
||||
</javac>
|
||||
<copy todir="${build.classes}">
|
||||
<fileset dir="${build.src}" excludes="**/*.java" />
|
||||
</copy>
|
||||
</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>
|
||||
<copy todir="${test.classes}">
|
||||
<fileset dir="${test.src}" excludes="**/*.java" />
|
||||
</copy>
|
||||
</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>
|
||||
<copy todir="${test.classes}">
|
||||
<fileset dir="${test.src}" excludes="**/*.java" />
|
||||
</copy>
|
||||
</target>
|
||||
|
||||
<!-- ***** Test ***** -->
|
||||
<target name="test" description="Run unit tests" depends="clear,compile,compile-test,clean">
|
||||
<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>
|
||||
<!-- ***** Test ***** -->
|
||||
<target name="test" description="Run unit tests" depends="clear,compile,compile-test">
|
||||
<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>
|
||||
<!-- ***** 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" depends="clear,compile,javadoc">
|
||||
<!-- AUTOMATIC MANAGEMENT -->
|
||||
<buildnumber file="build.num" description="Id of the build" />
|
||||
<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}" />
|
||||
<!-- ***** Dist ***** -->
|
||||
<target name="dist" description="Build distribution" depends="clear,compile,javadoc">
|
||||
<!-- AUTOMATIC MANAGEMENT -->
|
||||
<buildnumber file="build.num" description="Id of the build" />
|
||||
<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}" />
|
||||
|
||||
<!-- -->
|
||||
<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="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" />
|
||||
|
||||
<!-- Package main -->
|
||||
<property name="dist.jar" value="${dist.dir}/${dist.name}.jar" />
|
||||
<tstamp>
|
||||
<!-- TODAY -->
|
||||
<format property="dist.time" pattern="dd/MM/yyyy HH:mm:ss" />
|
||||
</tstamp>
|
||||
<jar destfile="${dist.jar}">
|
||||
<manifest>
|
||||
<attribute name="Built-By" value="${user.name} using ant" />
|
||||
<attribute name="Built-Date" value="${dist.time}" />
|
||||
</manifest>
|
||||
<fileset dir="${build.classes}" />
|
||||
</jar>
|
||||
<!-- Package main -->
|
||||
<property name="dist.jar" value="${dist.dir}/${dist.name}.jar" />
|
||||
<tstamp>
|
||||
<!-- TODAY -->
|
||||
<format property="dist.time" pattern="dd/MM/yyyy HH:mm:ss" />
|
||||
</tstamp>
|
||||
<jar destfile="${dist.jar}">
|
||||
<manifest>
|
||||
<attribute name="Built-By" value="${user.name} using ant" />
|
||||
<attribute name="Built-Date" value="${dist.time}" />
|
||||
</manifest>
|
||||
<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 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" />
|
||||
<zip destfile="${dist.javadoc.zip}" update="true">
|
||||
<fileset dir="${build.javadoc}" />
|
||||
<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>
|
||||
|
||||
<!-- Zip package -->
|
||||
<!--
|
||||
<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>
|
||||
-->
|
||||
</target>
|
||||
<!-- 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>
|
||||
-->
|
||||
</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}" />
|
||||
<!-- ***** 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="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>
|
||||
<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>
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<project default="dist" name="Xidyn">
|
||||
<project default="main" name="Build">
|
||||
<!-- ***** Import ***** -->
|
||||
<import file="build-libjar.xml" />
|
||||
|
||||
<!-- ***** Main ***** -->
|
||||
<target name="main" description="" depends="dist,clean"/>
|
||||
|
||||
<!-- ***** Define demo properties ***** -->
|
||||
<property name="demo.src" value="${basedir}/demo" />
|
||||
<property name="demo.classes" value="${build.dir}/demo-classes" />
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<project default="buildandgit" name="xidyn">
|
||||
<!-- -->
|
||||
<import file="build.xml" />
|
||||
</project>
|
||||
<project default="main" name="Buildandgit">
|
||||
<!-- -->
|
||||
<import file="build.xml" />
|
||||
|
||||
<target name="main" description="" depends="buildandgit,clean"/>
|
||||
</project>
|
Loading…
Reference in a new issue