Re-write test build.xml for new ant script system.

pull/14/head
Tim Su 13 years ago
parent 282c619cfb
commit 2f595291df

11
.gitignore vendored

@ -1,17 +1,18 @@
*~ *~
.DS_Store
.metadata .metadata
*.class *.class
org.eclipse.ltk.core.refactoring.prefs org.eclipse.ltk.core.refactoring.prefs
gen gen
local.properties local.properties
antbuild /release
astrid/src-combined /dev
release
dev
lp-translations/ lp-translations/
translations/strings.xml translations/strings.xml
.DS_Store
astrid/coverage.em
astrid/src-combined
antbuild
greendroid/GDCatalog/.project greendroid/GDCatalog/.project
api/bin api/bin

@ -0,0 +1,22 @@
# This file is used to override default values used by the Ant build system.
#
# This file must be checked in Version Control Systems, as it is
# integral to the build system of your project.
# This file is only used by the Ant script.
# You can use this to override default values such as
# 'source.dir' for the location of your java source folder and
# 'out.dir' for the location of your output folder.
# You can also use it define how the release builds are signed by declaring
# the following properties:
# 'key.store' for the location of your keystore and
# 'key.alias' for the name of the key to use.
# The password will be asked during the build when you use the 'release' target.
test.runner=com.zutubi.android.junitreport.JUnitReportTestRunner
tested.project.dir=../astrid
reports.dir=reports
build.sysclasspath=last
out.dir=bin

@ -1,15 +0,0 @@
# astrid-tests build properties
tested.project.dir=../astrid
# output files and apk
out.dir=bin
# test runner: junit report test runner
test.runner=com.zutubi.android.junitreport.JUnitReportTestRunner
# reports output directory
reports.dir=reports
# suppress ant warnings
build.sysclasspath=last

@ -1,97 +1,88 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project name="astrid-tests" default="help"> <project name="astridTest" default="help">
<!-- The local.properties file is created and updated by the 'android' tool. <!-- The local.properties file is created and updated by the 'android' tool.
It contains the path to the SDK. It should *NOT* be checked in in Version It contains the path to the SDK. It should *NOT* be checked into
Control Systems. --> Version Control Systems. -->
<property file="local.properties" /> <property file="local.properties" />
<!-- The build.properties file can be created by you and is never touched <!-- The ant.properties file can be created by you. It is only edited by the
by the 'android' tool. This is the place to change some of the default property values 'android' tool to add properties to it.
used by the Ant rules. This is the place to change some Ant specific build properties.
Here are some properties you may want to change/update: 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 source.dir
the name of the source directory. Default is 'src'. The name of the source directory. Default is 'src'.
out.dir out.dir
the name of the output directory. Default is 'bin'. The name of the output directory. Default is 'bin'.
Properties related to the SDK location or the project target should be updated For other overridable properties, look at the beginning of the rules
using the 'android' tool with the 'update' action. files in the SDK, at tools/ant/build.xml
This file is an integral part of the build system for your application and Properties related to the SDK location or the project target should
should be checked in in Version Control Systems. be updated using the 'android' tool with the 'update' action.
--> This file is an integral part of the build system for your
<property file="build.properties" /> application and should be checked into Version Control Systems.
<!-- 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 in in Version Control Systems. -->
<property file="default.properties" />
<!-- Required pre-setup import -->
<import file="${sdk.dir}/tools/ant/pre_setup.xml" />
<taskdef resource="net/sf/antcontrib/antlib.xml">
<classpath>
<pathelement location="antlib/ant-contrib-1.0b3.jar"/>
</classpath>
</taskdef>
<taskdef name="setup"
classname="com.android.ant.SetupTask"
classpathref="android.antlibs" />
<!-- 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>/templates/android_rules.xml <property file="ant.properties" />
To customize some build steps for your project: <!-- The project.properties file is created and updated by the 'android'
- copy the content of the main node <project> from android_rules.xml tool, as well as ADT.
- paste it in this build.xml below the <setup /> task.
- disable the import by changing the setup task below to <setup import="false" /> This contains project specific properties such as project target, and library
dependencies. Lower level build properties are stored in ant.properties
This will ensure that the properties are setup correctly but that your customized (or in .classpath for Eclipse projects).
build steps are used.
--> This file is an integral part of the build system for your
<setup /> application and should be checked into Version Control Systems. -->
<loadproperties srcFile="project.properties" />
<target name="help">
<echo>Astrid Unit Test Build. Available targets:</echo> <!-- quick check on sdk.dir -->
<echo> help: Displays this help.</echo> <fail
<echo> run-tests: Run unit tests.</echo> message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through an env var"
<echo> coverage: Run tests and dump emma coverage reports.</echo> unless="sdk.dir"
/>
<!-- build and install an instrumented build -->
<target name="install-instrumented">
<subant target="clean instrument install">
<fileset file="../astrid/build.xml" />
</subant>
</target> </target>
<!-- override coverage target with custom reporting and rules --> <!-- override coverage target with custom reporting and rules -->
<target name="coverage" depends="-set-coverage-classpath, -install-instrumented, install" <target name="coverage" depends="-test-project-check, install-instrumented"
description="Runs the tests against the instrumented code and generates description="Runs the tests against the instrumented code and generates
code coverage report"> code coverage report">
<property name="tested.project.absolute.dir" location="${tested.project.dir}" />
<property name="test.runner" value="com.zutubi.android.junitreport.JUnitReportTestRunner" />
<!-- Application package of the tested project extracted from its manifest file -->
<xpath input="${tested.project.absolute.dir}/AndroidManifest.xml"
expression="/manifest/@package" output="tested.manifest.package" />
<xpath input="AndroidManifest.xml"
expression="/manifest/@package" output="manifest.package" />
<property name="emma.dump.file"
value="/data/data/${tested.manifest.package}/coverage.ec" />
<run-tests-helper emma.enabled="true"> <run-tests-helper emma.enabled="true">
<extra-instrument-args> <extra-instrument-args>
<arg value="-e" /> <arg value="-e" />
<arg value="coverageFile" /> <arg value="coverageFile" />
<arg value="${emma.dump.file}" /> <arg value="${emma.dump.file}" />
<arg value="class" /> </extra-instrument-args>
<arg value="com.todoroo.astrid.ContinuousTests" />
</extra-instrument-args>
</run-tests-helper> </run-tests-helper>
<echo>Downloading coverage file into project directory...</echo> <echo>Downloading coverage file into project directory...</echo>
<exec executable="${adb}" failonerror="true"> <exec executable="${adb}" failonerror="true">
<arg line="${adb.device.arg}" /> <arg line="${adb.device.arg}" />
<arg value="pull" /> <arg value="pull" />
<arg value="${emma.dump.file}" /> <arg value="${emma.dump.file}" />
<arg value="coverage.ec" /> <arg value="coverage.ec" />
</exec> </exec>
<echo>Extracting coverage report...</echo> <echo>Extracting coverage report...</echo>
<copy todir="${tested.project.absolute.dir}/src-combined"> <copy todir="${tested.project.absolute.dir}/src-combined">
<fileset dir="../api/src" includes="**/*.java" /> <fileset dir="../api/src" includes="**/*.java" />
@ -104,12 +95,11 @@
<include name="coverage.ec" /> <include name="coverage.ec" />
<include name="coverage.em" /> <include name="coverage.em" />
</infileset> </infileset>
<html outfile="coverage.html" encoding="UTF-8" />
<xml outfile="${reports.dir}/coverage.xml" /> <xml outfile="${reports.dir}/coverage.xml" />
<html outfile="coverage.html" />
</report> </report>
</emma> </emma>
<echo>Cleaning up temporary files...</echo> <echo>Cleaning up temporary files...</echo>
<delete dir="${instrumentation.absolute.dir}" />
<delete file="coverage.ec" /> <delete file="coverage.ec" />
<delete file="coverage.em" /> <delete file="coverage.em" />
<echo>Saving the report file in ${basedir}/coverage/coverage.html</echo> <echo>Saving the report file in ${basedir}/coverage/coverage.html</echo>
@ -126,4 +116,25 @@
</exec> </exec>
</target> </target>
<!-- Import the actual build file.
To customize existing targets, there are two options:
- Customize only one target:
- copy/paste the target into this file, *before* the
<import> task.
- customize it to your needs.
- Customize the whole content of build.xml
- copy/paste the content of the rules files (minus the top node)
into this file, replacing the <import> task.
- customize to your needs.
***********************
****** IMPORTANT ******
***********************
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
in order to avoid having your file be overridden by tools such as "android update project"
-->
<!-- version-tag: custom -->
<import file="${sdk.dir}/tools/ant/build.xml" />
</project> </project>

@ -18,14 +18,18 @@
native <methods>; native <methods>;
} }
-keepclasseswithmembernames class * { -keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet); public <init>(android.content.Context, android.util.AttributeSet);
} }
-keepclasseswithmembernames class * { -keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet, int); public <init>(android.content.Context, android.util.AttributeSet, int);
} }
-keepclassmembers class * extends android.app.Activity {
public void *(android.view.View);
}
-keepclassmembers enum * { -keepclassmembers enum * {
public static **[] values(); public static **[] values();
public static ** valueOf(java.lang.String); public static ** valueOf(java.lang.String);

@ -10,4 +10,4 @@
# Indicates whether an apk should be generated for each density. # Indicates whether an apk should be generated for each density.
split.density=false split.density=false
# Project target. # Project target.
target=android-8 target=android-14

Loading…
Cancel
Save