I have a project with a linked source folder. This project depends on another (remote service) project, so the aidl files and the classes passed across the remote interface are in a common_src linked folder shared between the two projects. This work just fine with Eclipse builds, (one source file, two projects, changes in one project are reflected in the other, just as it should be).
I’d now like to do an Ant build from the command line. I managed to get another project with a single src directory building across all targets using the example build.xml from the SDK tools. It imports ant_rules_r3.xml automatically and once the source.dir and out.dir are defined in the build.properties it’s all fairly painless.
Turning to the project with the src and common_src folders, I can’t get it to build. Firstly I cut and pasted the compile target and all those it depends upon into the build.xml above the setup task. I added and defined the element common_src to the build.properties and added the last line shown below to the -compile target (copied from ant_rules_r3.xml) into the build xml:
<src path="${source.absolute.dir}" />
<src path="${gen.absolute.dir}" />
<src path="${common_src}" /><!--ADDED-->
which got it further on in the build process – it could find the .java files in common_src but not the .aidl files. No surprise I realised as the aidl is a separate target. I then added
<src path="${common_src}" />
to the -aidl target in the build xml, and it failed with:
BUILD FAILED
C:\dev\projects\Eclipse\AndroidWorkspace\MapProject\build.xml:77: aidl doesn't
support the nested "src" element.
So that’s got me well and truly stuck. Ideally I’d like to modify just the build.properties file to include the common_src and pass it to the ant_rules_r3.xml but I can’t think of a way of doing it. I’d be most grateful if anyone can suggest how it can be done.
Just in case there’s any interest, I thought I’d answer my own question which is now solved.
1) I defined the common_src in the build.properties
2) Added the line
in an overriden compile target in the build.xml above the setup (plus overrode all the targets it depended on by cutting/pasting from the ant_rules_r3.xml)
3) Added a new target ‘aidl2’ the same as ‘aidl’ in build.xml but which had the line
<source path="${common_src}"instead ofMade aidl depend on aidl2. Overrode all the targets aidl depended on.
I also added lines like :
to the build.xml which automated the input of passwords. I finally added an install_release target to make an automatic one command build, rease and install process.