OsmAnd/OsmAnd-java/build.xml
2016-03-12 19:51:43 +02:00

165 lines
4.9 KiB
XML

<!-- build JAR libraty -->
<project name="OsmAnd-core" default="build" basedir=".">
<property file="local.properties" />
<property name="src.dir" value="src" />
<property name="src.absolute.dir" location="${src.dir}" />
<property name="protobuf.src" location="protobuf-src" />
<property name="bin.dir" value="bin" />
<property name="bin.absolute.dir" location="${bin.dir}" />
<property name="lib.dir" value="libs" />
<property name="unit.dir" value="test/java" />
<property name="unit.absolute.dir" location="${unit.dir}" />
<property name="lib.absolute.dir" location="${lib.dir}" />
<property name="java.encoding" value="UTF-8" />
<path id="build.path">
<fileset dir="${lib.absolute.dir}">
<include name="*.jar" />
</fileset>
</path>
<path id="unit.test.path">
<path refid="build.path"/>
<pathelement path="test/java"/>
</path>
<target name="-dirs">
<mkdir dir="${bin.absolute.dir}" />
</target>
<target name="clean">
<delete dir="${bin.absolute.dir}" />
<delete file="OsmAnd-core.jar" />
</target>
<target name="compileUnitTests" depends="compile">
<javac srcdir="test/" destdir="${bin.absolute.dir}">
<classpath refid="unit.test.path"/>
</javac>
<copy todir="${bin.absolute.dir}">
<fileset dir="test/java">
<include name="**/*.json" />
</fileset>
</copy>
</target>
<target name="run-route-test" >
<junit printsummary="yes" haltonfailure="yes" showoutput="yes">
<classpath>
<pathelement path="bin"/>
<path refid="build.path"/>
</classpath>
<test name="net.osmand.router.RouteResultPreparationTest" haltonfailure="no" outfile="result">
<formatter type="plain"/>
<formatter type="xml"/>
</test>
</junit>
</target>
<target name="copy_resources">
<copy todir="${src.absolute.dir}/net/osmand/router/">
<fileset dir="../../resources/routing/">
<include name="*.xml" />
</fileset>
</copy>
<copy todir="${src.absolute.dir}/net/osmand/render/">
<fileset dir="../../resources/rendering_styles/">
<include name="*.xml" />
</fileset>
</copy>
<copy todir="${src.absolute.dir}/net/osmand/osm/">
<fileset dir="../../resources/obf_creation/">
<include name="rendering_types.xml" />
</fileset>
<fileset dir="../../resources/poi/">
<include name="poi_types.xml" />
</fileset>
</copy>
<copy todir="${src.absolute.dir}/net/osmand/map/">
<fileset dir="../../resources/countries-info/">
<include name="countries.reginfo" />
<include name="regions.ocbf" />
</fileset>
</copy>
</target>
<target name="patch-protobuf">
<copy file="${protobuf.src}/com/google/protobuf/CodedInputStream.java"
tofile="${protobuf.src}/com/google/protobuf/CodedInputStreamRAF.java" overwrite="yes">
</copy>
<copy todir="${src.absolute.dir}">
<fileset dir="${protobuf.src}"/>
</copy>
<patch patchfile="protobuf.patch" dir=".."/>
</target>
<target name="compile" depends="-dirs,copy_resources">
<copy todir="${bin.absolute.dir}">
<fileset dir="${src.absolute.dir}">
<exclude name="**/*.java" />
</fileset>
</copy>
<javac srcdir="${src.absolute.dir}" destdir="${bin.absolute.dir}" encoding="${java.encoding}" classpathref="build.path" debug="on" source="1.6">
<include name="**/*.java" />
<exclude name="net/osmand/plus/**" />
</javac>
</target>
<target name="native-libs-jar" depends="compile">
<exec command="bash collect_libs.sh" failonerror="true">
</exec>
<antcall target="jar" />
</target>
<target name="native-legacy-libs-jar" depends="compile">
<exec command="bash collect_legacy_libs.sh" failonerror="true">
</exec>
<antcall target="jar" />
</target>
<target name="jar" depends="compile, compileUnitTests">
<manifestclasspath property="lib.list" jarfile="OsmAnd-core.jar">
<classpath refid="build.path" />
</manifestclasspath>
<echo>list is ${lib.list}</echo>
<delete file="OsmAnd-core.jar" />
<delete file="MANIFEST.MF" />
<manifest file="MANIFEST.MF">
<attribute name="Built-By" value="${user.name}" />
<attribute name="Main-Class" value="net.osmand.swing.OsmExtractionUI" />
<attribute name="Class-Path" value="${lib.list}" />
</manifest>
<jar destfile="OsmAnd-core.jar" manifest="MANIFEST.MF">
<fileset dir="${bin.absolute.dir}">
<include name="**/*" />
</fileset>
<fileset dir="${src.absolute.dir}">
<include name="**/*.java" />
</fileset>
<fileset dir="${unit.absolute.dir}">
<include name="**/*.java" />
</fileset>
</jar>
<jar destfile="OsmAnd-core-android.jar" manifest="MANIFEST.MF">
<fileset dir="${bin.absolute.dir}">
<include name="**/*.class" />
<exclude name="**/PlatformUtil*"/>
</fileset>
<fileset dir="${src.absolute.dir}">
<include name="**/*.java" />
<exclude name="**/PlatformUtil*"/>
</fileset>
</jar>
<delete file="MANIFEST.MF" />
</target>
<target name="build" depends="jar">
</target>
</project>