aprsdroid/custom_rules.xml

81 wiersze
3.3 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<project>
<property name="mapviewxml" value="res/layout/mapview.xml" />
<target name="-pre-build">
<fail unless="mapsApiKey">You need to add mapsApiKey=... to local.properties</fail>
<copy file="mapview.xml.tpl" tofile="${mapviewxml}" overwrite="true">
<filterchain>
<replacetokens>
<token key="apiKey" value="${mapsApiKey}"/>
</replacetokens>
</filterchain>
</copy>
<tstamp>
<format property="build.date" pattern="yyyy-MM-dd" />
</tstamp>
<exec executable="git" outputproperty="git.revision">
<arg line="describe --tags --dirty=+"/>
</exec>
<copy file="version.xml.tpl" tofile="${resource.absolute.dir}/values/version.xml" overwrite="true">
<filterchain>
<replacetokens>
<token key="build_version" value="${ant.project.name} ${git.revision} ${build.date}"/>
</replacetokens>
</filterchain>
</copy>
</target>
<target name="check-scalalib">
<available file="tools/scala-library.jar" property="have.scalalib"/>
<fail unless="have.scalalib">You have to place scala-compiler.jar and scala-library.jar to tools/</fail>
</target>
<target name="check-scalac">
<available file="tools/scala-compiler.jar" property="have.scalac"/>
<fail unless="have.scalac">You have to place scala-compiler.jar and scala-library.jar to tools/</fail>
</target>
<target name="scalac" depends="-compile, check-scalalib, check-scalac">
<taskdef resource="scala/tools/ant/antlib.xml"
classpath="tools/scala-compiler.jar:tools/scala-library.jar:tools/scala-reflect.jar" />
<scalac force="changed" deprecation="on"
srcdir="${source.absolute.dir}" includes="**/*.scala"
bootclasspathref="project.target.class.path"
destdir="${out.classes.absolute.dir}">
<classpath>
<pathelement location="${out.classes.absolute.dir}"/>
<fileset dir="tools" includes="*.jar"/>
<fileset dir="${jar.libs.dir}" includes="*.jar"/>
</classpath>
</scalac>
</target>
<!-- proguard is always enabled in APRSdroid -->
<target name="-post-compile" depends="scalac, proguard" />
<target name="proguard" depends="scalac">
<property name="proguard.jar" location="${android.tools.dir}/proguard/lib/proguard.jar" />
<taskdef name="proguard" classname="proguard.ant.ProGuardTask" classpath="${proguard.jar}" />
<property name="obfuscate.absolute.dir" location="${out.absolute.dir}/proguard" />
<property name="obfuscated.jar.file" value="${obfuscate.absolute.dir}/obfuscated.jar" />
<property name="out.dex.input.absolute.dir" value="${obfuscated.jar.file}" />
<mkdir dir="${obfuscate.absolute.dir}" />
<proguard configuration="proguard.cfg">
-injars ${out.classes.absolute.dir}:${jar.libs.dir}:tools/scala-library.jar(!META-INF/MANIFEST.MF,!library.properties)
-outjars ${obfuscated.jar.file}
-libraryjars ${toString:project.target.class.path}
-dump "${obfuscate.absolute.dir}/dump.txt"
-printseeds "${obfuscate.absolute.dir}/seeds.txt"
-printusage "${obfuscate.absolute.dir}/usage.txt"
-printmapping "${obfuscate.absolute.dir}/mapping.txt"
</proguard>
<path id="out.dex.jar.input.ref" />
</target>
<target name="-obfuscate" depends="proguard" />
</project>