Commit 1a6563dc authored by Matthias Betz's avatar Matthias Betz
Browse files

removing ant files

parent 93f4129f
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--
This script performs the common tasks required for compiling and deploying one or more Eclipse projects given
in ${projects} into one jar file as well as corresponding javadoc and sources zip files. ${target.path} must hold the
path and base-name (without extension) of the generated artifacts relative to the deployment directory given by
${deploy.dir.path}.
Thus, a correct usage from an ant script located in, say, ProjectOne would look like this:
<project default="deploy" basedir="..">
<property name="deploy.dir.path" location="${user.home}/Desktop/FooBar" />
<property name="target.path" value="lib/artefact" />
<property name="projects" value="ProjectOne,ProjectTwo,ProjectThree" />
<import file="deploy-common.xml" />
... specific tasks follow here ...
This script expects Java sources, properties files, fxml files and other resources to reside in the "src" directory of
each project, while all required jar libraries, if any, are expected directly under directory "lib" in each project.
Note that a version string has to be provided in "simstadt.version" below.
Note also that this script requires Ant version 1.9.4 or higher.
-->
<project name="CommonDeploy" xmlns:if="ant:if" xmlns:unless="ant:unless">
<property name="simstadt.version" value="0.9.1-SNAPSHOT" />
<property name="stage.dir" location="tmpdeploy/${ant.project.name}" />
<property name="src.dir" location="${stage.dir}/src" />
<dirname property="simstadt.src.dir" file="${ant.file.CommonDeploy}" />
<property name="test.dir" location="${stage.dir}/test" />
<property name="doc.dir" location="${stage.dir}/doc" />
<property name="classes.dir" location="${stage.dir}/classes" />
<property name="testclasses.dir" location="${stage.dir}/testclasses" />
<property name="report.dir" location="SimStadtTestReports" />
<property name="reports.dir" location="${report.dir}/${target.path}" />
<property name="deploy.dir.path" location="${user.home}/Desktop/SimStadt" />
<property name="deploy.dir" location="${deploy.dir.path} ${simstadt.version}" />
<property name="lib.dir" location="${deploy.dir}/lib" />
<property name="workflows.dir" location="${deploy.dir}/workflows" />
<property name="target.lib.prefix" location="${deploy.dir}/${target.path}-${simstadt.version}" /> <!-- How to define and use specific lib version? -->
<!-- <property name="doNotTest" value="true"/> Uncomment in order to disable tests, reports and coverage reports -->
<taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">
<classpath path="RegionChooser/lib/test/jacocoant.jar" />
</taskdef>
<path id="classpath">
<fileset dir="${lib.dir}">
<include name="*.jar" />
</fileset>
<fileset dir="${workflows.dir}/">
<include name="*.jar" />
</fileset>
<pathelement path="${classes.dir}" />
<pathelement path="${testclasses.dir}" />
<pathelement path="${simstadt.src.dir}/lib/test/junit.jar" />
</path>
<target name="print-classpath">
<property name="myclasspath" refid="classpath" />
<echo message="Classpath = ${myclasspath}" />
</target>
<target name="delete-deploy-dir">
<delete dir="${deploy.dir}" />
</target>
<target name="setup">
<fail message="Ant 1.9.4 or higher required">
<condition>
<not>
<antversion atleast="1.9.4" />
</not>
</condition>
</fail>
<!-- setup stage dir -->
<delete dir="${stage.dir}" />
<mkdir dir="${stage.dir}" />
<mkdir dir="${workflows.dir}" />
<!-- copy jar libraries -->
<mkdir dir="${lib.dir}" />
<copy todir="${deploy.dir}">
<multirootfileset id="project.lib.dirs" basedirs="${projects}">
<patternset>
<include name="**/lib/*.jar" />
<exclude name="**/lib/*-javadoc.jar" />
<exclude name="**/lib/*-sources.jar" />
</patternset>
</multirootfileset>
</copy>
<!-- copy project sources (without tests) -->
<mkdir dir="${src.dir}" />
<copy toDir="${stage.dir}">
<multirootfileset basedirs="${projects}">
<include name="**/src/**/*" />
</multirootfileset>
</copy>
<!-- copy project tests -->
<mkdir dir="${test.dir}" />
<copy toDir="${stage.dir}">
<multirootfileset basedirs="${projects}">
<include name="**/test/**/*" />
</multirootfileset>
</copy>
</target>
<target name="compile" depends="setup">
<mkdir dir="${classes.dir}" />
<mkdir dir="${testclasses.dir}" />
<javac includeantruntime="false" source="1.8" target="1.8" debug="true" srcdir="${src.dir}" destdir="${classes.dir}" classpathref="classpath" encoding="UTF-8" />
<javac includeantruntime="false" source="1.8" target="1.8" debug="true" srcdir="${test.dir}" destdir="${testclasses.dir}" classpathref="classpath" encoding="UTF-8" />
</target>
<target name="deploy-common" depends="compile, git.revision">
<!-- copy all non Java resource files -->
<copy todir="${classes.dir}">
<fileset dir="${src.dir}">
<exclude name="**/*.java" />
</fileset>
</copy>
<!-- copy all non Java resource test files -->
<copy todir="${testclasses.dir}">
<fileset dir="${test.dir}">
<exclude name="**/*.java" />
</fileset>
</copy>
<!-- create jar with classes and resources from all modules -->
<jar destfile="${target.lib.prefix}.jar">
<fileset dir="${classes.dir}" />
<manifest>
<attribute name="Implementation-Title" value="${ant.project.name}" />
<attribute name="Implementation-Version" value="${simstadt.version} (${git.branch}, rev. ${git.revision}, ${git.date})" />
<attribute name="Implementation-URL" value="http://simstadt.hft-stuttgart.de/" />
</manifest>
</jar>
<!-- create javadoc, without error messages and at most 1 warning. -->
<javadoc access="protected" destdir="${doc.dir}" charset="UTF-8" additionalparam="-Xdoclint:none -Xmaxwarns 1" unless:set="doNotDoc">
<sourcepath path="${src.dir}" />
<classpath refid="classpath" />
</javadoc>
<!-- zip javadoc and sources -->
<zip destfile="${target.lib.prefix}-javadoc.zip" basedir="${doc.dir}" unless:set="doNotDoc"/>
<zip destfile="${target.lib.prefix}-sources.zip" basedir="${src.dir}" unless:set="doNotDoc"/>
</target>
<!-- Defines classpath for junit tests -->
<target name="test-common" depends="deploy-common">
<delete dir="${reports.dir}" />
<mkdir dir="${reports.dir}" />
<path id="test-classpath">
<fileset dir="${lib.dir}">
<include name="*.jar" />
</fileset>
<fileset dir="${workflows.dir}">
<include name="*.jar" />
</fileset>
<pathelement path="${java.class.path}" />
<pathelement path="${classes.dir}" />
<pathelement path="${testclasses.dir}" />
<pathelement path="${simstadt.src.dir}/lib/test/junit.jar" />
<pathelement path="${simstadt.src.dir}/lib/test/hamcrest-core-1.3.jar" />
</path>
</target>
<!-- Extract date and hash for the last GIT commit in master. Useful for manifest and deployed zip.
Properties are set to YYYY-MM-DD and XXXXX if they cannot be extracted.
-->
<available file=".git" type="dir" property="git.present" />
<target name="git.revision" description="Store git revision in ${repository.version}" if="git.present">
<exec executable="git" outputproperty="git.revision" failifexecutionfails="false" errorproperty="">
<arg value="log" />
<arg value="-n1" />
<arg value="--format=%h" />
</exec>
<exec executable="git" outputproperty="git.date" failifexecutionfails="false" errorproperty="">
<arg value="log" />
<arg value="-1" />
<arg value="--format=%cd" />
<arg value="--date=short" />
</exec>
<exec executable="git" outputproperty="git.branch" failifexecutionfails="false" errorproperty="">
<arg value="rev-parse" />
<arg value="--abbrev-ref" />
<arg value="HEAD" />
</exec>
<!-- Set default for git.revision -->
<condition property="git.revision" value="${git.revision}" else="XXXXXX">
<and>
<isset property="git.revision" />
<length string="${git.revision}" trim="yes" length="0" when="greater" />
</and>
</condition>
<!-- Set default for git.branch -->
<condition property="git.branch" value="${git.branch}" else="XXXXXX">
<and>
<isset property="git.branch" />
<length string="${git.branch}" trim="yes" length="0" when="greater" />
</and>
</condition>
<!-- Set default for git.date -->
<condition property="git.date" value="${git.date}" else="YYYY-MM-DD">
<and>
<isset property="git.date" />
<length string="${git.date}" trim="yes" length="0" when="greater" />
</and>
</condition>
<loadresource property="git.YYYYMMDD">
<propertyresource name="git.date" />
<filterchain>
<tokenfilter>
<filetokenizer />
<replacestring from="-" to="" />
</tokenfilter>
</filterchain>
</loadresource>
</target>
</project>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--
This script compiles and deploys SimStadt Platform (GUI and Building Library Editors) and all required modules
to the directory specified in property "deploy.dir.path". It can be used to perform a headless build.
Before executing check that all required modules/projects are enumerated in property "projects".
-->
<project default="deploy" name="RegionChooser" basedir="." xmlns:jacoco="antlib:org.jacoco.ant">
<description>
Create a Jar file with RegionChooser libraries and executables
</description>
<property name="target.path" value="lib/region-chooser" />
<property name="projects" value="." />
<import file="deploy-common.xml" />
<target name="all" depends="deploy, zip, coverage-report" />
<target name="deploy" depends="unit-test">
<echo file="${deploy.dir}/RegionChooser.bat">
java -classpath lib/* -Xms512m -Xmx2g -Djava.util.logging.config.file=logging.properties eu.simstadt.regionchooser.RegionChooserFX&#13;
</echo>
<echo file="${deploy.dir}/RegionChooser.sh">
java -classpath 'lib/*' -Xms512m -Xmx2g -Djava.util.logging.config.file=logging.properties eu.simstadt.regionchooser.RegionChooserFX
</echo>
<chmod file="${deploy.dir}/RegionChooser.sh" perm="u+x" />
<echo file="${deploy.dir}/RegionChooser.command">
cd "$(dirname "$0")" # set the current working directory to the directory this script is in
java -classpath lib/* -Xms512m -Xmx2g -Djava.util.logging.config.file=logging.properties eu.simstadt.regionchooser.RegionChooserFX
</echo>
<chmod file="${deploy.dir}/RegionChooser.command" perm="u+x" />
</target>
<target name="unit-test" depends="test-common" unless="doNotTest">
<junit printsummary="yes" haltonfailure="yes" fork="true">
<classpath refid="test-classpath" />
<formatter type="xml" usefile="true" />
<formatter type="plain" usefile="true" />
<test name="eu.simstadt.geo.fast_xml_parser.CitygmlParserTests" todir="${reports.dir}" />
<test name="eu.simstadt.geo.fast_xml_parser.ConvexHullCalculatorTests" todir="${reports.dir}" />
<!-- RegionExtractor -->
<test name="eu.simstadt.regionchooser.RegionExtractorTests" haltonfailure="no" todir="${reports.dir}" />
<test name="eu.simstadt.regionchooser.RegionExtractorWithDifferentInputTests" haltonfailure="yes" todir="${reports.dir}" />
</junit>
</target>
<target name="zip" depends="git.revision">
<zip destfile="${deploy.dir}/../SimStadt_${simstadt.version}_${git.branch}_${git.YYYYMMDD}_${git.revision}.zip">
<fileset dir="${deploy.dir}" excludes="*.sh,*.command" />
<zipfileset dir="${deploy.dir}" includes="*.sh,*.command" filemode="755" />
</zip>
<!--<delete dir="${stage.dir}" /> Leave classes in tmpdeploy for Jenkins JaCoCo -->
</target>
<target name="delete-reports">
<delete dir="${report.dir}" />
</target>
<target name="coverage-merge" unless="doNotTest">
<jacoco:merge destfile="${report.dir}/simstadt_all.exec">
<fileset dir="${report.dir}" includes="**/*.exec" />
</jacoco:merge>
</target>
<target name="coverage-report" depends="coverage-merge" unless="doNotTest">
<jacoco:report>
<executiondata>
<file file="${report.dir}/simstadt_all.exec" />
</executiondata>
<structure name="SimStadt">
<classfiles>
<fileset dir="${workflows.dir}">
<include name="**/*.jar" />
</fileset>
<file file="${deploy.dir}/lib/simstadt-${simstadt.version}.jar" />
<file file="${deploy.dir}/lib/region-chooser-${simstadt.version}.jar" />
<!-- For every library.
<fileset dir="${lib.dir}">
<include name="*.jar" />
<exclude name="jaxb-xjc.jar" />
</fileset>
-->
</classfiles>
<sourcefiles encoding="UTF-8">
<dirset dir="${simstadt.src.dir}/../">
<include name="**/src/" />
</dirset>
</sourcefiles>
</structure>
<html destdir="${report.dir}/coverage" />
</jacoco:report>
</target>
</project>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment