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" ?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||||
<project default="dist" name="Create Library Jar">
|
<project default="dist" name="Build-libjar">
|
||||||
<!--ANT 1.7 is required -->
|
<!--ANT 1.7 is required -->
|
||||||
<property name="buildjar.version" value="1.5" />
|
<property name="buildjar.version" value="1.5" />
|
||||||
<property file="build.properties" />
|
<property file="build.properties" />
|
||||||
<property name="build.dir" value="${basedir}/build" />
|
<property name="build.dir" value="${basedir}/build" />
|
||||||
<property name="build.src" value="${basedir}/src" />
|
<property name="build.src" value="${basedir}/src" />
|
||||||
<property name="build.classes" value="${build.dir}/classes" />
|
<property name="build.classes" value="${build.dir}/classes" />
|
||||||
<property name="build.javadoc" value="${build.dir}/javadoc" />
|
<property name="build.javadoc" value="${build.dir}/javadoc" />
|
||||||
<property name="test.src" value="${basedir}/test" />
|
<property name="test.src" value="${basedir}/test" />
|
||||||
<property name="test.classes" value="${build.dir}/test-classes" />
|
<property name="test.classes" value="${build.dir}/test-classes" />
|
||||||
<property name="debug" value="on" />
|
<property name="debug" value="on" />
|
||||||
|
|
||||||
<path id="build.classpath">
|
<path id="build.classpath">
|
||||||
<fileset dir="lib" includes="**/*.jar" />
|
<fileset dir="lib" includes="**/*.jar" />
|
||||||
</path>
|
</path>
|
||||||
|
|
||||||
<path id="test.classpath.compile">
|
<path id="test.classpath.compile">
|
||||||
<path refid="build.classpath" />
|
<path refid="build.classpath" />
|
||||||
<pathelement path="${build.classes}" />
|
<pathelement path="${build.classes}" />
|
||||||
</path>
|
</path>
|
||||||
|
|
||||||
<path id="test.classpath.run">
|
<path id="test.classpath.run">
|
||||||
<path refid="test.classpath.compile" />
|
<path refid="test.classpath.compile" />
|
||||||
<pathelement path="${test.classes}" />
|
<pathelement path="${test.classes}" />
|
||||||
</path>
|
</path>
|
||||||
|
|
||||||
<!-- ***** Help ***** -->
|
<!-- ***** Help ***** -->
|
||||||
<target name="help" description="Display detailed usage information">
|
<target name="help" description="Display detailed usage information">
|
||||||
<echo>Type ant -p</echo>
|
<echo>Type ant -p</echo>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- ***** Clear ***** -->
|
<!-- ***** Clear ***** -->
|
||||||
<target name="clear" description="Clean temporary directories before work">
|
<target name="clear" description="Clean temporary directories before work">
|
||||||
<delete dir="${build.dir}" />
|
<delete dir="${build.dir}" />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- ***** Clean ***** -->
|
<!-- ***** Clean ***** -->
|
||||||
<target name="clean" description="Clean temporary directories afeter work">
|
<target name="clean" description="Clean temporary directories afeter work">
|
||||||
<delete dir="${build.dir}" />
|
<delete dir="${build.dir}" />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- ***** Compile ***** -->
|
<!-- ***** Compile ***** -->
|
||||||
<target name="compile" description="Compile main code">
|
<target name="compile" description="Compile main code">
|
||||||
<delete dir="${build.classes}" />
|
<delete dir="${build.classes}" />
|
||||||
<mkdir dir="${build.classes}" />
|
<mkdir dir="${build.classes}" />
|
||||||
<javac srcdir="${build.src}" destdir="${build.classes}" debug="${debug}" deprecation="on" includeantruntime="false">
|
<javac srcdir="${build.src}" destdir="${build.classes}" debug="${debug}" deprecation="on" includeantruntime="false">
|
||||||
<classpath refid="build.classpath" />
|
<classpath refid="build.classpath" />
|
||||||
</javac>
|
</javac>
|
||||||
<copy todir="${build.classes}">
|
<copy todir="${build.classes}">
|
||||||
<fileset dir="${build.src}" excludes="**/*.java" />
|
<fileset dir="${build.src}" excludes="**/*.java" />
|
||||||
</copy>
|
</copy>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- ***** Compile test ***** -->
|
<!-- ***** Compile test ***** -->
|
||||||
<target name="compile-test" description="Compile test code">
|
<target name="compile-test" description="Compile test code">
|
||||||
<mkdir dir="${test.classes}" />
|
<mkdir dir="${test.classes}" />
|
||||||
<javac srcdir="${test.src}" destdir="${test.classes}" debug="${debug}" deprecation="on" includeantruntime="false">
|
<javac srcdir="${test.src}" destdir="${test.classes}" debug="${debug}" deprecation="on" includeantruntime="false">
|
||||||
<classpath refid="test.classpath.compile" />
|
<classpath refid="test.classpath.compile" />
|
||||||
</javac>
|
</javac>
|
||||||
<copy todir="${test.classes}">
|
<copy todir="${test.classes}">
|
||||||
<fileset dir="${test.src}" excludes="**/*.java" />
|
<fileset dir="${test.src}" excludes="**/*.java" />
|
||||||
</copy>
|
</copy>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- ***** Test ***** -->
|
<!-- ***** Test ***** -->
|
||||||
<target name="test" description="Run unit tests" depends="clear,compile,compile-test,clean">
|
<target name="test" description="Run unit tests" depends="clear,compile,compile-test">
|
||||||
<mkdir dir="${build.dir}/test-reports" />
|
<mkdir dir="${build.dir}/test-reports" />
|
||||||
<junit printsummary="yes" haltonfailure="no">
|
<junit printsummary="yes" haltonfailure="no">
|
||||||
<classpath refid="test.classpath.run" />
|
<classpath refid="test.classpath.run" />
|
||||||
<formatter type="plain" usefile="true" />
|
<formatter type="plain" usefile="true" />
|
||||||
<batchtest fork="yes" todir="${build.dir}/test-reports/">
|
<batchtest fork="yes" todir="${build.dir}/test-reports/">
|
||||||
<fileset dir="test">
|
<fileset dir="test">
|
||||||
<include name="**/*Test.java" />
|
<include name="**/*Test.java" />
|
||||||
</fileset>
|
</fileset>
|
||||||
</batchtest>
|
</batchtest>
|
||||||
</junit>
|
</junit>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- ***** JavaDoc ***** -->
|
<!-- ***** JavaDoc ***** -->
|
||||||
<target name="javadoc" description="Javadoc construction">
|
<target name="javadoc" description="Javadoc construction">
|
||||||
<javadoc sourcepath="${build.src}" destdir="${build.javadoc}">
|
<javadoc sourcepath="${build.src}" destdir="${build.javadoc}">
|
||||||
<classpath>
|
<classpath>
|
||||||
<fileset dir="lib" includes="**/*.jar" />
|
<fileset dir="lib" includes="**/*.jar" />
|
||||||
</classpath>
|
</classpath>
|
||||||
</javadoc>
|
</javadoc>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- ***** Dist ***** -->
|
<!-- ***** Dist ***** -->
|
||||||
<target name="dist" description="Build distribution" depends="clear,compile,javadoc">
|
<target name="dist" description="Build distribution" depends="clear,compile,javadoc">
|
||||||
<!-- AUTOMATIC MANAGEMENT -->
|
<!-- AUTOMATIC MANAGEMENT -->
|
||||||
<buildnumber file="build.num" description="Id of the build" />
|
<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.version" value="${product.revision.major}.${product.revision.minor}.${build.number}" />
|
||||||
<property name="dist.name" value="${product.name}-${dist.version}" />
|
<property name="dist.name" value="${product.name}-${dist.version}" />
|
||||||
<property name="dist.dir" value="${basedir}/dist/${dist.name}" />
|
<property name="dist.dir" value="${basedir}/dist/${dist.name}" />
|
||||||
|
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<copy file="LICENSE" 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" todir="${dist.dir}/" overwrite="true" failonerror="false" />
|
||||||
<copy file="README.md" todir="${dist.dir}/" overwrite="true" failonerror="false" />
|
<copy file="README.md" todir="${dist.dir}/" overwrite="true" failonerror="false" />
|
||||||
|
|
||||||
<!-- Package main -->
|
<!-- Package main -->
|
||||||
<property name="dist.jar" value="${dist.dir}/${dist.name}.jar" />
|
<property name="dist.jar" value="${dist.dir}/${dist.name}.jar" />
|
||||||
<tstamp>
|
<tstamp>
|
||||||
<!-- TODAY -->
|
<!-- TODAY -->
|
||||||
<format property="dist.time" pattern="dd/MM/yyyy HH:mm:ss" />
|
<format property="dist.time" pattern="dd/MM/yyyy HH:mm:ss" />
|
||||||
</tstamp>
|
</tstamp>
|
||||||
<jar destfile="${dist.jar}">
|
<jar destfile="${dist.jar}">
|
||||||
<manifest>
|
<manifest>
|
||||||
<attribute name="Built-By" value="${user.name} using ant" />
|
<attribute name="Built-By" value="${user.name} using ant" />
|
||||||
<attribute name="Built-Date" value="${dist.time}" />
|
<attribute name="Built-Date" value="${dist.time}" />
|
||||||
</manifest>
|
</manifest>
|
||||||
<fileset dir="${build.classes}" />
|
<fileset dir="${build.classes}" />
|
||||||
</jar>
|
</jar>
|
||||||
|
|
||||||
<!-- Package sources -->
|
<!-- Package sources -->
|
||||||
<property name="dist.srczip" value="${dist.dir}/${dist.name}-sources.zip" />
|
<property name="dist.srczip" value="${dist.dir}/${dist.name}-sources.zip" />
|
||||||
<zip destfile="${dist.srczip}" update="true" preserve0permissions="true">
|
<zip destfile="${dist.srczip}" update="true" preserve0permissions="true">
|
||||||
<fileset dir="${basedir}/src" />
|
<fileset dir="${basedir}/src" />
|
||||||
<zipfileset dir="${basedir}/" includes="LICENSE" />
|
<zipfileset dir="${basedir}/" includes="LICENSE" />
|
||||||
</zip>
|
</zip>
|
||||||
|
|
||||||
<!-- Package Javadoc -->
|
<!-- Package Javadoc -->
|
||||||
<property name="dist.javadoc.zip" value="${dist.dir}/${dist.name}-javadoc.zip" />
|
<property name="dist.javadoc.zip" value="${dist.dir}/${dist.name}-javadoc.zip" />
|
||||||
<zip destfile="${dist.javadoc.zip}" update="true">
|
<zip destfile="${dist.javadoc.zip}" update="true">
|
||||||
<fileset dir="${build.javadoc}" />
|
<fileset dir="${build.javadoc}" />
|
||||||
<zipfileset dir="${basedir}/" includes="LICENSE" />
|
<zipfileset dir="${basedir}/" includes="LICENSE" />
|
||||||
</zip>
|
</zip>
|
||||||
|
|
||||||
<!-- Zip package -->
|
<!-- 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">
|
<property name="dist.zip" value="${basedir}/dist/${dist.name}.zip" />
|
||||||
<fileset dir="${dist.dir}" />
|
<zip destfile="${dist.zip}" update="true">
|
||||||
<zipfileset filemode="755" dir="${dist.dir}/" includes="*.sh *.command" />
|
<fileset dir="${dist.dir}" />
|
||||||
</zip>
|
<zipfileset filemode="755" dir="${dist.dir}/" includes="*.sh *.command" />
|
||||||
-->
|
</zip>
|
||||||
</target>
|
-->
|
||||||
|
</target>
|
||||||
|
|
||||||
<!-- ***** Build and GIT ***** -->
|
<!-- ***** Build and GIT ***** -->
|
||||||
<target name="buildandgit" depends="dist,clean">
|
<target name="buildandgit" depends="dist,clean">
|
||||||
<echo message="Commit build.num" />
|
<echo message="Commit build.num" />
|
||||||
<exec executable="git" outputproperty="git.commit.out" failifexecutionfails="true">
|
<exec executable="git" outputproperty="git.commit.out" failifexecutionfails="true">
|
||||||
<arg line="commit -m 'Build ${dist.version}' build.num" />
|
<arg line="commit -m 'Build ${dist.version}' build.num" />
|
||||||
</exec>
|
</exec>
|
||||||
<echo message="${git.commit.out}" />
|
<echo message="${git.commit.out}" />
|
||||||
|
|
||||||
<echo message="Tag" />
|
<echo message="Tag" />
|
||||||
<exec executable="git" outputproperty="git.tag.out" failifexecutionfails="true">
|
<exec executable="git" outputproperty="git.tag.out" failifexecutionfails="true">
|
||||||
<arg line="tag -a ${dist.version} -m 'Build ${dist.version}'" />
|
<arg line="tag -a ${dist.version} -m 'Build ${dist.version}'" />
|
||||||
</exec>
|
</exec>
|
||||||
<echo message="${git.tag.out}" />
|
<echo message="${git.tag.out}" />
|
||||||
|
|
||||||
<echo message="Push" />
|
<echo message="Push" />
|
||||||
<exec executable="git" outputproperty="git.push.out" failifexecutionfails="true">
|
<exec executable="git" outputproperty="git.push.out" failifexecutionfails="true">
|
||||||
<arg line="push --follow-tags" />
|
<arg line="push --follow-tags" />
|
||||||
</exec>
|
</exec>
|
||||||
<echo message="${git.push.out}" />
|
<echo message="${git.push.out}" />
|
||||||
</target>
|
</target>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<project default="dist" name="Xidyn">
|
<project default="main" name="Build">
|
||||||
<!-- ***** Import ***** -->
|
<!-- ***** Import ***** -->
|
||||||
<import file="build-libjar.xml" />
|
<import file="build-libjar.xml" />
|
||||||
|
|
||||||
|
<!-- ***** Main ***** -->
|
||||||
|
<target name="main" description="" depends="dist,clean"/>
|
||||||
|
|
||||||
<!-- ***** Define demo properties ***** -->
|
<!-- ***** Define demo properties ***** -->
|
||||||
<property name="demo.src" value="${basedir}/demo" />
|
<property name="demo.src" value="${basedir}/demo" />
|
||||||
<property name="demo.classes" value="${build.dir}/demo-classes" />
|
<property name="demo.classes" value="${build.dir}/demo-classes" />
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||||
<project default="buildandgit" name="xidyn">
|
<project default="main" name="Buildandgit">
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<import file="build.xml" />
|
<import file="build.xml" />
|
||||||
</project>
|
|
||||||
|
<target name="main" description="" depends="buildandgit,clean"/>
|
||||||
|
</project>
|
Loading…
Reference in a new issue