build-old.xml 3.59 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<project name="TULIP" default="all" basedir=".">
	
	<property name='build' location='dist' />
	<property name='application.version' value='1.0'/>
	<property name='application.name' value='TULIP'/>
	<property name='distribution' value='${application.name}-${application.version}'/>
	<tstamp><format property='build.time' pattern='yyyy-MM-dd HH:mm:ss'/></tstamp>
	
	<path id='compile.classpath'>
		<fileset dir='libs'>
	    	<include name='*.jar'/>
		</fileset>
	</path>
		  
	 <condition property='jdk.javadoc.visible' value='true' else='false'> 
	    <http url='http://java.sun.com/javase/8/docs/api/' />
	 </condition>
	
	<echo>
	    Application: ${application.name} ${application.version}
	    Build File : ${ant.file} 
	    Run Date   : ${build.time}
	    Run by     : ${user.name}
	    Build Dir  : ${build}
	    Base Dir   : ${basedir}
	    Java Home  : ${java.home}
	    Connected to the web   : ${jdk.javadoc.visible}
	</echo>
	
	<echo>Creating build directory</echo>
	<mkdir dir="${build}"/>
	<mkdir dir="bin"/>
	
	<target name='clean' description="Delete all build artifacts." >
		<delete includeEmptyDirs="true">
			<fileset dir='${build}'/>
		</delete>
		<delete includeEmptyDirs="true">
			<fileset dir='bin'/>
		</delete>
		<mkdir dir="bin"/>
		<mkdir dir="${build}"/>
		<mkdir dir="${build}/javadoc"/>
		<mkdir dir="${build}/assets"/>
	</target>
	
	<target name='compile' description='Compile source files.'>
	    <javac includeantruntime="false" srcdir="src" destdir="bin">   
	      <classpath refid='compile.classpath'/>
	    </javac>
	</target> 
	
	<target name='jar' description='Create a jar file for distribution.' depends="compile">
	    <jar destfile='${build}/${distribution}.jar'>
	    	<fileset dir="bin"/>
	    	<zipgroupfileset dir="libs" includes="*.jar"/>
	    </jar>
	</target>
	
	<target name="source and doc" description="Bundle sources and javadoc in a jar" depends="javadoc">
		<jar compress="${jar.compress}" basedir="src" jarfile="${build}/${distribution}-sources.jar" />
		<jar compress="${jar.compress}" basedir="${build}/javadoc/" jarfile="${build}/${distribution}-javadoc.jar" />
		<copy file="calibration.xml" todir="${build}/"/>
		<copy file="properties.properties" todir="${build}/"/>
		<copy todir="${build}/assets">
		    <fileset dir="assets"/>
		</copy>
		<jar compress="${jar.compress}" basedir="test" jarfile="${build}/${distribution}-test.jar" />	
	</target>
	
	<target name='javadoc' description='Generate javadoc.' >
	    <javadoc  
	      use='true' author='true'  version='true'
	      access='package' 
	      sourcepath='src'
	      packagenames='*.*' 
	      destdir='${build}/javadoc'
	      windowtitle='${application.name} ${application.version}'
	      noqualifier='java.*:javax.*:com.sun.*'   
	      linksource='true' >
	    <tag name="invariant" scope="all" description="Invariant:"/>
	    <tag name="post" scope="all" description="Postcondition:"/>
	    <tag name="pre" scope="all" description="Precondition:"/>
	    <classpath refid='compile.classpath'/>
	    <link href='http://java.sun.com/javase/8/docs/api/'/>      
	    <header><![CDATA[<h1>${application.name} ${application.version}</h1>]]></header>
	    </javadoc>
	</target>
	  
	<target name='distribution' description='Create zip file with project code and resources.'>
	    <zip destfile='${build}/${distribution}.zip'>
	      <zipfileset dir='${build}'/>
	    </zip>
	</target>
	
	<target name='all' description='Create all build artifacts.' 
	             depends='clean, jar, javadoc, source and doc, distribution'>
	    <echo>Finished creating all build artifacts.</echo>
	</target>
</project>