Permalink
Browse files

Test scripts: centralize so it can be easier applied to other apps.

git-svn-id: https://openintents.googlecode.com/svn/trunk@4166 72b678ce-9140-0410-bee8-679b907dd61a
  • Loading branch information...
1 parent 1b6da3e commit 2c620fcc5a2f518acd481aaffae20aa03c00ae65 @peli0101 peli0101 committed Feb 12, 2012
Showing with 13 additions and 225 deletions.
  1. +13 −225 SafeTest/build.xml
View
@@ -1,232 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="SafeTest" default="help">
+ <!--
+ #############################################
+ Import tasks from common build script.
+ ############################################# -->
- <!-- 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" />
+ <!-- Private build properties are not shared via svn,
+ developers must have their own copy. -->
+ <property file="build-private.properties" />
- <!-- The ant.properties file can be created by you. It is only edited by the
- 'android' tool to add properties to it.
- This is the place to change some Ant specific build properties.
- Here are some properties you may want to change/update:
+ <!-- Root directory of all OpenIntents files. -->
+ <property name="source.base" value="../.." />
- source.dir
- The name of the source directory. Default is 'src'.
- out.dir
- The name of the output directory. Default is 'bin'.
-
- For other overridable properties, look at the beginning of the rules
- files in the SDK, at tools/ant/build.xml
-
- 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="ant.properties" />
-
- <!-- The project.properties file is created and updated by the 'android'
- tool, as well as ADT.
-
- This contains project specific properties such as project target, and library
- dependencies. Lower level build properties are stored in ant.properties
- (or in .classpath for Eclipse projects).
-
- This file is an integral part of the build system for your
- application and should be checked into Version Control Systems. -->
- <loadproperties srcFile="project.properties" />
-
- <!-- quick check on sdk.dir -->
- <fail
- message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through an env var"
- unless="sdk.dir"
- />
-
-
-<!-- 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>
--->
-
-
-
-<!-- Copy of "-compile" target from ${sdk.dir}/tools/ant/build.xml
-
-
- For an explanation, see here:
- http://code.google.com/p/android/issues/detail?id=23365
--->
- <!-- Compiles this project's .java files into .class files. -->
- <target name="-compile" depends="-build-setup, -pre-build, -code-gen, -pre-compile">
- <do-only-if-manifest-hasCode elseText="hasCode = false. Skipping...">
- <!-- 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}/${jar.libs.dir}"
- else="${jar.libs.dir}">
- <isset property="tested.project.absolute.dir" />
- </condition>
- <javac encoding="${java.encoding}"
- source="${java.source}" target="${java.target}"
- debug="true" extdirs="" includeantruntime="false"
- destdir="${out.classes.absolute.dir}"
- bootclasspathref="android.target.classpath"
- verbose="${verbose}"
- classpath="${extensible.classpath}"
- classpathref="jar.libs.ref">
- <src path="${source.absolute.dir}" />
- <src path="${gen.absolute.dir}" />
- <classpath>
- <fileset dir="${extensible.libs.classpath}" includes="*.jar" />
- <!-- MODIFICATION STARTS -->
- <fileset dir="../../distribution/DistributionLibrary/bin" includes="*.jar" />
- <!-- MODIFICATION ENDS -->
- </classpath>
- <compilerarg line="${java.compilerargs}" />
- </javac>
- <!-- if the project is a library then we generate a jar file -->
- <if condition="${project.is.library}">
- <then>
- <echo>Creating library output jar file...</echo>
- <property name="out.library.jar.file" location="${out.absolute.dir}/classes.jar" />
- <if>
- <condition>
- <length string="${android.package.excludes}" trim="true" when="greater" length="0" />
- </condition>
- <then>
- <echo>Custom jar packaging exclusion: ${android.package.excludes}</echo>
- </then>
- </if>
- <jar destfile="${out.library.jar.file}">
- <fileset dir="${out.classes.absolute.dir}" excludes="**/R.class **/R$*.class"/>
- <fileset dir="${source.absolute.dir}" excludes="**/*.java ${android.package.excludes}" />
- </jar>
- </then>
- </if>
-
- <!-- if the project is instrumented, intrument the classes -->
- <if condition="${build.is.instrumented}">
- <then>
- <echo>Instrumenting classes from ${out.absolute.dir}/classes...</echo>
- <!-- It only instruments class files, not any external libs -->
- <emma enabled="true">
- <instr verbosity="${verbosity}"
- mode="overwrite"
- instrpath="${out.absolute.dir}/classes"
- outdir="${out.absolute.dir}/classes">
- </instr>
- <!-- TODO: exclusion filters on R*.class and allowing custom exclusion from
- user defined file -->
- </emma>
- </then>
- </if>
- </do-only-if-manifest-hasCode>
- </target>
-
-
-<!-- Copy of "test" target from ${sdk.dir}/tools/ant/build.xml
-
- in order to include EMMA xml output
--->
-
- <target name="test" depends="-test-project-check"
- description="Runs tests from the package defined in test.package property">
-
- <property name="tested.project.absolute.dir" location="${tested.project.dir}" />
-
- <property name="test.runner" value="android.test.InstrumentationTestRunner" />
-
- <!-- 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" />
-
- <if condition="${emma.enabled}">
- <then>
- <echo>WARNING: Code Coverage is currently only supported on the emulator and rooted devices.</echo>
- <run-tests-helper emma.enabled="true">
- <extra-instrument-args>
- <arg value="-e" />
- <arg value="coverageFile" />
- <arg value="${emma.dump.file}" />
- </extra-instrument-args>
- </run-tests-helper>
- <echo>Downloading coverage file into project directory...</echo>
- <exec executable="${adb}" failonerror="true">
- <arg line="${adb.device.arg}" />
- <arg value="pull" />
- <arg value="${emma.dump.file}" />
- <arg value="coverage.ec" />
- </exec>
- <echo>Extracting coverage report...</echo>
- <emma>
- <report sourcepath="${tested.project.absolute.dir}/${source.dir}"
- verbosity="${verbosity}">
- <!-- TODO: report.dir or something like should be introduced if necessary -->
- <infileset dir=".">
- <include name="coverage.ec" />
- <include name="coverage.em" />
- </infileset>
- <!-- TODO: reports in other, indicated by user formats -->
- <html outfile="coverage.html" />
- <!-- MODIFICATION STARTS -->
- <xml outfile="coverage.xml" />
- <!-- MODIFICATION ENDS -->
- </report>
- </emma>
- <echo>Cleaning up temporary files...</echo>
- <delete file="coverage.ec" />
- <delete file="coverage.em" />
- <echo>Saving the report file in ${basedir}/coverage/coverage.html</echo>
- </then>
- <else>
- <run-tests-helper />
- </else>
- </if>
- </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: 1 -->
- <import file="${sdk.dir}/tools/ant/build.xml" />
+ <!-- Path for common ant script. -->
+ <property name="build.common.dir" value="${source.base}/distribution/ant" />
+ <!-- All definitions are imported from a central location -->
+ <import file="${build.common.dir}/test_build_common.xml" />
</project>

0 comments on commit 2c620fc

Please sign in to comment.