2010-12-17 00:01:02 +01:00
<?xml version="1.0" encoding="UTF-8"?>
<project name= "OsmAnd" default= "help" >
2012-01-07 01:41:38 +01:00
2012-08-27 20:28:35 +02:00
<property file= "local.properties" />
<property file= "ant.properties" />
<loadproperties srcFile= "project.properties" />
2010-12-17 00:01:02 +01:00
2012-08-27 20:28:35 +02:00
<!-- quick check on sdk.dir -->
<fail
2014-07-31 12:30:17 +02:00
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" />
2012-01-07 01:41:38 +01:00
2013-04-18 23:35:02 +02:00
<property name= "use.dir" value= "../OsmAnd-java/src" />
2012-08-27 20:28:35 +02:00
<property name= "use.absolute.dir" location= "${use.dir}" />
2013-07-22 09:14:17 +02:00
<property name= "src.absolute.dir" location= "src" />
2012-08-27 20:28:35 +02:00
<property name= "base.dir" location= "." />
2014-10-03 16:48:49 +02:00
<target name= "download_resources" >
2015-01-25 22:03:37 +01:00
<get src= "http://builder.osmand.net/binaries/android/OsmAndCore_wrapper.jar"
2014-12-19 17:37:46 +01:00
dest="libs/OsmAndCore_wrapper.jar" usetimestamp="true"/>
2015-01-25 22:03:37 +01:00
<get src= "http://builder.osmand.net/ivy/net.osmand/OsmAndCore_android/0.1-SNAPSHOT/OsmAndCore_android-0.1-SNAPSHOT.aar"
2014-12-19 17:37:46 +01:00
dest="OsmAndCore_android.aar" usetimestamp="true"/>
2015-01-25 22:03:37 +01:00
<get src= "http://builder.osmand.net/ivy/net.osmand/OsmAndCore_androidNativeRelease/0.1-SNAPSHOT/OsmAndCore_androidNativeRelease-0.1-SNAPSHOT.aar"
2014-12-19 17:37:46 +01:00
dest="OsmAndCore_androidNativeRelease.aar" usetimestamp="true"/>
2014-10-03 16:48:49 +02:00
</target>
<target name= "use_qt_core" depends= "download_resources" >
2014-12-19 17:37:46 +01:00
<unzip src= "OsmAndCore_androidNativeRelease.aar" dest= "libs" >
2014-10-03 16:48:49 +02:00
<patternset >
<include name= "jni/armeabi-v7a/*" />
</patternset>
<cutdirsmapper dirs= "1" />
</unzip>
2014-12-19 20:09:14 +01:00
<unzip src= "OsmAndCore_android.aar" dest= "libs" >
<patternset >
<include name= "jni/armeabi-v7a/*" />
</patternset>
<cutdirsmapper dirs= "1" />
</unzip>
2014-10-03 16:48:49 +02:00
<unzip src= "OsmAndCore_android.aar" dest= "." >
<patternset >
<include name= "assets/**/*" />
2014-12-19 20:09:14 +01:00
<exclude name= "assets/OsmAndCore_ResourcesBundle/map/fonts/**/*" />
</patternset>
</unzip>
<unzip src= "OsmAndCore_android.aar" dest= "." >
<patternset >
<include name= "assets/**/map/fonts/OpenSans/*" />
<include name= "assets/**/map/fonts/NotoSans/*" />
2014-10-03 16:48:49 +02:00
</patternset>
</unzip>
</target>
<target name= "fix_apostrophe_issues" >
2014-11-27 16:03:46 +01:00
<replace token= "version='1.0'" value= "version="1.0"" encoding= "UTF-8" >
2014-10-03 16:48:49 +02:00
<fileset dir= "res" includes= "**/strings.xml" />
</replace>
2014-11-27 16:03:46 +01:00
<replace token= "encoding='utf-8'" value= "encoding="utf-8"" encoding= "UTF-8" >
2014-10-03 16:48:49 +02:00
<fileset dir= "res" includes= "**/strings.xml" />
</replace>
2014-11-27 16:03:46 +01:00
<replaceregexp match= "([^\\])'" replace= "\1\\\\'" flags= "-g" byline= "off" encoding= "UTF-8" >
2014-10-03 16:48:49 +02:00
<fileset dir= "res" includes= "**/strings.xml" />
</replaceregexp>
</target>
<target name= "copy_sherpafy" >
<copy todir= "gen/net/osmand/plus" >
<fileset dir= "gen/net/osmand/sherpafy" >
<include name= "R.java" />
</fileset>
</copy>
<replaceregexp file= "gen/net/osmand/plus/R.java" match= 'package (.*);' replace= 'package net.osmand.plus;' byline= "true" />
</target>
2013-06-17 01:31:59 +02:00
<target name= "copy_resources" >
2014-07-18 14:41:39 +02:00
<copy todir= "assets" >
2014-07-31 12:30:17 +02:00
<fileset dir= "../../resources/" >
<include name= "voice/**/*.p" />
2013-06-17 01:31:59 +02:00
</fileset>
2014-07-18 14:41:39 +02:00
</copy>
2015-09-09 18:22:47 +02:00
<copy todir= "assets/fonts" >
<fileset dir= "../../resources/fonts" >
<include name= "*.ttf" />
</fileset>
<fileset dir= "../../resources/rendering_styles/fonts/OpenSans" >
<include name= "*.ttf" />
</fileset>
</copy>
2014-07-18 14:41:39 +02:00
<copy todir= "res/" >
2013-07-07 01:40:15 +02:00
<fileset dir= "../../resources/rendering_styles/style-icons/" >
2014-07-31 12:30:17 +02:00
<include name= "**/*" />
2013-06-17 01:42:11 +02:00
</fileset>
2014-07-18 14:41:39 +02:00
</copy>
<copy todir= "${src.absolute.dir}/net/osmand/router/" >
2014-07-31 12:30:17 +02:00
<fileset dir= "../../resources/routing/" >
<include name= "*.xml" />
2013-06-17 01:31:59 +02:00
</fileset>
2014-07-18 14:41:39 +02:00
</copy>
2014-07-18 14:37:36 +02:00
<sync todir= "assets/help/" >
2015-11-11 19:45:54 +01:00
<fileset dir= "../../help/website/help" >
2014-07-31 12:30:17 +02:00
<include name= "*.html" />
2014-07-12 01:08:20 +02:00
</fileset>
2014-07-18 14:37:36 +02:00
</sync>
2014-07-20 02:39:46 +02:00
<copy todir= "assets/help" >
2014-07-31 12:30:17 +02:00
<fileset dir= "assets/" >
<include name= "style.css" />
2014-07-20 02:39:46 +02:00
</fileset>
</copy>
2014-07-18 14:41:39 +02:00
<copy todir= "${src.absolute.dir}/net/osmand/render/" >
2014-07-31 12:30:17 +02:00
<fileset dir= "../../resources/rendering_styles/" >
<include name= "*.xml" />
2013-06-17 01:31:59 +02:00
</fileset>
2014-07-18 14:41:39 +02:00
</copy>
2013-07-22 09:14:17 +02:00
<copy todir= "${src.absolute.dir}/net/osmand/osm/" >
2014-07-31 12:30:17 +02:00
<fileset dir= "../../resources/obf_creation/" >
<include name= "rendering_types.xml" />
2013-06-21 09:34:12 +02:00
</fileset>
2014-11-19 00:47:59 +01:00
<fileset dir= "../../resources/poi/" >
<include name= "poi_types.xml" />
</fileset>
2013-06-21 09:34:12 +02:00
</copy>
2013-07-22 09:14:17 +02:00
<copy todir= "${src.absolute.dir}/net/osmand/map/" >
2014-07-31 12:30:17 +02:00
<fileset dir= "../../resources/countries-info/" >
<include name= "regions.ocbf" />
2013-06-17 01:31:59 +02:00
</fileset>
</copy>
</target>
2014-10-03 16:48:49 +02:00
<!-- Import the actual build file.
2013-06-17 01:31:59 +02:00
2014-10-03 16:48:49 +02:00
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: custom -->
<import file= "${sdk.dir}/tools/ant/build.xml" />
2013-06-17 01:31:59 +02:00
2010-12-17 00:07:07 +01:00
2014-10-03 16:48:49 +02:00
<!-- ******************** -->
<!-- OVERRIDE TARGET prepare resources -->
2012-04-18 01:16:35 +02:00
<!-- Extra target -->
2014-10-03 16:48:49 +02:00
<target name= "-pre-build" depends= "download_resources,copy_resources,fix_apostrophe_issues" >
2012-08-27 20:28:35 +02:00
<if >
<condition >
<isset property= "versionFeatures" />
</condition>
<then >
<replaceregexp file= "res/values/no_translate.xml" match= 'versionFeatures">(.*)<' replace= 'versionFeatures">${versionFeatures}<' byline= "true" />
</then>
</if>
2014-06-17 20:34:44 +02:00
<if >
<condition >
<isset property= "net.osmand.sherpafy" />
</condition>
<then >
<property name= "package.name" value= "net.osmand.sherpafy" />
<property name= "app.name" value= "Sherpafy" />
2014-07-16 15:13:19 +02:00
<replaceregexp file= "AndroidManifest.xml" match= '"@drawable/([^\s]*)"' replace= '"@drawable/icon_sherpafy"' byline= "true" />
2014-06-17 20:34:44 +02:00
</then>
2014-06-18 02:01:02 +02:00
</if>
<if >
<condition >
2014-07-31 12:30:17 +02:00
<isset property= "net.osmand" />
</condition>
<then >
<property name= "package.name" value= "net.osmand" />
2014-06-18 02:01:02 +02:00
<property name= "app.name" value= "OsmAnd" />
2014-07-16 15:13:19 +02:00
<replaceregexp file= "AndroidManifest.xml" match= '"@drawable/([^\s]*)"' replace= '"@drawable/icon_free"' byline= "true" />
2014-07-31 12:30:17 +02:00
</then>
</if>
2014-06-18 02:01:02 +02:00
<if >
<condition >
2014-07-31 12:30:17 +02:00
<isset property= "net.osmand.plus" />
</condition>
<then >
<property name= "package.name" value= "net.osmand.plus" />
<property name= "app.name" value= "OsmAnd+" />
<replaceregexp file= "AndroidManifest.xml" match= '"@drawable/([^\s]*)"' replace= '"@drawable/icon"' byline= "true" />
</then>
</if>
2014-06-18 01:35:55 +02:00
<if >
<condition >
<isset property= "package.name" />
</condition>
<then >
<replaceregexp file= "AndroidManifest.xml" match= 'package="(.*)"' replace= 'package="${package.name}"' byline= "true" />
<replaceregexp file= "AndroidManifest.xml" match= 'android:process="(.*)"' replace= 'android:process="${package.name}"' byline= "true" />
<replaceregexp file= "res/values/no_translate.xml" match= '"app_name">(.*)<' replace= '"app_name">${app.name}<' byline= "true" />
<replaceregexp file= "res/layout/search_address.xml" match= 'xmlns:custom="http://schemas.android.com/apk/res/(.*)"'
2014-07-31 12:30:17 +02:00
replace='xmlns:custom="http://schemas.android.com/apk/res/${package.name}"' byline="true" />
2015-06-21 14:14:33 +02:00
<replaceregexp file= "res/layout/search_point.xml" match= 'xmlns:custom="http://schemas.android.com/apk/res/(.*)"'
2014-07-31 12:30:17 +02:00
replace='xmlns:custom="http://schemas.android.com/apk/res/${package.name}"' byline="true" />
2014-06-18 01:35:55 +02:00
</then>
</if>
2012-08-27 20:28:35 +02:00
<if >
<condition >
<isset property= "build.version.code" />
</condition>
<then >
<replaceregexp file= "AndroidManifest.xml" match= 'android:versionCode="(.*)"' replace= 'android:versionCode="${build.version.code}"' byline= "true" />
2013-08-04 01:32:44 +02:00
<replaceregexp file= "AndroidManifest.xml" match= 'android:debuggable="true"' replace= 'android:debuggable="false"' byline= "true" />
2012-08-27 20:28:35 +02:00
</then>
</if>
<if >
<condition >
<isset property= "build.version" />
</condition>
<then >
2014-12-07 10:12:34 +01:00
<!-- old expression with manual version input: replaceregexp file="res/values/no_translate.xml" match='"app_version">(.*)<' replace='"app_version">2.0.0${build.version}<' byline="true" / -->
2014-12-07 15:28:51 +01:00
<!-- From old dev apk version string, cut off old build number ("#old_build_number" and after) and compile new apk version from app_version and #new_build_number (=BUILD_NUMBER in builder) -->
2014-12-07 10:12:34 +01:00
<replaceregexp file= "res/values/no_translate.xml" match= '"app_version">([^#]+)(.*)<' replace= '"app_version">\1${build.version}<' byline= "true" />
2012-08-27 20:28:35 +02:00
</then>
</if>
2014-12-07 15:05:47 +01:00
<if >
<condition >
<isset property= "app.edition" />
</condition>
<then >
2014-12-07 15:28:51 +01:00
<!-- Use BUILD_ID from builder to get precise apk Edition date -->
2014-12-07 15:05:47 +01:00
<replaceregexp file= "res/values/no_translate.xml" match= '"app_edition">(.*)<' replace= '"app_edition">${app.edition}<' byline= "true" />
</then>
</if>
2012-08-27 20:28:35 +02:00
</target>
2010-12-17 00:07:07 +01:00
2014-10-03 16:48:49 +02:00
<!-- ******************** -->
<!-- OVERRIDE TARGET to replace strings for compilation -->
<!-- Code Generation: compile resources (aapt - > R.java), aidl, renderscript -->
2012-04-18 01:16:35 +02:00
<!-- Compiles this project's .java files into .class files. -->
2012-08-27 20:28:35 +02:00
<target name= "-compile" depends= "-build-setup, -pre-build, -code-gen, -pre-compile" >
<!-- osmchange : Osmand plus support -->
2014-07-31 12:30:17 +02:00
<mkdir dir= "${gen.absolute.dir}/net/osmand/plus" />
2014-06-18 01:45:13 +02:00
<if >
<condition >
<isset property= "net.osmand.sherpafy" />
</condition>
<then >
2014-07-31 12:30:17 +02:00
<copy todir= "${gen.absolute.dir}/net/osmand/plus" >
2014-06-18 01:45:13 +02:00
<fileset dir= "${gen.absolute.dir}/net/osmand/sherpafy" >
<include name= "R.java" />
</fileset>
</copy>
</then>
</if>
<if >
<condition >
<isset property= "net.osmand" />
</condition>
<then >
2014-07-31 12:30:17 +02:00
<copy todir= "${gen.absolute.dir}/net/osmand/plus" >
2014-06-18 01:45:13 +02:00
<fileset dir= "${gen.absolute.dir}/net/osmand" >
<include name= "R.java" />
</fileset>
</copy>
</then>
</if>
2014-06-17 20:59:30 +02:00
<replaceregexp file= "${gen.absolute.dir}/net/osmand/plus/R.java" match= 'package (.*);' replace= 'package net.osmand.plus;' byline= "true" />
2012-08-27 20:28:35 +02:00
<!-- osmchange : Osmand plus support -->
2012-08-27 20:38:34 +02:00
2012-08-27 20:28:35 +02:00
<do-only-if-manifest-hasCode elseText= "hasCode = false. Skipping..." >
<!-- merge the project's own classpath and the tested project's classpath -->
<path id= "project.javac.classpath" >
<path refid= "project.all.jars.path" />
<path refid= "tested.project.classpath" />
</path>
<javac encoding= "${java.encoding}" source= "${java.source}" target= "${java.target}" debug= "true" extdirs= "" includeantruntime= "false" destdir= "${out.classes.absolute.dir}" bootclasspathref= "project.target.class.path" verbose= "${verbose}" classpathref= "project.javac.classpath" fork= "${need.javac.fork}" >
<src path= "${source.absolute.dir}" />
2012-04-18 01:16:35 +02:00
<src path= "${gen.absolute.dir}" />
2012-08-27 20:28:35 +02:00
<compilerarg line= "${java.compilerargs}" />
2012-08-27 20:38:34 +02:00
<!-- osmchange -->
<src path= "${use.absolute.dir}" />
2013-01-29 18:35:00 +01:00
<exclude name= "**/PlatformUtil.java" />
2012-08-27 20:36:03 +02:00
<!-- osmchange -->
2012-08-27 20:28:35 +02:00
</javac>
<!-- if the project is instrumented, intrument the classes -->
<if condition= "${build.is.instrumented}" >
<then >
<echo level= "info" > Instrumenting classes from ${out.absolute.dir}/classes...</echo>
<!-- build the filter to remove R, Manifest, BuildConfig -->
<getemmafilter appPackage= "${project.app.package}" libraryPackagesRefId= "project.library.packages" filterOut= "emma.default.filter" />
2012-04-18 01:16:35 +02:00
2012-08-27 20:28:35 +02:00
<!-- define where the .em file is going. This may have been
2014-07-31 12:30:17 +02:00
setup already if this is a library -->
2012-08-27 20:28:35 +02:00
<property name= "emma.coverage.absolute.file" location= "${out.absolute.dir}/coverage.em" />
2012-04-18 01:16:35 +02:00
2012-08-27 20:28:35 +02:00
<!-- 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" metadatafile= "${emma.coverage.absolute.file}" >
<filter excludes= "${emma.default.filter}" />
<filter value= "${emma.filter}" />
</instr>
</emma>
</then>
</if>
2012-01-07 01:41:38 +01:00
2012-08-27 20:28:35 +02:00
<!-- if the project is a library then we generate a jar file -->
<if condition= "${project.is.library}" >
<then >
<echo level= "info" > 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 level= "info" > Custom jar packaging exclusion: ${android.package.excludes}</echo>
</then>
</if>
<propertybyreplace name= "project.app.package.path" input= "${project.app.package}" replace= "." with= "/" />
<jar destfile= "${out.library.jar.file}" >
<fileset dir= "${out.classes.absolute.dir}" includes= "**/*.class" excludes= "${project.app.package.path}/R.class ${project.app.package.path}/R$*.class ${project.app.package.path}/Manifest.class ${project.app.package.path}/Manifest$*.class ${project.app.package.path}/BuildConfig.class" />
<fileset dir= "${source.absolute.dir}" excludes= "**/*.java ${android.package.excludes}" />
</jar>
</then>
</if>
</do-only-if-manifest-hasCode>
</target>
2012-01-07 01:41:38 +01:00
2014-10-03 16:48:49 +02:00
<!-- ******************** -->
<!-- OVERRIDE TARGET to not zip qz in aapt -->
<!-- Code Generation: compile resources (aapt - > R.java), aidl, renderscript -->
<target name= "-code-gen" >
<!-- always merge manifest -->
<mergemanifest
appManifest="${manifest.abs.file}"
outManifest="${out.manifest.abs.file}"
enabled="${manifestmerger.enabled}">
<library refid= "project.library.manifest.file.path" />
</mergemanifest>
2011-11-08 17:27:00 +01:00
2014-10-03 16:48:49 +02:00
<do-only-if-manifest-hasCode
elseText="hasCode = false. Skipping aidl/renderscript/R.java">
<echo level= "info" > Handling aidl files...</echo>
<aidl executable= "${aidl}"
framework="${project.target.framework.aidl}"
libraryBinAidlFolderPathRefid="project.library.bin.aidl.folder.path"
genFolder="${gen.absolute.dir}"
aidlOutFolder="${out.aidl.absolute.dir}">
<source path= "${source.absolute.dir}" />
</aidl>
2013-06-17 00:54:57 +02:00
2014-10-03 16:48:49 +02:00
<echo level= "info" > ----------</echo>
<echo level= "info" > Handling Resources...</echo>
<aapt executable= "${aapt}"
command="package"
verbose="${verbose}"
manifest="${out.manifest.abs.file}"
originalManifestPackage="${project.app.package}"
androidjar="${project.target.android.jar}"
rfolder="${gen.absolute.dir}"
nonConstantId="${android.library}"
libraryResFolderPathRefid="project.library.res.folder.path"
libraryPackagesRefid="project.library.packages"
libraryRFileRefid="project.library.bin.r.file.path"
ignoreAssets="${aapt.ignore.assets}"
binFolder="${out.absolute.dir}"
proguardFile="${out.absolute.dir}/proguard.txt">
<res path= "${out.res.absolute.dir}" />
<res path= "${resource.absolute.dir}" />
<nocompress extension= "qz" />
</aapt>
2013-06-17 00:54:57 +02:00
2014-10-03 16:48:49 +02:00
<echo level= "info" > ----------</echo>
<echo level= "info" > Handling BuildConfig class...</echo>
<buildconfig
genFolder="${gen.absolute.dir}"
package="${project.app.package}"
buildType="${build.is.packaging.debug}"
previousBuildType="${build.last.is.packaging.debug}"/>
2012-01-07 01:41:38 +01:00
2014-10-03 16:48:49 +02:00
</do-only-if-manifest-hasCode>
</target>
2010-12-17 00:01:02 +01:00
</project>