Workaround for SDK17 bug

This commit is contained in:
Alexey Pelykh 2012-04-08 14:58:43 +03:00
parent 0e4ab0a07f
commit 60970375ae
3 changed files with 71 additions and 14 deletions

View file

@ -18,3 +18,4 @@
key.alias=osmand key.alias=osmand
key.store=../../osmand_key key.store=../../osmand_key
jar.libs.dir=lib jar.libs.dir=lib
java.compilerargs=-Xlint

View file

@ -39,9 +39,6 @@
application and should be checked into Version Control Systems. --> application and should be checked into Version Control Systems. -->
<loadproperties srcFile="project.properties" /> <loadproperties srcFile="project.properties" />
<!-- specify java.compilerArgs if they were not specified -->
<property name="java.compilerargs" value=""/>
<!-- quick check on sdk.dir --> <!-- quick check on sdk.dir -->
<fail <fail
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through an env var" message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through an env var"
@ -161,7 +158,6 @@
<src path="${source.absolute.dir}" /> <src path="${source.absolute.dir}" />
<!-- osmchange --> <!-- osmchange -->
<compilerarg value="-Xlint"/>
<src path="${use.absolute.dir}" /> <src path="${use.absolute.dir}" />
<exclude name="**/LogUtil.java" /> <exclude name="**/LogUtil.java" />
<exclude name="**/OsmStorageWriter.java" /> <exclude name="**/OsmStorageWriter.java" />

View file

@ -5,9 +5,6 @@
<property file="ant.properties" /> <property file="ant.properties" />
<loadproperties srcFile="project.properties" /> <loadproperties srcFile="project.properties" />
<!-- specify java.compilerArgs if they were not specified -->
<property name="java.compilerargs" value=""/>
<!-- quick check on sdk.dir --> <!-- quick check on sdk.dir -->
<fail <fail
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through an env var" message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through an env var"
@ -19,6 +16,69 @@
<property name="raw.absolute.dir" location="raw" /> <property name="raw.absolute.dir" location="raw" />
<property name="base.dir" location="." /> <property name="base.dir" location="." />
<!-- Altered generic setup -->
<!-- Workaround issue that Android SDK17 has a bug that by default and unchangable looks for jars inside libs folder -->
<target name="-setup">
<if>
<condition>
<not><isset property="setup.done" /></not>
</condition>
<then>
<echo>Creating output directories if needed...</echo>
<mkdir dir="${resource.absolute.dir}" />
<mkdir dir="${jar.libs.absolute.dir}" />
<mkdir dir="${out.absolute.dir}" />
<mkdir dir="${out.res.absolute.dir}" />
<property name="setup.done" value="true" />
<echo>Gathering info for ${ant.project.name}...</echo>
<!-- load project properties, resolve Android target, library dependencies
and set some properties with the results.
All property names are passed as parameters ending in -Out -->
<setup
projectTypeOut="android.project.type"
androidJarFileOut="android.jar"
androidAidlFileOut="android.aidl"
renderScriptExeOut="renderscript"
renderScriptIncludeDirOut="android.rs"
bootclasspathrefOut="android.target.classpath"
projectLibrariesRootOut="project.libraries"
projectLibrariesJarsOut="original.project.libraries.jars"
projectLibrariesResOut="project.libraries.res"
projectLibrariesPackageOut="project.libraries.package"
projectLibrariesLibsOut="project.libraries.libs"
targetApiOut="target.api"
verbose="${verbose}"
/>
<!-- osmchange -->
<path id="project.libraries.jars">
<path refid="original.project.libraries.jars"/>
<fileset dir="${jar.libs.absolute.dir}">
<include name="*.jar"/>
</fileset>
</path>
<!-- osmchange -->
<!-- sets a few boolean based on android.project.type
to make the if task easier -->
<condition property="project.is.library" else="false">
<equals arg1="${android.project.type}" arg2="library" />
</condition>
<condition property="project.is.test" else="false">
<equals arg1="${android.project.type}" arg2="test" />
</condition>
<!-- If a test project, resolve absolute path to tested project. -->
<if condition="${project.is.test}">
<then>
<property name="tested.project.absolute.dir" location="${tested.project.dir}" />
</then>
</if>
</then>
</if>
</target>
<!-- Puts the project's resources into the output package file <!-- Puts the project's resources into the output package file
This actually can create multiple resource package in case This actually can create multiple resource package in case
Some custom apk with specific configuration have been Some custom apk with specific configuration have been
@ -147,8 +207,12 @@
classpathref="project.libraries.jars" classpathref="project.libraries.jars"
fork="${need.javac.fork}"> fork="${need.javac.fork}">
<src path="${source.absolute.dir}" /> <src path="${source.absolute.dir}" />
<src path="${gen.absolute.dir}" />
<classpath>
<fileset dir="${extensible.libs.classpath}" includes="*.jar" />
</classpath>
<compilerarg line="${java.compilerargs}" />
<!-- osmchange --> <!-- osmchange -->
<compilerarg value="-Xlint"/>
<src path="${use.absolute.dir}" /> <src path="${use.absolute.dir}" />
<exclude name="**/LogUtil.java" /> <exclude name="**/LogUtil.java" />
<exclude name="**/OsmStorageWriter.java" /> <exclude name="**/OsmStorageWriter.java" />
@ -158,12 +222,8 @@
<exclude name="**/net/osmand/swing/" /> <exclude name="**/net/osmand/swing/" />
<exclude name="**/rtree/" /> <exclude name="**/rtree/" />
<!-- osmchange --> <!-- osmchange -->
<src path="${gen.absolute.dir}" />
<classpath>
<fileset dir="${extensible.libs.classpath}" includes="*.jar" />
</classpath>
<compilerarg line="${java.compilerargs}" />
</javac> </javac>
<!-- if the project is a library then we generate a jar file --> <!-- if the project is a library then we generate a jar file -->
<if condition="${project.is.library}"> <if condition="${project.is.library}">
<then> <then>