Apparently, I can specify source folders using the source.dir property in build.properties - but what if I want to specify multiple source folders ?
The comments below are from the build.xml file generated by the Android SDK tools:
<!-- The build.properties file can be created by you and is never touched
by the 'android' tool. This is the place to change some of the default property values
used by the Ant rules.
Here are some properties you may want to change/update:
application.package
the name of your application package as defined in the manifest. Used by the
'uninstall' rule.
source.dir
the name of the sourc开发者_运维百科e directory. Default is 'src'.
out.dir
the name of the output directory. Default is 'bin'.
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 in in Version Control Systems.
-->
Note: I dont care about building in Eclipse - Im setting up automated builds using ant.
Did you try using colons to separate paths? My build.properties looks like this:
source.dir=src:src2:src3:src4:src5
In the (heavily customized) build.xml I have here, that solves a bunch of other issues, I ended up having to just pull the compile target into my XML and specifying more than one source path there. You can do the same, just put the new target above the definition of the setup task in your build.xml. Note that there are multiple files floating around in the Android SDK that all look like the one you should be using to customize, and a couple of them appear to be wrong or at least don't work properly with the latest tools (the one in tools/ant/main_rules.xml doesn't seem to be working in my Windows SDK). I believe the one you want is in platforms/[platform-numer]/ant/ant_rules_r2.xml in the latest SDK. At any rate, the task looks like the task below, and you can just add another source directory to it pretty easily. I haven't tried separating with colons, like the other answer here, because as I said, our build.xml had to be customized in a number of ways. But I do know this will work.
<!-- Compiles this project's .java files into .class files. -->
<target name="compile" depends="-resource-src, -aidl"
description="Compiles project's .java files into .class files">
<!-- 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}/libs" else="./libs">
<isset property="tested.project.absolute.dir" />
</condition>
<javac encoding="ascii" target="1.5" debug="true" extdirs=""
destdir="${out.classes.absolute.dir}"
bootclasspathref="android.target.classpath"
verbose="${verbose}" classpath="${extensible.classpath}"
classpathref="android.libraries.jars">
<src path="${source.absolute.dir}" />
<src path="${gen.absolute.dir}" />
<src refid="android.libraries.src" />
<classpath>
<fileset dir="${external.libs.absolute.dir}" includes="*.jar" />
<fileset dir="${extensible.libs.classpath}" includes="*.jar" />
</classpath>
</javac>
</target>
精彩评论