Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
555 lines (460 sloc) 23.6 KB
<?xml version="1.0" encoding="UTF-8"?>
<project name="AndCustomTitle" default="">
<!-- The local.properties file is created and updated by the 'android'
tool.
It contains the path to the SDK. It should *NOT* be checked into
Version Control Systems. -->
<property file="local.properties" />
<!-- 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:
source.dir
The name of the source 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 into Version Control Systems.
-->
<property file="build.properties" />
<!-- The default.properties file is created and updated by the 'android'
tool, as well as ADT.
This file is an integral part of the build system for your
application and should be checked into Version Control Systems. -->
<property file="default.properties" />
<!-- Custom Android task to deal with the project target, and import the
proper rules.
This requires ant 1.6.0 or above. -->
<path id="android.antlibs">
<pathelement path="${sdk.dir}/tools/lib/anttasks.jar" />
<pathelement path="${sdk.dir}/tools/lib/sdklib.jar" />
<pathelement path="${sdk.dir}/tools/lib/androidprefs.jar" />
</path>
<taskdef name="setup"
classname="com.android.ant.SetupTask"
classpathref="android.antlibs" />
<!-- extension targets. Uncomment the ones where you want to do custom work
in between standard targets -->
<!--
<target name="-pre-build">
</target>
<target name="-pre-compile">
</target>
[This is typically used for code obfuscation.
Compiled code location: ${out.classes.absolute.dir}
If this is not done in place, override ${out.dex.input.absolute.dir}]
<target name="-post-compile">
</target>
-->
<!-- Execute the Android Setup task that will setup some properties
specific to the target, and import the build rules files.
The rules file is imported from
<SDK>/platforms/<target_platform>/ant/ant_rules_r#.xml
To customize existing targets, there are two options:
- Customize only one target:
- copy/paste the target into this file, *before* the
<setup> task.
- customize it to your needs.
- Customize the whole script.
- copy/paste the content of the rules files (minus the top node)
into this file, *after* the <setup> task
- disable the import of the rules by changing the setup task
below to <setup import="false" />.
- customize to your needs.
-->
<setup import="false" />
<!--
This rules file is meant to be imported by the custom Ant task:
com.android.ant.SetupTask
The following properties are put in place by the importing task:
android.jar, android.aidl, aapt, aidl, and dx
Additionnaly, the task sets up the following classpath reference:
android.target.classpath
This is used by the compiler task as the boot classpath.
-->
<!-- Custom tasks -->
<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
by invoking "ant -Dadb.device.arg=-d" for device "ant -Dadb.device.arg=-e" for
the emulator. -->
<property name="adb.device.arg" value="" />
<property name="android.tools.dir" location="${sdk.dir}/tools" />
<!-- 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" />
<property name="source.absolute.dir" location="${source.dir}" />
<property name="gen.dir" value="gen" />
<property name="gen.absolute.dir" location="${gen.dir}" />
<property name="resource.dir" value="res" />
<property name="resource.absolute.dir" location="${resource.dir}" />
<property name="asset.dir" value="assets" />
<property name="asset.absolute.dir" location="${asset.dir}" />
<!-- Directory for the third party java libraries -->
<property name="external.libs.dir" value="libs" />
<property name="external.libs.absolute.dir" location="${external.libs.dir}" />
<!-- Directory for the native libraries -->
<property name="native.libs.dir" value="libs" />
<property name="native.libs.absolute.dir" location="${native.libs.dir}" />
<!-- Output directories -->
<property name="out.dir" value="bin" />
<property name="out.absolute.dir" location="${out.dir}" />
<property name="out.classes.dir" value="${out.absolute.dir}/classes" />
<property name="out.classes.absolute.dir" location="${out.classes.dir}" />
<!-- Verbosity -->
<property name="verbose" value="false" />
<!-- This is needed by emma as it uses multilevel verbosity instead of simple 'true' or 'false'
The property 'verbosity' is not user configurable and depends exclusively on 'verbose'
value.-->
<condition property="verbosity" value="verbose" else="quiet">
<istrue value="${verbose}" />
</condition>
<!-- Tools -->
<condition property="exe" value=".exe" else=""><os family="windows" /></condition>
<!-- Emma configuration -->
<property name="emma.dir" value="${sdk.dir}/tools/lib" />
<path id="emma.lib">
<pathelement location="${emma.dir}/emma.jar" />
<pathelement location="${emma.dir}/emma_ant.jar" />
</path>
<taskdef resource="emma_ant.properties" classpathref="emma.lib" />
<!-- End of emma configuration -->
<!-- Rules -->
<!-- Creates the output directories if they don't exist yet. -->
<target name="-dirs">
<echo>Creating output directories if needed...</echo>
<mkdir dir="${resource.absolute.dir}" />
<mkdir dir="${external.libs.absolute.dir}" />
<mkdir dir="${gen.absolute.dir}" />
<mkdir dir="${out.absolute.dir}" />
<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" depends="-mydirs, -jsjavadoc"/>
<!-- Generates the R.java file for this project's resources. -->
<target name="-resource-src" depends="-dirs, -pre-build">
<echo>Generating R.java / Manifest.java from the resources...</echo>
<aapt executable="${aapt}"
command="package"
verbose="${verbose}"
manifest="AndroidManifest.xml"
androidjar="${android.jar}"
rfolder="${gen.absolute.dir}">
<res path="${resource.absolute.dir}" />
</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" depends="-checkstyle,-pmd"/>
<!-- Compiles this project's .java files into .class files. -->
<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 -->
<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>
<target name="clean" description="Removes output files created by other targets.">
<delete dir="${out.absolute.dir}" verbose="${verbose}" />
<delete dir="${gen.absolute.dir}" verbose="${verbose}" />
</target>
<target name="help">
<!-- displays starts at col 13
|13 80| -->
<echo>Android Ant Build. Available targets:</echo>
<echo> help: Displays this help.</echo>
<echo> clean: Removes output files created by other targets.</echo>
<echo> compile: Compiles project's .java files into .class files.</echo>
</target>
<!-- Properties -->
<property name="reports.dir" value="${basedir}/reports"/>
<property name="javadoc.dir" value="${basedir}/javadocs"/>
<property name="antlibs.dir" value="${basedir}/antlibs"/>
<property name="doclets.dir" value="${basedir}/doclets"/>
<!-- Paths -->
<path id="antlibs.classpath">
<fileset dir="${antlibs.dir}">
<include name="**/*.jar"/>
</fileset>
</path>
<property name="apiviz.location" value="doclets/apiviz-1.3.1.GA.jar"/>
<!-- Taskdefs -->
<taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask"
classpathref="antlibs.classpath"/>
<taskdef name="cpd" classname="net.sourceforge.pmd.cpd.CPDTask"
classpathref="antlibs.classpath"/>
<taskdef resource="checkstyletask.properties"
classpathref="antlibs.classpath"/>
<taskdef name="classycleReport" classname="classycle.ant.ReportTask"
classpathref="antlibs.classpath"/>
<!-- For the xslt style task in reports need certain properties defined
to pass as parameters -->
<property name="project" value="${project.name}"/>
<property name="rulesets" value="androidrules"/>
<property name="today" value="${DSTAMP}"/>
<!-- In Android for Javadocs to be generated right we
have to include the gen folder to pick up
the R.java for the imports of the R class.-->
<path id="javadoc.source">
<pathelement path="${source.absolute.dir}"/>
<pathelement path="${gen.absolute.dir}"/>
</path>
<!-- When I add javadoc I am assuming that IDE has put
its incremental build result at bin/
ie..
additionalparam -sourceclasspath ${out.classes.dir}
changed to -sourceclasspath ${out.dir}
in javadoc target
If runing from non_IDE than you needf to change
it back.
does not pick up android.target.classpath so..
a modification
-->
<!-- Properties -->
<property name="reports.dir" value="${basedir}/reports"/>
<property name="javadoc.dir" value="${basedir}/javadocs"/>
<property name="antlibs.dir" value="${basedir}/antlibs"/>
<property name="doclets.dir" value="${basedir}/doclets"/>
<!-- Paths -->
<path id="antlibs.classpath">
<fileset dir="${antlibs.dir}">
<include name="**/*.jar"/>
</fileset>
</path>
<!-- Path needs to include both Android jars and
3rd party library jars in libs-->
<path id="android.project.libs">
<fileset dir="${native.libs.dir}">
<include name="**/*.jar"/>
</fileset>
<path refid="android.target.classpath"/>
</path>
<property name="apiviz.location" value="doclets/apiviz-1.3.1.GA.jar"/>
<!-- For the xslt style task in reports need certain properties defined
to pass as parameters -->
<property name="project" value="${ant.project.name}"/>
<property name="rulesets" value="androidrules"/>
<property name="today" value="${DSTAMP}"/>
<path id="javadoc.source">
<pathelement path="${source.absolute.dir}"/>
</path>
<!-- ===============================
target: -mydirs
=============================== -->
<target name="-mydirs">
<mkdir dir="${reports.dir}/images"/>
<mkdir dir="${javadoc.dir}"/>
<mkdir dir="${javadoc.dir}/resources"/>
<mkdir dir="js_javadocs"/>
<mkdir dir="assets/js"/>
<!-- move companylogo.png to javadoc/resources-->
<copy file="buildconfig/images/companylogo.png"
todir="${javadoc.dir}/resources"/>
<copy file="buildconfig/images/abstract.png"
todir="${reports.dir}/images"/>
<copy file="buildconfig/images/class.png"
todir="${reports.dir}/images"/>
<copy file="buildconfig/images/companylogo.png"
todir="${reports.dir}/images"/>
<copy file="buildconfig/images/inner.png"
todir="${reports.dir}/images"/>
<copy file="buildconfig/images/innerabstract.png"
todir="${reports.dir}/images"/>
<copy file="buildconfig/images/innerclass.png"
todir="${reports.dir}/images"/>
<copy file="buildconfig/images/innerCycleLink.png"
todir="${reports.dir}/images"/>
<copy file="buildconfig/images/innerinterface.png"
todir="${reports.dir}/images"/>
<copy file="buildconfig/images/interface.png"
todir="${reports.dir}/images"/>
<copy file="buildconfig/images/link.png"
todir="${reports.dir}/images"/>
<copy file="buildconfig/images/logo.png"
todir="${reports.dir}/images"/>
<copy file="buildconfig/images/mix.png"
todir="${reports.dir}/images"/>
<copy file="buildconfig/images/mixedCycleLink.png"
todir="${reports.dir}/images"/>
<copy file="buildconfig/images/package.png"
todir="${reports.dir}/images"/>
<copy file="buildconfig/andcooper.reports.css"
todir="${reports.dir}"/>
<copy file="buildconfig/images/checkstylelogo.png"
todir="${reports.dir}/images"/>
<copy file="buildconfig/images/pmd_logo_small.jpg"
todir="${reports.dir}/images"/>
</target>
<!-- ================================
target: javadoc
additionalparam -sourceclasspath ${out.classes.dir}
changed to -sourceclasspath ${out.dir}
if runing from non-IDE change back
================================ -->
<target name="-javadoc">
<javadoc
sourcepathref="javadoc.source"
destdir="${javadoc.dir}"
bootclasspathref="android.project.libs"
private="true"
windowtitle="${ant.project.name}}"
additionalparam="-author -version -sourceclasspath ${out.classes.dir}">
<!-- Use a nice documentation title -->
<doctitle>
${ant.project.name}&lt;/br>
API Specification
</doctitle>
<!-- Create a header that contains the taglets logo -->
<!-- Note the use of the {@docRoot} tag to link to the logo -->
<header>
&lt;img
src=&quot;{@docRoot}/resources/companylogo.png&quot;
width=&quot;88&quot; height=&quot;40&quot; border=&quot;0&quot;
&gt;
</header>
<!-- Same for the footer -->
<footer>
&lt;img
src=&quot;{@docRoot}/resources/companylogo.png&quot;
width=&quot;88&quot; height=&quot;40&quot;
&gt;
</footer>
<!-- Include a timestamp at the bottom of the docu generated -->
<!-- Note the use of ${timestamp} which was created by the -->
<!-- <tstamp> task at the start of this target -->
<bottom>
&lt;p align=&quot;right&quot;&gt;
&lt;font class=&quot;NavBarFont1&quot; size=&quot;-1&quot;&gt;
Android SDK API Target ${target}&lt;br&gt;
${ant.project.name}&lt;br&gt;
API Spec&lt;br&gt;
${TSTAMP} ${DSTAMP}
&lt;/font&gt;
&lt;/p&gt;
</bottom>
<doclet name="org.jboss.apiviz.APIviz" path="${apiviz.location}">
</doclet>
</javadoc>
</target>
<target name="-pmd" >
<pmd >
<auxclasspath>
<path refid="android.target.classpath"/>
<pathelement location="${out.classes.absolute.dir}" />
<fileset dir="libs">
<include name="*.jar" />
</fileset>
</auxclasspath>
<formatter type="xml" toFile="reports/pmd.xml"/>
<ruleset>rulesets/android.xml</ruleset>
<fileset dir="${source.dir}" includes="**/*.java" />
</pmd>
<xslt basedir="reports" destdir="reports"
style="buildconfig/xsls/andcooper.pmd.xsl">
<param name="project" expression="${ant.project.name}"/>
<param name="today" expression="${today}"/>
<param name="rulesets" expression="androidrules"/>
<mapper type="glob" from="pmd.xml" to="pmd.html"/>
</xslt>
<echo>pmd report generated and transformed to html</echo>
</target>
<!-- ================================
target: checkstyle
================================ -->
<target name="-checkstyle" depends="">
<checkstyle config="${basedir}/eclipse_sun_checkstyle.xml"
failureProperty="checkstyle.failure"
failOnViolation="false">
<formatter type="xml"
tofile="reports/checkstyle.xml"/>
<fileset dir="${source.absolute.dir}" includes="**/*.java"/>
<classpath refid="antlibs.classpath"/>
</checkstyle>
<xslt basedir="reports" destdir="reports"
style="buildconfig/xsls/andcooper.checkstyle.xsl">
<param name="today" expression="${today}"/>
<mapper type="glob" from="checkstyle.xml" to="checkstyle.html"/>
</xslt>
<echo>Checkstyle report generated and transformed to html</echo>
</target>
<target name="-classycle" depends="">
<classycleReport
reportfile="reports/classycle.xml"
title="${ant.project.name}"
>
<fileset dir="${out.classes.absolute.dir}">
<include name="**/*.class"/>
</fileset>
</classycleReport>
<!-- xslt task for classycle requires no parameters to be paased -->
<xslt basedir="reports" destdir="reports"
style="buildconfig/xsls/andcooper.classycle.xsl">
<param name="date" expression="${today}"/>
<param name="title" expression="${ant.project.name}"/>
<mapper type="glob" from="classycle.xml" to="classycle.html"/>
</xslt>
</target>
<target name="compile.and.doc" depends="compile,-javadoc, -classycle">
</target>
<!-- =================================
target: -jsjavdoc
================================= -->
<target name="-jsjavadoc" >
<ant antfile="${jGrouseHome.default}/build.xml"/>
</target>
</project>