Siba/build.xml
2016-09-05 12:44:04 +02:00

145 lines
5.9 KiB
XML

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project default="main" name="Create Runnable Jar for project Siba">
<!--ANT 1.7 is required -->
<property file="build.properties"/>
<property name="build.dir" value="${basedir}/build" />
<path id="project.libs">
<fileset dir="${basedir}/lib" includes="**.jar" excludes="*sources* *src*" />
<fileset dir="${basedir}/lib/Logs" includes="**.jar" excludes="*sources* *src*" />
</path>
<!-- TARGET MAIN -->
<target name="main" description="Manage distribution build" depends="dist, clean">
<echo>Done.</echo>
</target>
<!-- TARGET HELP -->
<target name="help" description="Display detailed usage information">
<echo>Type ant -p</echo>
</target>
<!-- TARGET CLEAN -->
<target name="clean" description="Remove build directory">
<echo>=======================================================================</echo>
<delete dir="${build.dir}" />
</target>
<!-- TARGET COMPILE -->
<target name="compile" description="Compile project">
<echo>=======================================================================</echo>
<delete dir="${build.dir}" />
<mkdir dir="${build.dir}" />
<echo>classpath=${toString:project.libs}</echo>
<javac srcdir="src" destdir="${build.dir}" classpath="${toString:project.libs}" includeantruntime="no" />
</target>
<!-- COPY SOURCE STUFF -->
<target name="copysourcestuff" description="Compile project">
<echo>=======================================================================</echo>
<copy todir="${build.dir}">
<fileset dir="${basedir}/src" excludes="**/*.java" />
</copy>
</target>
<!-- TARGET DIST -->
<target name="dist" description="Build distribution directory" depends="compile, copysourcestuff">
<echo>=======================================================================</echo>
<buildnumber file="build.num" description="Id of the build"/>
<property name="dist.version" value="${product.revision.major}.${product.revision.minor}.${build.number}" />
<!-- AUTOMATIC MANAGEMENT -->
<property name="dist.name" value="${product.name}-${version}" />
<property name="dist.dir" value="${basedir}/dist/siba-${dist.version}" />
<property name="dist.zip" value="${basedir}/dist/siba-${dist.version}.zip" />
<tstamp>
<format property="dist.time" pattern="dd/MM/yyyy HH:mm:ss" />
</tstamp>
<delete dir="${dist.dir}" />
<!-- delete file="${distzip}" /-->
<mkdir dir="${dist.dir}"/>
<!-- Update build_information.properties file -->
<property name="build.information.file" value="${build.dir}/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.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. -->
<manifestclasspath property="lib.list" jarfile="${basedir}/lib/siba.jar">
<classpath path="${toString:project.libs}" />
</manifestclasspath>
<!-- Make full jar file -->
<jar destfile="${dist.dir}/siba.jar">
<manifest>
<attribute name="Built-By" value="${user.name} using Siba ANT"/>
<attribute name="Built-Date" value="${dist.time}"/>
<attribute name="Implementation-Version" value="Siba ${dist.version} ${TODAY}"/>
<attribute name="Main-Class" value="org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader"/>
<attribute name="Rsrc-Main-Class" value="org.dclermonte.siba.Siba"/>
<attribute name="Class-Path" value="siba.jar ." />
<attribute name="Rsrc-Class-Path" value="./ ${lib.list}"/>
</manifest>
<zipfileset src="lib/jar-in-jar-loader.zip"/>
<fileset dir="${build.dir}/" excludes="**/*Test.class"/>
<zipfileset dir="${basedir}/lib" includes="${lib.list}" />
</jar>
<!-- Make sources file -->
<property name="dist.srczip" value="${dist.dir}/siba-${dist.version}-sources.zip" />
<zip destfile="${dist.srczip}" update="true" preserve0permissions="true">
<fileset dir="${basedir}/src" />
<zipfileset dir="${basedir}/" includes="LICENSE" />
</zip>
<!-- Make core jar file -->
<property name="dist.core.jar" value="${dist.dir}/siba-core-${dist.version}.jar" />
<jar destfile="${dist.core.jar}">
<manifest>
<attribute name="Built-By" value="${user.name} using ANT" />
<attribute name="Built-Date" value="${dist.time}" />
</manifest>
<fileset dir="${build.dir}" excludes="org/dclermonte/siba/gui/**" />
<zipfileset dir="${basedir}/" includes="LICENSE" />
</jar>
<!-- Make core jar source file -->
<property name="dist.core.srczip" value="${dist.dir}/siba-core-${dist.version}-sources.zip" />
<zip destfile="${dist.core.srczip}" update="true" preserve0permissions="true">
<fileset dir="${basedir}/src" />
<fileset dir="${basedir}/src" excludes="org/dclermonte/siba/gui/**" />
<zipfileset dir="${basedir}/" includes="LICENSE" />
</zip>
<!-- Copy stuff -->
<copy file="scripts/siba.sh" todir="${dist.dir}/" overwrite="true" />
<chmod file="${dist.dir}/siba.sh" perm="ugo+rx" />
<copy file="scripts/siba.command" todir="${dist.dir}/" overwrite="true" />
<chmod file="${dist.dir}/siba.command" perm="ugo+rx" />
<copy file="scripts/siba.bat" todir="${dist.dir}/" overwrite="true" />
<copy file="README.md" todir="${dist.dir}/" overwrite="true" />
<copy file="LICENSE" todir="${dist.dir}/" overwrite="true" />
<copy file="scripts/log4j.properties" todir="${dist.dir}/" overwrite="true" />
<!--zip destfile="${distzip}"
basedir="dist"
includes="${dist.name}/**"
update="true"
preserve0permissions="true"
/-->
<delete file="${build.information.file}" />
</target>
</project>