339 lines
14 KiB
XML
339 lines
14 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<project name="OsmAnd" default="help">
|
|
|
|
<!-- The local.properties file is created and updated by the 'android' tool.
|
|
It contains the path to the SDK. It should *NOT* be checked into
|
|
Version Control Systems. -->
|
|
<property file="local.properties" />
|
|
|
|
<!-- The ant.properties file can be created by you. It is only edited by the
|
|
'android' tool to add properties to it.
|
|
This is the place to change some Ant specific build properties.
|
|
Here are some properties you may want to change/update:
|
|
|
|
source.dir
|
|
The name of the source directory. Default is 'src'.
|
|
out.dir
|
|
The name of the output directory. Default is 'bin'.
|
|
|
|
For other overridable properties, look at the beginning of the rules
|
|
files in the SDK, at tools/ant/build.xml
|
|
|
|
Properties related to the SDK location or the project target should
|
|
be updated using the 'android' tool with the 'update' action.
|
|
|
|
This file is an integral part of the build system for your
|
|
application and should be checked into Version Control Systems.
|
|
|
|
-->
|
|
<property file="ant.properties" />
|
|
|
|
<!-- The project.properties file is created and updated by the 'android'
|
|
tool, as well as ADT.
|
|
|
|
This contains project specific properties such as project target, and library
|
|
dependencies. Lower level build properties are stored in ant.properties
|
|
(or in .classpath for Eclipse projects).
|
|
|
|
This file is an integral part of the build system for your
|
|
application and should be checked into Version Control Systems. -->
|
|
<loadproperties srcFile="project.properties" />
|
|
|
|
<!-- specify java.compilerArgs if they were not specified -->
|
|
<property name="java.compilerargs" value=""/>
|
|
|
|
<!-- quick check on sdk.dir -->
|
|
<fail
|
|
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through an env var"
|
|
unless="sdk.dir"
|
|
/>
|
|
|
|
|
|
<!-- extension targets. Uncomment the ones where you want to do custom work
|
|
in between standard targets -->
|
|
<!--
|
|
|
|
/* This is typically used for code obfuscation.
|
|
Compiled code location: ${out.classes.absolute.dir}
|
|
If this is not done in place, override ${out.dex.input.absolute.dir} */
|
|
<target name="-post-compile">
|
|
</target>
|
|
-->
|
|
<property name="use.dir" value="../DataExtractionOSM/src/" />
|
|
<property name="use.absolute.dir" location="${use.dir}" />
|
|
<property name="raw.absolute.dir" location="raw" />
|
|
<property name="base.dir" location="." />
|
|
|
|
<target name="-package-resources">
|
|
<echo>Packaging resources and assets...</echo>
|
|
<exec executable="${aapt}">
|
|
<!-- failonerror="true"> -->
|
|
<arg value="package" />
|
|
<arg value="-f" />
|
|
<arg value="-M" />
|
|
<arg value="${base.dir}/AndroidManifest.xml" />
|
|
<arg value="-S" />
|
|
<arg value="${resource.absolute.dir}" />
|
|
<arg value="-A" />
|
|
<arg value="${asset.absolute.dir}" />
|
|
<arg value="-I" />
|
|
<arg value="${android.jar}" />
|
|
<arg value="-F" />
|
|
<arg value="${out.absolute.dir}/${resource.package.file.name}" />
|
|
<arg value="${raw.absolute.dir}" />
|
|
</exec>
|
|
</target>
|
|
|
|
<target name="-pre-build">
|
|
<delete dir="${raw.absolute.dir}" verbose="${verbose}" />
|
|
<mkdir dir="${raw.absolute.dir}/classes" />
|
|
<copy todir="${raw.absolute.dir}">
|
|
<fileset dir="${use.absolute.dir}">
|
|
<exclude name="**/*.java" />
|
|
</fileset>
|
|
</copy>
|
|
<if>
|
|
<condition>
|
|
<isset property="net.osmand" />
|
|
</condition>
|
|
<then>
|
|
<replaceregexp file="AndroidManifest.xml" match='package="net.osmand.plus"' replace='package="net.osmand"' byline="true" />
|
|
<replaceregexp file="res/values/no_translate.xml" match='"app_name">(.*)<' replace='"app_name">Osmand<' byline="true" />
|
|
</then>
|
|
<else>
|
|
<replaceregexp file="AndroidManifest.xml" match='package="net.osmand"' replace='package="net.osmand.plus"' byline="true" />
|
|
<replaceregexp file="res/values/no_translate.xml" match='"app_name">(.*)<' replace='"app_name">Osmand+<' byline="true" />
|
|
</else>
|
|
</if>
|
|
<if>
|
|
<condition>
|
|
<isset property="build.version" />
|
|
</condition>
|
|
<then>
|
|
<replaceregexp file="res/values/no_translate.xml" match='"app_version">(.*)<' replace='"app_version">${build.version}<' byline="true" />
|
|
</then>
|
|
</if>
|
|
</target>
|
|
|
|
|
|
<!-- Compiles this project's .java files into .class files. -->
|
|
<target name="-compile" depends="-build-setup, -pre-build, -code-gen, -pre-compile">
|
|
<do-only-if-manifest-hasCode elseText="hasCode = false. Skipping...">
|
|
<!-- Osmand plus support -->
|
|
<mkdir dir="${gen.absolute.dir}/net/osmand/plus"/>
|
|
<copy todir="${gen.absolute.dir}/net/osmand/plus">
|
|
<fileset dir="${gen.absolute.dir}/net/osmand">
|
|
<include name="R.java" />
|
|
</fileset>
|
|
</copy>
|
|
<replaceregexp file="${gen.absolute.dir}/net/osmand/plus/R.java" match='package net.osmand;' replace='package net.osmand.plus;' byline="true" />
|
|
<!-- If android rules are used for a test project, its classpath should include
|
|
tested project's location -->
|
|
<condition property="extensible.classpath"
|
|
value="${tested.project.absolute.dir}/bin/classes"
|
|
else=".">
|
|
<isset property="tested.project.absolute.dir" />
|
|
</condition>
|
|
<condition property="extensible.libs.classpath"
|
|
value="${tested.project.absolute.dir}/${jar.libs.dir}"
|
|
else="${jar.libs.dir}">
|
|
<isset property="tested.project.absolute.dir" />
|
|
</condition>
|
|
<javac encoding="${java.encoding}"
|
|
source="${java.source}" target="${java.target}"
|
|
debug="true" extdirs="" includeantruntime="false"
|
|
destdir="${out.classes.absolute.dir}"
|
|
bootclasspathref="android.target.classpath"
|
|
verbose="${verbose}"
|
|
classpath="${extensible.classpath}"
|
|
classpathref="jar.libs.ref">
|
|
<src path="${source.absolute.dir}" />
|
|
|
|
<!-- osmchange -->
|
|
<compilerarg value="-Xlint"/>
|
|
<src path="${use.absolute.dir}" />
|
|
<exclude name="**/LogUtil.java" />
|
|
<exclude name="**/OsmStorageWriter.java" />
|
|
<exclude name="**/net/osmand/data/index/" />
|
|
<exclude name="**/net/osmand/data/preparation/" />
|
|
<exclude name="**/net/osmand/osm/util/" />
|
|
<exclude name="**/net/osmand/swing/" />
|
|
<exclude name="**/rtree/" />
|
|
<!-- osmchange -->
|
|
|
|
<src path="${gen.absolute.dir}" />
|
|
<classpath>
|
|
<fileset dir="${extensible.libs.classpath}" includes="*.jar" />
|
|
</classpath>
|
|
<compilerarg line="${java.compilerargs}" />
|
|
</javac>
|
|
<!-- if the project is a library then we generate a jar file -->
|
|
<if condition="${project.is.library}">
|
|
<then>
|
|
<echo>Creating library output jar file...</echo>
|
|
<property name="out.library.jar.file" location="${out.absolute.dir}/classes.jar" />
|
|
<if>
|
|
<condition>
|
|
<length string="${android.package.excludes}" trim="true" when="greater" length="0" />
|
|
</condition>
|
|
<then>
|
|
<echo>Custom jar packaging exclusion: ${android.package.excludes}</echo>
|
|
</then>
|
|
</if>
|
|
<jar destfile="${out.library.jar.file}">
|
|
<fileset dir="${out.classes.absolute.dir}" excludes="**/R.class **/R$*.class"/>
|
|
<fileset dir="${source.absolute.dir}" excludes="**/*.java ${android.package.excludes}" />
|
|
</jar>
|
|
</then>
|
|
</if>
|
|
|
|
<!-- if the project is instrumented, intrument the classes -->
|
|
<if condition="${build.is.instrumented}">
|
|
<then>
|
|
<echo>Instrumenting classes from ${out.absolute.dir}/classes...</echo>
|
|
<!-- It only instruments class files, not any external libs -->
|
|
<emma enabled="true">
|
|
<instr verbosity="${verbosity}"
|
|
mode="overwrite"
|
|
instrpath="${out.absolute.dir}/classes"
|
|
outdir="${out.absolute.dir}/classes">
|
|
</instr>
|
|
<!-- TODO: exclusion filters on R*.class and allowing custom exclusion from
|
|
user defined file -->
|
|
</emma>
|
|
</then>
|
|
</if>
|
|
</do-only-if-manifest-hasCode>
|
|
</target>
|
|
|
|
|
|
<!--taskdef classname="net.bluecow.googlecode.ant.GoogleCodeUploadTask"
|
|
classpath="ant-lib/ant-googlecode-0.0.2.jar" name="gcupload"/-->
|
|
|
|
<path id="lib.path">
|
|
<fileset dir="ant-lib" includes="*.jar" />
|
|
</path>
|
|
|
|
<!-- Import the actual build file.
|
|
|
|
To customize existing targets, there are two options:
|
|
- Customize only one target:
|
|
- copy/paste the target into this file, *before* the
|
|
<import> task.
|
|
- customize it to your needs.
|
|
- Customize the whole content of build.xml
|
|
- copy/paste the content of the rules files (minus the top node)
|
|
into this file, replacing the <import> task.
|
|
- customize to your needs.
|
|
|
|
***********************
|
|
****** IMPORTANT ******
|
|
***********************
|
|
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
|
|
in order to avoid having your file be overridden by tools such as "android update project"
|
|
-->
|
|
<!-- version-tag: 1 -->
|
|
<import file="${sdk.dir}/tools/ant/build.xml" />
|
|
|
|
<macrodef name="package-helper">
|
|
<element name="extra-jars" optional="yes" />
|
|
<sequential>
|
|
<if>
|
|
<condition>
|
|
<isset property="nativeoff"/>
|
|
</condition>
|
|
<then>
|
|
<echo>Package helper running: nativeoff</echo>
|
|
<apkbuilder
|
|
outfolder="${out.absolute.dir}"
|
|
resourcefile="${resource.package.file.name}"
|
|
apkfilepath="${out.packaged.file}"
|
|
debugpackaging="${build.is.packaging.debug}"
|
|
debugsigning="${build.is.signing.debug}"
|
|
verbose="${verbose}"
|
|
hascode="${manifest.hasCode}"
|
|
previousBuildType="${build.last.is.packaging.debug}/${build.last.is.signing.debug}"
|
|
buildType="${build.is.packaging.debug}/${build.is.signing.debug}">
|
|
<dex path="${intermediate.dex.file}"/>
|
|
<sourcefolder path="${source.absolute.dir}"/>
|
|
<jarfile refid="jar.libs.ref" />
|
|
<extra-jars/>
|
|
</apkbuilder>
|
|
</then>
|
|
<else>
|
|
<fail message="ndk.dir is missing. Make sure to generate local.properties or to inject it through an env var" unless="ndk.dir"/>
|
|
<!-- Requires 1) gcc, 2) make, 3) download android sources (skia) - specify branch 4) Define environment variable ANDROID_SRC -->
|
|
<echo>Package helper running: nativeon</echo>
|
|
|
|
<exec command="${ndk.dir}/ndk-build V=1" failonerror="true"/>
|
|
<apkbuilder
|
|
outfolder="${out.absolute.dir}"
|
|
resourcefile="${resource.package.file.name}"
|
|
apkfilepath="${out.packaged.file}"
|
|
debugpackaging="${build.is.packaging.debug}"
|
|
debugsigning="${build.is.signing.debug}"
|
|
verbose="${verbose}"
|
|
hascode="${manifest.hasCode}"
|
|
previousBuildType="${build.last.is.packaging.debug}/${build.last.is.signing.debug}"
|
|
buildType="${build.is.packaging.debug}/${build.is.signing.debug}">
|
|
<dex path="${intermediate.dex.file}"/>
|
|
<sourcefolder path="${source.absolute.dir}"/>
|
|
<jarfile refid="jar.libs.ref" />
|
|
<nativefolder path="${native.libs.absolute.dir}" />
|
|
<nativefolder refid="project.libraries.libs" />
|
|
<extra-jars/>
|
|
</apkbuilder>
|
|
</else>
|
|
</if>
|
|
</sequential>
|
|
</macrodef>
|
|
|
|
<target name="debug-nondk">
|
|
<property name="nativeoff" value="true"/>
|
|
<antcall target="debug"/>
|
|
</target>
|
|
|
|
<taskdef name="cpd" classname="net.sourceforge.pmd.cpd.CPDTask" classpathref="lib.path"/>
|
|
|
|
<target name="cpd" description="Search for cut-and-pasted code">
|
|
<property name="cpd.report.xml" location="cpd.xml"/>
|
|
<cpd minimumTokenCount="100" format="xml" outputFile="${cpd.report.xml}"
|
|
ignoreLiterals="true" ignoreIdentifiers="true">
|
|
<fileset dir="${source.absolute.dir}" includes="**/*.java"/>
|
|
</cpd>
|
|
</target>
|
|
|
|
<!-- NOT used now for night builds could be deleted
|
|
<typedef resource="org/tigris/subversion/svnant/svnantlib.xml" classpathref="lib.path" />
|
|
<target name="update">
|
|
<svn svnkit="true">
|
|
<info target="." />
|
|
</svn>
|
|
<echo>Current revision: ${svn.info.rev}</echo>
|
|
<svn svnkit="true">
|
|
<update dir="." revision="HEAD" />
|
|
<update dir="${use.absolute.dir}" revision="HEAD" />
|
|
<info target="." />
|
|
</svn>
|
|
<echo>Updated to revision: ${svn.info.rev}</echo>
|
|
<echo>Modyfing Version.java to include revision info: debug r${svn.info.rev}</echo>
|
|
<replaceregexp file="${use.absolute.dir}/net/osmand/Version.java" match='(APP_DESCRIPTION.*=.*\").*(\".*)' replace='\1debug r${svn.info.rev}\2' byline="true" />
|
|
</target>
|
|
|
|
<target name="nightbuild" depends="clean,update,debug">
|
|
<ftp action="del" server="download.osmand.net" userid="${ftp.user}" password="${ftp.password}">
|
|
<fileset>
|
|
<include name="night-builds/OsmAnd-debug.apk" />
|
|
</fileset>
|
|
</ftp>
|
|
|
|
|
|
<ftp server="download.osmand.net" remotedir="night-builds" userid="${ftp.user}" password="${ftp.password}" depends="yes">
|
|
<fileset dir="bin">
|
|
<include name="OsmAnd-debug.apk" />
|
|
</fileset>
|
|
</ftp>
|
|
|
|
</target> -->
|
|
|
|
</project>
|