mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-23 18:02:15 -05:00
summary: updated build.xml and tests/build.xml.
build.xml and tests/build.xml: updated general format to match what is generated in a new project. moved targets common to both to build_common.xml. replaced some exec calls (perl, mv) and inline javascript with ant tasks (including extensions from Android and ant-contrib). build.xml: fixed indentation. privatized targets that don't need to be called directly from command-line. renamed some properties. tests/build.xml: renamed test project from K9 to K9Tests. tools/ant-contrib.jar: new! .gitignore: added note about local per-repo rules.
This commit is contained in:
parent
67caa357fd
commit
cb715387b5
4
.gitignore
vendored
4
.gitignore
vendored
@ -1,3 +1,7 @@
|
|||||||
|
# Local per-repo rules can be added to the .git/info/exclude file in your
|
||||||
|
# repo. These rules are not committed with the repo so they are not shared
|
||||||
|
# with others. This method can be used for locally-generated files that you
|
||||||
|
# don’t expect other users to generate, like files created by your editor.
|
||||||
.settings
|
.settings
|
||||||
bin
|
bin
|
||||||
coverage
|
coverage
|
||||||
|
206
build.xml
206
build.xml
@ -4,7 +4,7 @@
|
|||||||
<!-- 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 into
|
It contains the path to the SDK. It should *NOT* be checked into
|
||||||
Version Control Systems. -->
|
Version Control Systems. -->
|
||||||
<loadproperties srcFile="local.properties" />
|
<property file="local.properties" />
|
||||||
|
|
||||||
<!-- The ant.properties file can be created by you. It is only edited by the
|
<!-- The ant.properties file can be created by you. It is only edited by the
|
||||||
'android' tool to add properties to it.
|
'android' tool to add properties to it.
|
||||||
@ -41,25 +41,23 @@
|
|||||||
|
|
||||||
<!-- quick check on sdk.dir -->
|
<!-- quick check on sdk.dir -->
|
||||||
<fail
|
<fail
|
||||||
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project'"
|
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"
|
unless="sdk.dir"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|
||||||
<!-- extension targets. Uncomment the ones where you want to do custom work
|
|
||||||
in between standard targets -->
|
|
||||||
<!--
|
<!--
|
||||||
<target name="-pre-build">
|
Import per project custom build rules if present at the root of the project.
|
||||||
</target>
|
This is the place to put custom intermediary targets such as:
|
||||||
<target name="-pre-compile">
|
-pre-build
|
||||||
</target>
|
-pre-compile
|
||||||
|
-post-compile (This is typically used for code obfuscation.
|
||||||
/* This is typically used for code obfuscation.
|
|
||||||
Compiled code location: ${out.classes.absolute.dir}
|
Compiled code location: ${out.classes.absolute.dir}
|
||||||
If this is not done in place, override ${out.dex.input.absolute.dir} */
|
If this is not done in place, override ${out.dex.input.absolute.dir})
|
||||||
<target name="-post-compile">
|
-post-package
|
||||||
</target>
|
-post-build
|
||||||
|
-pre-clean
|
||||||
-->
|
-->
|
||||||
|
<import file="custom_rules.xml" optional="true" />
|
||||||
|
|
||||||
<!-- Import the actual build file.
|
<!-- Import the actual build file.
|
||||||
|
|
||||||
@ -80,6 +78,7 @@
|
|||||||
in order to avoid having your file be overridden by tools such as "android update project"
|
in order to avoid having your file be overridden by tools such as "android update project"
|
||||||
-->
|
-->
|
||||||
<!-- version-tag: custom -->
|
<!-- version-tag: custom -->
|
||||||
|
<import file="${sdk.dir}/tools/ant/build.xml" />
|
||||||
|
|
||||||
<!-- K9 CUSTOM STUFF -->
|
<!-- K9 CUSTOM STUFF -->
|
||||||
|
|
||||||
@ -87,39 +86,72 @@
|
|||||||
<property name="rclib" value="${out.dir}/K9RemoteControl.jar" />
|
<property name="rclib" value="${out.dir}/K9RemoteControl.jar" />
|
||||||
<property name="rcdir" value="com/fsck/k9/remotecontrol/**" />
|
<property name="rcdir" value="com/fsck/k9/remotecontrol/**" />
|
||||||
|
|
||||||
<!-- A bloody hack, but a useful and quick one -->
|
<target name="-get-version" depends="-get-version-name">
|
||||||
<target name="get-version">
|
<echo>Building version number ${current-version-name}</echo>
|
||||||
<exec executable="perl" failonerror="true" outputproperty="version-name" errorproperty="version-error">
|
|
||||||
<!-- yes, ant needs " for " in doublequoted strings. -->
|
|
||||||
<arg line="-ne'/android:versionName.*?=.*?"(.*?)"/ ? print $1 : undef ' AndroidManifest.xml" />
|
|
||||||
</exec>
|
|
||||||
<echo>Building version number ${version-name}</echo>
|
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="get-version-from-git">
|
<target name="-get-version-name">
|
||||||
<exec executable="git" failonerror="true" outputproperty="version-name" errorproperty="version-error">
|
<xpath input="AndroidManifest.xml" expression="/manifest/@android:versionName" output="current-version-name" />
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="-get-version-code">
|
||||||
|
<xpath input="AndroidManifest.xml" expression="/manifest/@android:versionCode" output="current-version-code" />
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="-get-version-from-git">
|
||||||
|
<exec executable="git" failonerror="true" outputproperty="current-version-name" errorproperty="current-version-error">
|
||||||
<arg line="describe --tags" />
|
<arg line="describe --tags" />
|
||||||
</exec>
|
</exec>
|
||||||
<echo>Building version number ${version-name}</echo>
|
<echo>Building version number ${current-version-name}</echo>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="set-version">
|
<target name="-auto-incr-version">
|
||||||
|
<regex property="major" input="${current-version-name}" regexp="(\d+)\.\d+" select="\1" />
|
||||||
|
<regex property="minor" input="${current-version-name}" regexp="\d+\.(\d+)" select="\1" />
|
||||||
|
<math result="minor" operand1="${minor}" operation="+" operand2="1" datatype="int"/>
|
||||||
|
<if.contrib>
|
||||||
|
<length string="${minor}" when="eq" length="1" />
|
||||||
|
<then>
|
||||||
|
<var name="minor" value="00${minor}" />
|
||||||
|
</then>
|
||||||
|
<elseif>
|
||||||
|
<length string="${minor}" when="eq" length="2" />
|
||||||
|
<then>
|
||||||
|
<var name="minor" value="0${minor}" />
|
||||||
|
</then>
|
||||||
|
</elseif>
|
||||||
|
</if.contrib>
|
||||||
|
<regex property="version-name" input="${major}." regexp="(\d+.)" replace="\1${minor}" />
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="-set-version" depends="-get-version-name,-get-version-code">
|
||||||
|
<!-- pass -Dversion-name=4.200 to define the version instead of auto-incrementing it -->
|
||||||
|
<if.contrib>
|
||||||
|
<isset property="version-name" />
|
||||||
|
<else>
|
||||||
|
<runtarget target="-auto-incr-version" />
|
||||||
|
</else>
|
||||||
|
</if.contrib>
|
||||||
|
|
||||||
<echo>Setting version to ${version-name}</echo>
|
<echo>Setting version to ${version-name}</echo>
|
||||||
<fail unless="version-name">You can't set the version without passing -Dversion-name=1.234</fail>
|
<replace file="AndroidManifest.xml"
|
||||||
<exec executable="perl" failonerror="true">
|
token="android:versionName="${current-version-name}""
|
||||||
<arg line="-p -i.bak -e's/(?<=android:versionName=")(.*?)(?=")/${version-name}/' AndroidManifest.xml"/>
|
value="android:versionName="${version-name}"" summary="true"
|
||||||
</exec>
|
/>
|
||||||
<exec executable="perl" failonerror="true">
|
|
||||||
<arg line="-p -i.bak -e's/(?<=android:versionCode=")(\d+)(?=")/$1+1/e' AndroidManifest.xml" />
|
<math result="new-version-code" operand1="${current-version-code}" operation="+" operand2="1" datatype="int"/>
|
||||||
</exec>
|
<replace file="AndroidManifest.xml"
|
||||||
|
token="android:versionCode="${current-version-code}""
|
||||||
|
value="android:versionCode="${new-version-code}"" summary="true"
|
||||||
|
/>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- rules -->
|
<!-- rules -->
|
||||||
<target name="bump-version" depends="set-version,commit-version">
|
<target name="bump-version" depends="-set-version,-commit-version">
|
||||||
<echo>Bumping K-9 to ${version-name}</echo>
|
<echo>Bumped K-9 to ${version-name}</echo>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="commit-version">
|
<target name="-commit-version">
|
||||||
<exec executable="git" failonerror="true">
|
<exec executable="git" failonerror="true">
|
||||||
<arg line="commit -m'Bumped manifest to ${version-name}' AndroidManifest.xml" />
|
<arg line="commit -m'Bumped manifest to ${version-name}' AndroidManifest.xml" />
|
||||||
</exec>
|
</exec>
|
||||||
@ -139,24 +171,23 @@
|
|||||||
<echo>Creating library ${rclib} for remote control applications</echo>
|
<echo>Creating library ${rclib} for remote control applications</echo>
|
||||||
<jar destfile="${rclib}" basedir="${out.classes.dir}" includes="${rcdir}" />
|
<jar destfile="${rclib}" basedir="${out.classes.dir}" includes="${rcdir}" />
|
||||||
</target>
|
</target>
|
||||||
<target name="upload" depends="clean,get-version,release">
|
|
||||||
|
<target name="upload" depends="clean,-get-version,release">
|
||||||
<echo>Uploading to Google Code using Google::Code::Upload</echo>
|
<echo>Uploading to Google Code using Google::Code::Upload</echo>
|
||||||
<exec executable="mv" failonerror="true">
|
<move file="${out.final.file}" tofile="bin/k9-${current-version-name}-release.apk" />
|
||||||
<arg value="${out.final.file}" />
|
<property name="gcode-project" value="k9mail" />
|
||||||
<arg value="bin/k9-${version-name}-release.apk" />
|
|
||||||
</exec>
|
|
||||||
<exec executable="googlecode_upload.pl" failonerror="true">
|
<exec executable="googlecode_upload.pl" failonerror="true">
|
||||||
<arg value="--summary" />
|
<arg value="--summary" />
|
||||||
<arg value="${ant.project.name} ${version-name}"/>
|
<arg value="${ant.project.name} ${current-version-name}" />
|
||||||
<arg value="--project" />
|
<arg value="--project" />
|
||||||
<arg value="k9mail"/>
|
<arg value="${gcode-project}" />
|
||||||
<arg value="--user" />
|
<arg value="--user" />
|
||||||
<arg value="${gcode-user}" />
|
<arg value="${gcode-user}" />
|
||||||
<arg value="--pass" />
|
<arg value="--pass" />
|
||||||
<arg value="${gcode-pass}" />
|
<arg value="${gcode-pass}" />
|
||||||
<arg value="--labels" />
|
<arg value="--labels" />
|
||||||
<arg value="Type-Installer" />
|
<arg value="Type-Installer" />
|
||||||
<arg value="bin/k9-${version-name}-release.apk" />
|
<arg value="bin/k9-${current-version-name}-release.apk" />
|
||||||
</exec>
|
</exec>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
@ -172,6 +203,7 @@
|
|||||||
<echo>Additional targets:</echo>
|
<echo>Additional targets:</echo>
|
||||||
<!--echo> bump-version: ant -Dversion-name=3.123</echo>
|
<!--echo> bump-version: ant -Dversion-name=3.123</echo>
|
||||||
<echo> Bumps the project version to 3.123,tags and commits it.</echo>
|
<echo> Bumps the project version to 3.123,tags and commits it.</echo>
|
||||||
|
<echo> If version-name is not given, it will auto-increment.</echo>
|
||||||
<echo> upload: Uploads a new release to google code.</echo-->
|
<echo> upload: Uploads a new release to google code.</echo-->
|
||||||
<echo> rclib: Creates library for remote control applications.</echo>
|
<echo> rclib: Creates library for remote control applications.</echo>
|
||||||
<echo> astyle: Make K-9's source look like it's supposed to.</echo>
|
<echo> astyle: Make K-9's source look like it's supposed to.</echo>
|
||||||
@ -191,51 +223,10 @@
|
|||||||
</copy>
|
</copy>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<property environment="env" />
|
|
||||||
|
|
||||||
<property name="javadoc-dir" location="javadoc" />
|
|
||||||
|
|
||||||
<target name="javadoc" description="build javadoc">
|
|
||||||
<mkdir dir="${javadoc-dir}"/>
|
|
||||||
<javadoc
|
|
||||||
destdir="${javadoc-dir}"
|
|
||||||
doctitle="K-9 Mail"
|
|
||||||
verbose="on"
|
|
||||||
use="true"
|
|
||||||
classpath="${env.ANDROID_HOME}/platforms/${target}/android.jar"
|
|
||||||
sourcepath="gen;src"
|
|
||||||
linkoffline="http://d.android.com/reference ${env.ANDROID_HOME}/docs/reference/"
|
|
||||||
/>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="lint-xml">
|
|
||||||
<exec executable="lint" failonerror="true">
|
|
||||||
<arg value="--xml" />
|
|
||||||
<arg value="lint-results.xml" />
|
|
||||||
<arg path="." />
|
|
||||||
</exec>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="lint-html">
|
|
||||||
<exec executable="lint" failonerror="true">
|
|
||||||
<arg value="--html" />
|
|
||||||
<arg value="lint-results.html" />
|
|
||||||
<arg path="." />
|
|
||||||
</exec>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="monkey">
|
<target name="monkey">
|
||||||
<xpath input="AndroidManifest.xml" expression="/manifest/@package" output="manifest.package" />
|
<xpath input="AndroidManifest.xml" expression="/manifest/@package" output="manifest.package" />
|
||||||
<if condition="monkey.count">
|
|
||||||
<else>
|
|
||||||
<property name="monkey.count" value="200" />
|
<property name="monkey.count" value="200" />
|
||||||
</else>
|
<property name="monkey.seed" value="0" /><!-- largest == 9223372036854775807 == 2**63 - 1 -->
|
||||||
</if>
|
|
||||||
<if condition="monkey.seed">
|
|
||||||
<else>
|
|
||||||
<property name="monkey.seed" value="0" />
|
|
||||||
</else>
|
|
||||||
</if>
|
|
||||||
<exec executable="${adb}" output="monkey.txt" failonerror="true">
|
<exec executable="${adb}" output="monkey.txt" failonerror="true">
|
||||||
<arg line="${adb.device.arg}" />
|
<arg line="${adb.device.arg}" />
|
||||||
<arg value="-e" />
|
<arg value="-e" />
|
||||||
@ -244,46 +235,29 @@
|
|||||||
<arg value="-p" />
|
<arg value="-p" />
|
||||||
<arg value="${manifest.package}" />
|
<arg value="${manifest.package}" />
|
||||||
<arg value="-v" />
|
<arg value="-v" />
|
||||||
|
<arg value="-v" />
|
||||||
<arg value="-s" />
|
<arg value="-s" />
|
||||||
<arg value="${monkey.seed}" />
|
<arg value="${monkey.seed}" />
|
||||||
<arg value="${monkey.count}" />
|
<arg value="${monkey.count}" />
|
||||||
</exec>
|
</exec>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<scriptdef name="lastindexplus1" language="javascript">
|
<target name="reg" depends="-get-version-code">
|
||||||
<attribute name="text" />
|
<regex property="branch" input="${env.GIT_BRANCH}" regexp="(?:.*/)?(.+)" select="\1" global="true"/>
|
||||||
<attribute name="substring" />
|
<regex property="commit" input="${env.GIT_COMMIT}" regexp="([\da-fA-F]{10})" select="\1" global="true"/>
|
||||||
<attribute name="property" />
|
<math result="version-code" operand1="${current-version-code}" operation="+" operand2="1" datatype="int"/>
|
||||||
<![CDATA[
|
<echo message="branch = ${branch} ${commit} ${current-version-code} ${version-code}" />
|
||||||
var text = attributes.get("text");
|
</target>
|
||||||
var substring = attributes.get("substring");
|
|
||||||
project.setProperty(attributes.get("property"), text.lastIndexOf(substring) + 1);
|
|
||||||
]]>
|
|
||||||
</scriptdef>
|
|
||||||
|
|
||||||
<scriptdef name="substring" language="javascript">
|
<!-- this is for CloudBees. see tests/build.xml -->
|
||||||
<attribute name="text" />
|
|
||||||
<attribute name="start" />
|
|
||||||
<attribute name="end" />
|
|
||||||
<attribute name="property" />
|
|
||||||
<![CDATA[
|
|
||||||
var text = attributes.get("text");
|
|
||||||
var start = attributes.get("start");
|
|
||||||
var end = attributes.get("end") || text.length();
|
|
||||||
project.setProperty(attributes.get("property"), text.substring(start, end));
|
|
||||||
]]>
|
|
||||||
</scriptdef>
|
|
||||||
|
|
||||||
<!-- this, and the two scriptdefs above, are for CloudBees. see tests/build.xml -->
|
|
||||||
<target name="-artifactd" depends="-set-debug-files, -artifact" />
|
<target name="-artifactd" depends="-set-debug-files, -artifact" />
|
||||||
<target name="-artifacti" depends="-set-instrumented-mode, -artifact" />
|
<target name="-artifacti" depends="-set-instrumented-mode, -artifact" />
|
||||||
<target name="-artifact">
|
<target name="-artifact">
|
||||||
<lastindexplus1 text="${env.GIT_BRANCH}" substring="/" property="lastindexof" />
|
<regex property="branch" input="${env.GIT_BRANCH}" regexp="(?:.*/)?(.+)" select="\1" global="true" />
|
||||||
<substring text="${env.GIT_BRANCH}" start="${lastindexof}" property="branch" />
|
<regex property="commit" input="${env.GIT_COMMIT}" regexp="([\da-fA-F]{10})" select="\1" />
|
||||||
<substring text="${env.GIT_COMMIT}" start="0" end="10" property="commit" />
|
|
||||||
|
|
||||||
<copy file="${out.final.file}"
|
<copy file="${out.final.file}"
|
||||||
tofile="${out.dir}/K9-${branch}-${env.BUILD_ID}-${commit}-${env.BUILD_NUMBER}.apk"
|
tofile="${out.dir}/${ant.project.name}-${branch}-${env.BUILD_ID}-${commit}-${env.BUILD_NUMBER}.apk"
|
||||||
verbose="on"
|
verbose="on"
|
||||||
/>
|
/>
|
||||||
</target>
|
</target>
|
||||||
@ -296,7 +270,9 @@
|
|||||||
<delete dir="${javadoc-dir}" verbose="${verbose}" />
|
<delete dir="${javadoc-dir}" verbose="${verbose}" />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- END K-9 STUFF-->
|
<!-- common to both build.xml and tests/build.xml -->
|
||||||
<import file="${sdk.dir}/tools/ant/build.xml" />
|
<import file="build_common.xml" />
|
||||||
|
|
||||||
|
<!-- END K-9 CUSTOM STUFF -->
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
84
build_common.xml
Normal file
84
build_common.xml
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
<project name="common">
|
||||||
|
<!-- This file contains scriptdefs, properties, targets, etc that are common
|
||||||
|
to both build.xml and tests/build.xml. It also loads ant-contrib, where
|
||||||
|
each desired task needs to be defined below as both ant-contrib and
|
||||||
|
Android's anttasks.jar define different 'if' tasks. -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ANT-CONTRIB -->
|
||||||
|
|
||||||
|
<!-- jar file from where the tasks are loaded -->
|
||||||
|
<path id="antcontrib">
|
||||||
|
<pathelement path="tools/ant-contrib.jar" />
|
||||||
|
</path>
|
||||||
|
|
||||||
|
<!-- ant-contrib tasks -->
|
||||||
|
<!-- this is normally named propertyregex -->
|
||||||
|
<taskdef name="regex"
|
||||||
|
classname="net.sf.antcontrib.property.RegexTask"
|
||||||
|
classpathref="antcontrib" />
|
||||||
|
<taskdef name="math"
|
||||||
|
classname="net.sf.antcontrib.math.MathTask"
|
||||||
|
classpathref="antcontrib" />
|
||||||
|
<taskdef name="runtarget"
|
||||||
|
classname="net.sf.antcontrib.logic.RunTargetTask"
|
||||||
|
classpathref="antcontrib" />
|
||||||
|
<taskdef name="var"
|
||||||
|
classname="net.sf.antcontrib.property.Variable"
|
||||||
|
classpathref="antcontrib" />
|
||||||
|
<!-- renamed to not conflict with android -->
|
||||||
|
<taskdef name="if.contrib"
|
||||||
|
classname="net.sf.antcontrib.logic.IfTask"
|
||||||
|
classpathref="antcontrib" />
|
||||||
|
|
||||||
|
|
||||||
|
<!-- SCRIPTDEFS -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- PROPERTIES -->
|
||||||
|
|
||||||
|
<!-- allow environment variables to be accessable by prepending "env." -->
|
||||||
|
<property environment="env" />
|
||||||
|
|
||||||
|
<!-- javadoc folder relative to ${basedir} -->
|
||||||
|
<property name="javadoc-dir" location="javadoc" />
|
||||||
|
|
||||||
|
<!-- path to lint -->
|
||||||
|
<property name="lint" location="${android.tools.dir}/lint${bat}" />
|
||||||
|
|
||||||
|
|
||||||
|
<!-- TARGETS -->
|
||||||
|
|
||||||
|
<!-- create javadoc in ${javadoc-dir} -->
|
||||||
|
<target name="javadoc" description="build javadoc">
|
||||||
|
<mkdir dir="${javadoc-dir}"/>
|
||||||
|
<javadoc
|
||||||
|
destdir="${javadoc-dir}"
|
||||||
|
doctitle="K-9 Mail"
|
||||||
|
verbose="on"
|
||||||
|
use="true"
|
||||||
|
classpath="${env.ANDROID_HOME}/platforms/${target}/android.jar"
|
||||||
|
sourcepath="gen;src"
|
||||||
|
linkoffline="http://d.android.com/reference ${env.ANDROID_HOME}/docs/reference/"
|
||||||
|
/>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<!-- create lint-results.xml -->
|
||||||
|
<target name="lint-xml">
|
||||||
|
<exec executable="${lint}" failonerror="true">
|
||||||
|
<arg value="--xml" />
|
||||||
|
<arg value="lint-results.xml" />
|
||||||
|
<arg path="${basedir}" />
|
||||||
|
</exec>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<!-- create lint-results.html and lint-results_files/ -->
|
||||||
|
<target name="lint-html">
|
||||||
|
<exec executable="${lint}" failonerror="true">
|
||||||
|
<arg value="--html" />
|
||||||
|
<arg value="lint-results.html" />
|
||||||
|
<arg path="${basedir}" />
|
||||||
|
</exec>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
</project>
|
111
tests/build.xml
111
tests/build.xml
@ -1,10 +1,10 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project name="K9" default="help">
|
<project name="K9Tests" 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 into
|
It contains the path to the SDK. It should *NOT* be checked into
|
||||||
Version Control Systems. -->
|
Version Control Systems. -->
|
||||||
<loadproperties srcFile="local.properties" />
|
<property file="local.properties" />
|
||||||
|
|
||||||
<!-- The ant.properties file can be created by you. It is only edited by the
|
<!-- The ant.properties file can be created by you. It is only edited by the
|
||||||
'android' tool to add properties to it.
|
'android' tool to add properties to it.
|
||||||
@ -41,25 +41,23 @@
|
|||||||
|
|
||||||
<!-- quick check on sdk.dir -->
|
<!-- quick check on sdk.dir -->
|
||||||
<fail
|
<fail
|
||||||
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project'"
|
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"
|
unless="sdk.dir"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|
||||||
<!-- extension targets. Uncomment the ones where you want to do custom work
|
|
||||||
in between standard targets -->
|
|
||||||
<!--
|
<!--
|
||||||
<target name="-pre-build">
|
Import per project custom build rules if present at the root of the project.
|
||||||
</target>
|
This is the place to put custom intermediary targets such as:
|
||||||
<target name="-pre-compile">
|
-pre-build
|
||||||
</target>
|
-pre-compile
|
||||||
|
-post-compile (This is typically used for code obfuscation.
|
||||||
/* This is typically used for code obfuscation.
|
|
||||||
Compiled code location: ${out.classes.absolute.dir}
|
Compiled code location: ${out.classes.absolute.dir}
|
||||||
If this is not done in place, override ${out.dex.input.absolute.dir} */
|
If this is not done in place, override ${out.dex.input.absolute.dir})
|
||||||
<target name="-post-compile">
|
-post-package
|
||||||
</target>
|
-post-build
|
||||||
|
-pre-clean
|
||||||
-->
|
-->
|
||||||
|
<import file="custom_rules.xml" optional="true" />
|
||||||
|
|
||||||
<!-- Import the actual build file.
|
<!-- Import the actual build file.
|
||||||
|
|
||||||
@ -80,42 +78,10 @@
|
|||||||
in order to avoid having your file be overridden by tools such as "android update project"
|
in order to avoid having your file be overridden by tools such as "android update project"
|
||||||
-->
|
-->
|
||||||
<!-- version-tag: custom -->
|
<!-- version-tag: custom -->
|
||||||
|
<import file="${sdk.dir}/tools/ant/build.xml" />
|
||||||
|
|
||||||
<!-- K-9 CUSTOM STUFF -->
|
<!-- K-9 CUSTOM STUFF -->
|
||||||
|
|
||||||
<property environment="env" />
|
|
||||||
|
|
||||||
<property name="javadoc-dir" location="javadoc" />
|
|
||||||
|
|
||||||
<target name="javadoc" description="build javadoc">
|
|
||||||
<mkdir dir="${javadoc-dir}"/>
|
|
||||||
<javadoc
|
|
||||||
destdir="${javadoc-dir}"
|
|
||||||
doctitle="K-9 Mail"
|
|
||||||
verbose="on"
|
|
||||||
use="true"
|
|
||||||
classpath="${env.ANDROID_HOME}/platforms/${target}/android.jar"
|
|
||||||
sourcepath="gen;src"
|
|
||||||
linkoffline="http://d.android.com/reference ${env.ANDROID_HOME}/docs/reference/"
|
|
||||||
/>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="lint-xml">
|
|
||||||
<exec executable="lint" failonerror="true">
|
|
||||||
<arg value="--xml" />
|
|
||||||
<arg value="lint-results.xml" />
|
|
||||||
<arg path="." />
|
|
||||||
</exec>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="lint-html">
|
|
||||||
<exec executable="lint" failonerror="true">
|
|
||||||
<arg value="--html" />
|
|
||||||
<arg value="lint-results.html" />
|
|
||||||
<arg path="." />
|
|
||||||
</exec>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<property name="junit-file" location="junit-report.xml" />
|
<property name="junit-file" location="junit-report.xml" />
|
||||||
|
|
||||||
<!-- This is overridden because otherwise it deletes coverage.em after extraction, requiring
|
<!-- This is overridden because otherwise it deletes coverage.em after extraction, requiring
|
||||||
@ -189,34 +155,14 @@
|
|||||||
</exec>
|
</exec>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<scriptdef name="lastindexplus1" language="javascript">
|
|
||||||
<attribute name="text" />
|
|
||||||
<attribute name="substring" />
|
|
||||||
<attribute name="property" />
|
|
||||||
<![CDATA[
|
|
||||||
var text = attributes.get("text");
|
|
||||||
var substring = attributes.get("substring");
|
|
||||||
project.setProperty(attributes.get("property"), text.lastIndexOf(substring) + 1);
|
|
||||||
]]>
|
|
||||||
</scriptdef>
|
|
||||||
|
|
||||||
<scriptdef name="substring" language="javascript">
|
|
||||||
<attribute name="text" />
|
|
||||||
<attribute name="start" />
|
|
||||||
<attribute name="end" />
|
|
||||||
<attribute name="property" />
|
|
||||||
<![CDATA[
|
|
||||||
var text = attributes.get("text");
|
|
||||||
var start = attributes.get("start");
|
|
||||||
var end = attributes.get("end") || text.length();
|
|
||||||
project.setProperty(attributes.get("property"), text.substring(start, end));
|
|
||||||
]]>
|
|
||||||
</scriptdef>
|
|
||||||
|
|
||||||
<target name="artifacts" description="Copies the apks as unique CloudBees artifacts">
|
<target name="artifacts" description="Copies the apks as unique CloudBees artifacts">
|
||||||
<lastindexplus1 text="${env.GIT_BRANCH}" substring="/" property="lastindexof" />
|
<fail unless="env.GIT_BRANCH" message="The environment variable GIT_BRANCH must exist." />
|
||||||
<substring text="${env.GIT_BRANCH}" start="${lastindexof}" property="branch" />
|
<fail unless="env.GIT_COMMIT" message="The environment variable GIT_COMMIT must exist." />
|
||||||
<substring text="${env.GIT_COMMIT}" start="0" end="10" property="commit" />
|
<fail unless="env.BUILD_ID" message="The environment variable BUILD_ID must exist." />
|
||||||
|
<fail unless="env.BUILD_NUMBER" message="The environment variable BUILD_NUMBER must exist." />
|
||||||
|
|
||||||
|
<regex property="branch" input="${env.GIT_BRANCH}" regexp="(?:.*/)?(.+)" select="\1" global="true" />
|
||||||
|
<regex property="commit" input="${env.GIT_COMMIT}" regexp="([\da-fA-F]{10})" select="\1" />
|
||||||
|
|
||||||
<!-- calls ../build.xml -->
|
<!-- calls ../build.xml -->
|
||||||
<property name="tested.project.absolute.dir" location="${tested.project.dir}" />
|
<property name="tested.project.absolute.dir" location="${tested.project.dir}" />
|
||||||
@ -227,19 +173,14 @@
|
|||||||
<fileset dir="${tested.project.absolute.dir}" includes="build.xml" />
|
<fileset dir="${tested.project.absolute.dir}" includes="build.xml" />
|
||||||
</subant>
|
</subant>
|
||||||
|
|
||||||
<!-- define out.final.file if not already defined (if calling without debug, for instance) -->
|
<if condition="${build.is.mode.set}">
|
||||||
<condition property="out.final.file.isset" value="true" else="false">
|
|
||||||
<isset property="out.final.file" />
|
|
||||||
</condition>
|
|
||||||
<if condition="${out.final.file.isset}">
|
|
||||||
<else>
|
<else>
|
||||||
<property name="out.final.file"
|
<runtarget target="-set-debug-files" />
|
||||||
location="${out.absolute.dir}/${ant.project.name}-debug.apk" />
|
|
||||||
</else>
|
</else>
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
<copy file="${out.final.file}"
|
<copy file="${out.final.file}"
|
||||||
tofile="${out.dir}/K9-${branch}-${env.BUILD_ID}-${commit}-${env.BUILD_NUMBER}-tests.apk"
|
tofile="${out.dir}/${ant.project.name}-${branch}-${env.BUILD_ID}-${commit}-${env.BUILD_NUMBER}.apk"
|
||||||
verbose="on"
|
verbose="on"
|
||||||
/>
|
/>
|
||||||
</target>
|
</target>
|
||||||
@ -268,7 +209,9 @@
|
|||||||
<echo> ant [emma] [debug] artifacts</echo>
|
<echo> ant [emma] [debug] artifacts</echo>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
<!-- common to both build.xml and tests/build.xml -->
|
||||||
|
<import file="../build_common.xml" />
|
||||||
|
|
||||||
<!-- END K-9 CUSTOM STUFF -->
|
<!-- END K-9 CUSTOM STUFF -->
|
||||||
|
|
||||||
<import file="${sdk.dir}/tools/ant/build.xml" />
|
|
||||||
</project>
|
</project>
|
||||||
|
BIN
tools/ant-contrib.jar
Normal file
BIN
tools/ant-contrib.jar
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user