Fix scripts

This commit is contained in:
Victor Shcherb 2012-08-27 20:28:35 +02:00
parent 26983747a3
commit bbeef337a3

View file

@ -1,29 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="OsmAnd" default="help">
<property file="local.properties" />
<property file="ant.properties" />
<loadproperties srcFile="project.properties" />
<property file="local.properties" />
<property file="ant.properties" />
<loadproperties srcFile="project.properties" />
<!-- quick check on sdk.dir -->
<fail
<!-- 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"
/>
<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="." />
<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="." />
<!-- Puts the project's resources into the output package file
This actually can create multiple resource package in case
Some custom apk with specific configuration have been
declared in default.properties.
-->
<target name="-package-resources" depends="-crunch">
<aapt executable="${aapt}"
<target name="-package-resources" depends="-crunch">
<aapt executable="${aapt}"
command="package"
versioncode="${version.code}"
versionname="${version.name}"
@ -42,7 +42,7 @@
<res path="${out.res.absolute.dir}" />
<res path="${resource.absolute.dir}" />
</aapt>
<!-- osmchange -->
<echo>Packaging aditional OsmAnd resources and assets... to ${out.packaged.file} from ${raw.absolute.dir}</echo>
<exec executable="${aapt}">
@ -54,68 +54,68 @@
<arg value="${raw.absolute.dir}" />
</exec>
<!-- osmchange -->
</target>
</target>
<!-- Extra 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="versionFeatures" />
</condition>
<then>
<replaceregexp file="res/values/no_translate.xml" match='versionFeatures"&gt;(.*)&lt;' replace='versionFeatures"&gt;${versionFeatures}&lt;' byline="true" />
</then>
</if>
<if>
<condition>
<isset property="net.osmand" />
</condition>
<then>
<replaceregexp file="AndroidManifest.xml" match='"@drawable/icon"' replace='"@drawable/icon_free"' byline="true" />
<replaceregexp file="AndroidManifest.xml" match='package="net.osmand.plus"' replace='package="net.osmand"' byline="true" />
<replaceregexp file="AndroidManifest.xml" match='android:process="net.osmand.plus"' replace='android:process="net.osmand"' byline="true" />
<replaceregexp file="res/values/no_translate.xml" match='"app_name"&gt;(.*)&lt;' replace='"app_name"&gt;Osmand&lt;' byline="true" />
<replaceregexp file="res/layout/search_address.xml" match='net.osmand.plus' replace='net.osmand' byline="true" />
<replaceregexp file="res/layout/navigate_point.xml" match='net.osmand.plus' replace='net.osmand' byline="true" />
</then>
<else>
<replaceregexp file="AndroidManifest.xml" match='"@drawable/icon_free"' replace='"@drawable/icon"' byline="true" />
<replaceregexp file="AndroidManifest.xml" match='package="net.osmand"' replace='package="net.osmand.plus"' byline="true" />
<replaceregexp file="AndroidManifest.xml" match='android:process="net.osmand"' replace='android:process="net.osmand.plus"' byline="true" />
</else>
</if>
<if>
<condition>
<isset property="net.osmand.plus" />
</condition>
<then>
<replaceregexp file="res/values/no_translate.xml" match='"app_name"&gt;(.*)&lt;' replace='"app_name"&gt;Osmand+&lt;' byline="true" />
</then>
</if>
<if>
<condition>
<isset property="build.version.code" />
</condition>
<then>
<replaceregexp file="AndroidManifest.xml" match='android:versionCode="(.*)"' replace='android:versionCode="${build.version.code}"' byline="true" />
</then>
</if>
<if>
<condition>
<isset property="build.version" />
</condition>
<then>
<replaceregexp file="res/values/no_translate.xml" match='"app_version"&gt;(.*)&lt;' replace='"app_version"&gt;${build.version}&lt;' byline="true" />
</then>
</if>
<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="versionFeatures" />
</condition>
<then>
<replaceregexp file="res/values/no_translate.xml" match='versionFeatures"&gt;(.*)&lt;' replace='versionFeatures"&gt;${versionFeatures}&lt;' byline="true" />
</then>
</if>
<if>
<condition>
<isset property="net.osmand" />
</condition>
<then>
<replaceregexp file="AndroidManifest.xml" match='"@drawable/icon"' replace='"@drawable/icon_free"' byline="true" />
<replaceregexp file="AndroidManifest.xml" match='package="net.osmand.plus"' replace='package="net.osmand"' byline="true" />
<replaceregexp file="AndroidManifest.xml" match='android:process="net.osmand.plus"' replace='android:process="net.osmand"' byline="true" />
<replaceregexp file="res/values/no_translate.xml" match='"app_name"&gt;(.*)&lt;' replace='"app_name"&gt;Osmand&lt;' byline="true" />
<replaceregexp file="res/layout/search_address.xml" match='net.osmand.plus' replace='net.osmand' byline="true" />
<replaceregexp file="res/layout/navigate_point.xml" match='net.osmand.plus' replace='net.osmand' byline="true" />
</then>
<else>
<replaceregexp file="AndroidManifest.xml" match='"@drawable/icon_free"' replace='"@drawable/icon"' byline="true" />
<replaceregexp file="AndroidManifest.xml" match='package="net.osmand"' replace='package="net.osmand.plus"' byline="true" />
<replaceregexp file="AndroidManifest.xml" match='android:process="net.osmand"' replace='android:process="net.osmand.plus"' byline="true" />
</else>
</if>
<if>
<condition>
<isset property="net.osmand.plus" />
</condition>
<then>
<replaceregexp file="res/values/no_translate.xml" match='"app_name"&gt;(.*)&lt;' replace='"app_name"&gt;Osmand+&lt;' byline="true" />
</then>
</if>
<if>
<condition>
<isset property="build.version.code" />
</condition>
<then>
<replaceregexp file="AndroidManifest.xml" match='android:versionCode="(.*)"' replace='android:versionCode="${build.version.code}"' byline="true" />
</then>
</if>
<if>
<condition>
<isset property="build.version" />
</condition>
<then>
<replaceregexp file="res/values/no_translate.xml" match='"app_version"&gt;(.*)&lt;' replace='"app_version"&gt;${build.version}&lt;' byline="true" />
</then>
</if>
<!-- Native section -->
<if>
<condition>
@ -123,9 +123,9 @@
</condition>
<then>
<echo>Not using native, excluding from build</echo>
<move file="${native.libs.absolute.dir}/armeabi" tofile="${native.libs.absolute.dir}.skipped/armeabi" />
<!--<move file="${native.libs.absolute.dir}/armeabi" tofile="${native.libs.absolute.dir}.skipped/armeabi" />
<move file="${native.libs.absolute.dir}/armeabi-v7a" tofile="${native.libs.absolute.dir}.skipped/armeabi-v7a" />
<move file="${native.libs.absolute.dir}/x86" tofile="${native.libs.absolute.dir}.skipped/x86" />
<move file="${native.libs.absolute.dir}/x86" tofile="${native.libs.absolute.dir}.skipped/x86" /> -->
</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"/>
@ -134,123 +134,98 @@
<exec command="sh ${ndk.dir}/ndk-build -j8 V=1" failonerror="true"/>
</else>
</if>
</target>
<!-- Compiles this project's .java files into .class files. -->
<target name="-compile" depends="-build-setup, -pre-build, -code-gen, -pre-compile">
<!-- osmchange : 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" />
<!-- osmchange : Osmand plus support -->
<do-only-if-manifest-hasCode elseText="hasCode = false. Skipping...">
<!-- 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="project.libraries.jars"
fork="${need.javac.fork}">
<src path="${source.absolute.dir}" />
<src path="${gen.absolute.dir}" />
<classpath>
<fileset dir="${extensible.libs.classpath}" includes="*.jar" />
</classpath>
<compilerarg line="${java.compilerargs}" />
<!-- osmchange -->
<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="**/net/osmand/router/test/" />
<exclude name="**/resources/" />
<exclude name="**/rtree/" />
<!-- osmchange -->
</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>
<propertybyreplace name="manifest.package.path" input="${manifest.package}" replace="." with="/" />
<jar destfile="${out.library.jar.file}">
<fileset dir="${out.classes.absolute.dir}"
includes="**/*.class"
excludes="${manifest.package.path}/R.class ${manifest.package.path}/R$*.class ${manifest.package.path}/Manifest.class ${manifest.package.path}/Manifest$*.class ${manifest.package.path}/BuildConfig.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">
<filter excludes="${manifest.package}.R,${manifest.package}.R$$*,${manifest.package}.BuildConfig" />
<filter value="${emma.filter}" />
</instr>
</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>
<target name="debug-nondk">
<property name="nativeoff" value="true"/>
<antcall target="debug"/>
</target>
<target name="-post-package" if="nativeoff">
<echo>Restoring ${native.libs.absolute.dir} to it's place...</echo>
<move file="${native.libs.absolute.dir}.skipped" tofile="${native.libs.absolute.dir}"/>
</target>
<!-- Import the actual build file.
<!-- Compiles this project's .java files into .class files. -->
<target name="-compile" depends="-build-setup, -pre-build, -code-gen, -pre-compile">
<!-- osmchange : 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" />
<!-- osmchange : Osmand plus support -->
<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}" />
<src path="${gen.absolute.dir}" />
<compilerarg line="${java.compilerargs}" />
</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" />
<!-- define where the .em file is going. This may have been
setup already if this is a library -->
<property name="emma.coverage.absolute.file" location="${out.absolute.dir}/coverage.em" />
<!-- 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>
<!-- 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>
<!--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>
<target name="debug-nondk">
<property name="nativeoff" value="true" />
<antcall target="debug" />
</target>
<target name="-post-package" if="nativeoff">
<echo>Restoring ${native.libs.absolute.dir} to it's place...</echo>
<move file="${native.libs.absolute.dir}.skipped" tofile="${native.libs.absolute.dir}" />
</target>
<!-- Import the actual build file.
To customize existing targets, there are two options:
- Customize only one target:
@ -268,50 +243,17 @@
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" />
<!-- version-tag: custom -->
<import file="${sdk.dir}/tools/ant/build.xml" />
<taskdef name="cpd" classname="net.sourceforge.pmd.cpd.CPDTask" classpathref="lib.path"/>
<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}"
<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" />
<fileset dir="${source.absolute.dir}" includes="**/*.java"/>
</cpd>
</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>