aboutsummaryrefslogtreecommitdiffstats
path: root/files/ant
diff options
context:
space:
mode:
authorXavier Ducrohet <xav@android.com>2010-06-25 15:11:17 -0700
committerXavier Ducrohet <xav@android.com>2010-06-28 12:18:41 -0700
commit5aea83e90d706a4f14082be562d9d310f171e8c2 (patch)
tree35ab2d7d57de63b0903f5549d27b26a54df772bb /files/ant
parent44673277a64b2360218d0cb4f1fdaeaebdde7f62 (diff)
downloadsdk-5aea83e90d706a4f14082be562d9d310f171e8c2.zip
sdk-5aea83e90d706a4f14082be562d9d310f171e8c2.tar.gz
sdk-5aea83e90d706a4f14082be562d9d310f171e8c2.tar.bz2
Support for aidl files in library project in the Ant build system.
Change-Id: I3e36e6f4db60d3d979b24c2b88d496f453394127
Diffstat (limited to 'files/ant')
-rw-r--r--files/ant/ant_lib_rules_r3.xml45
-rw-r--r--files/ant/ant_rules_r3.xml27
2 files changed, 54 insertions, 18 deletions
diff --git a/files/ant/ant_lib_rules_r3.xml b/files/ant/ant_lib_rules_r3.xml
index c207308..f4816fc 100644
--- a/files/ant/ant_lib_rules_r3.xml
+++ b/files/ant/ant_lib_rules_r3.xml
@@ -14,14 +14,22 @@
-->
<!-- Custom tasks -->
- <taskdef name="aaptexec"
+ <taskdef name="aapt"
classname="com.android.ant.AaptExecLoopTask"
classpathref="android.antlibs" />
+ <taskdef name="aidl"
+ classname="com.android.ant.AidlExecTask"
+ classpathref="android.antlibs" />
+
<taskdef name="xpath"
classname="com.android.ant.XPathTask"
classpathref="android.antlibs" />
+ <taskdef name="if"
+ classname="com.android.ant.IfElseTask"
+ classpathref="android.antlibs" />
+
<!-- Properties -->
<!-- Tells adb which device to target. You can change this from the command line
@@ -33,6 +41,8 @@
<!-- Name of the application package extracted from manifest file -->
<xpath input="AndroidManifest.xml" expression="/manifest/@package"
output="manifest.package" />
+ <xpath input="AndroidManifest.xml" expression="/manifest/application/@android:hasCode"
+ output="manifest.hasCode" default="true"/>
<!-- Input directories -->
<property name="source.dir" value="src" />
@@ -91,21 +101,46 @@
<mkdir dir="${out.classes.absolute.dir}" />
</target>
+ <!-- empty default pre-build target. Create a similar target in
+ your build.xml and it'll be called instead of this one. -->
+ <target name="-pre-build"/>
+
<!-- Generates the R.java file for this project's resources. -->
- <target name="-resource-src" depends="-dirs">
+ <target name="-resource-src" depends="-dirs, -pre-build">
<echo>Generating R.java / Manifest.java from the resources...</echo>
- <aaptexec executable="${aapt}"
+ <aapt executable="${aapt}"
command="package"
verbose="${verbose}"
manifest="AndroidManifest.xml"
androidjar="${android.jar}"
rfolder="${gen.absolute.dir}">
<res path="${resource.absolute.dir}" />
- </aaptexec>
+ </aapt>
+ </target>
+
+ <!-- Generates java classes from .aidl files. -->
+ <target name="-aidl" depends="-dirs">
+ <if condition="${manifest.hasCode}">
+ <then>
+ <echo>Compiling aidl files into Java classes...</echo>
+ <aidl executable="${aidl}" framework="${android.aidl}"
+ genFolder="${gen.absolute.dir}">
+ <source path="${source.absolute.dir}"/>
+ <source refid="android.libraries.src"/>
+ </aidl>
+ </then>
+ <else>
+ <echo>hasCode = false. Skipping...</echo>
+ </else>
+ </if>
</target>
+ <!-- empty default pre-compile target. Create a similar target in
+ your build.xml and it'll be called instead of this one. -->
+ <target name="-pre-compile"/>
+
<!-- Compiles this project's .java files into .class files. -->
- <target name="compile" depends="-resource-src"
+ <target name="compile" depends="-resource-src, -aidl, -pre-compile"
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 -->
diff --git a/files/ant/ant_rules_r3.xml b/files/ant/ant_rules_r3.xml
index 2277136..8876c7d 100644
--- a/files/ant/ant_rules_r3.xml
+++ b/files/ant/ant_rules_r3.xml
@@ -14,10 +14,14 @@
-->
<!-- Custom tasks -->
- <taskdef name="aaptexec"
+ <taskdef name="aapt"
classname="com.android.ant.AaptExecLoopTask"
classpathref="android.antlibs" />
+ <taskdef name="aidl"
+ classname="com.android.ant.AidlExecTask"
+ classpathref="android.antlibs" />
+
<taskdef name="apkbuilder"
classname="com.android.ant.ApkBuilderTask"
classpathref="android.antlibs" />
@@ -270,14 +274,14 @@
<if condition="${manifest.hasCode}">
<then>
<echo>Generating R.java / Manifest.java from the resources...</echo>
- <aaptexec executable="${aapt}"
+ <aapt executable="${aapt}"
command="package"
verbose="${verbose}"
manifest="AndroidManifest.xml"
androidjar="${android.jar}"
rfolder="${gen.absolute.dir}">
<res path="${resource.absolute.dir}" />
- </aaptexec>
+ </aapt>
</then>
<else>
<echo>hasCode = false. Skipping...</echo>
@@ -290,14 +294,11 @@
<if condition="${manifest.hasCode}">
<then>
<echo>Compiling aidl files into Java classes...</echo>
- <apply executable="${aidl}" failonerror="true">
- <arg value="-p${android.aidl}" />
- <arg value="-I${source.absolute.dir}" />
- <arg value="-o${gen.absolute.dir}" />
- <fileset dir="${source.absolute.dir}">
- <include name="**/*.aidl" />
- </fileset>
- </apply>
+ <aidl executable="${aidl}" framework="${android.aidl}"
+ genFolder="${gen.absolute.dir}">
+ <source path="${source.absolute.dir}"/>
+ <source refid="android.libraries.src"/>
+ </aidl>
</then>
<else>
<echo>hasCode = false. Skipping...</echo>
@@ -371,7 +372,7 @@
-->
<target name="-package-resources">
<echo>Packaging resources</echo>
- <aaptexec executable="${aapt}"
+ <aapt executable="${aapt}"
command="package"
versioncode="${version.code}"
manifest="AndroidManifest.xml"
@@ -383,7 +384,7 @@
<res path="${resource.absolute.dir}" />
<!-- <nocompress /> forces no compression on any files in assets or res/raw -->
<!-- <nocompress extension="xml" /> forces no compression on specific file extensions in assets and res/raw -->
- </aaptexec>
+ </aapt>
</target>
<!-- Packages the application and sign it with a debug key. -->