-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathcustom_rules.xml
126 lines (105 loc) · 5.28 KB
/
custom_rules.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<?xml version="1.0" encoding="UTF-8"?>
<project name="imported">
<!-- The out file for the built SDK. -->
<property name="out.custom.jar.file" value="${ant.project.name}.jar" />
<!-- The out directory for the Javadoc. -->
<property name="out.custom.docs.dir" value="docs" />
<!-- The out directory for the built HTML Javadoc. -->
<property name="out.custom.docs.html.dir" value="${out.custom.docs.dir}/html" />
<!-- The out file for the built Javadoc archive. -->
<property name="out.custom.docs.jar.file" value="${ant.project.name}-javadoc.jar" />
<!-- The absolute path to the git executable. -->
<property name="git.path" location="/usr/bin/git" />
<!-- Check if the .git path is valid. -->
<available file="${git.path}" type="file" property="git.installed" />
<!-- Check if .git is present in the current directory. -->
<available file=".git" type="dir" property="git.project" />
<!-- Retrive the build version and create two properties. -->
<target name="-build-version" description="" if="git.project">
<exec executable="${git.path}" outputproperty="git.revision" failifexecutionfails="true" errorproperty="">
<arg value="rev-parse" />
<arg value="--verify" />
<arg value="HEAD" />
</exec>
<exec executable="${git.path}" outputproperty="git.short" failifexecutionfails="true" errorproperty="">
<arg value="rev-parse" />
<arg value="--short" />
<arg value="--verify" />
<arg value="HEAD" />
</exec>
<echo message="Building version ${git.revision} ..." />
</target>
<!-- Run before anything else. -->
<target name="-pre-setup">
<if condition="${git.installed}">
<else>
<fail message="Could not locate git at ${git.path}! Please add git.path=/path/to/git to your local.properties." />
</else>
</if>
</target>
<!-- Run before building. -->
<target name="-pre-build" depends="-pre-setup"></target>
<!-- Run before compiling. -->
<target name="-pre-compile"></target>
<!-- Run after compiling. -->
<target name="-post-compile"></target>
<!-- Run after the build has completed. -->
<target name="-post-build"></target>
<!-- Generate the HTML Javadoc and a Jar archive. -->
<target name="docs">
<javadoc
destdir="${out.absolute.dir}/${out.custom.docs.html.dir}"
classpath="${sdk.dir}/platforms/${target}/android.jar"
access="protected" author="true" version="true" use="true"
failonerror="true">
<packageset dir="${source.absolute.dir}">
<include name="com/twotoasters/android/hoot/**" />
</packageset>
</javadoc>
<echo level="info">----------</echo>
<!-- Package the HTML Javadoc into a Jar archive. -->
<jar destfile="${out.absolute.dir}/${out.custom.docs.jar.file}">
<fileset dir="${out.absolute.dir}/${out.custom.docs.html.dir}" />
</jar>
</target>
<!-- Compile the SDK into class files and package into a Jar archive. -->
<target name="dist" depends="-build-version,-pre-setup,-pre-build,-build-setup,docs">
<!-- merge the project's own classpath and the tested project's classpath -->
<path id="project.javac.classpath">
<path refid="project.all.jars.path" />
<path refid="tested.project.classpath" />
</path>
<javac encoding="${java.encoding}"
source="${java.source}" target="${java.target}"
debug="true" extdirs="" includeantruntime="false"
destdir="${out.classes.absolute.dir}"
bootclasspathref="project.target.class.path"
verbose="${verbose}"
classpathref="project.javac.classpath"
fork="${need.javac.fork}">
<src path="${source.absolute.dir}" />
<src path="${gen.absolute.dir}" />
<compilerarg line="${java.compilerargs}" />
</javac>
<echo level="info">----------</echo>
<jar destfile="${out.absolute.dir}/${out.custom.jar.file}">
<fileset
dir="${out.classes.absolute.dir}"
includes="**/*.class"
excludes="${project.app.package.path}/R.class ${project.app.package.path}/R$*.class ${project.app.package.path}/Manifest.class ${project.app.package.path}/Manifest$*.class ${project.app.package.path}/BuildConfig.class"/>
<fileset dir="${source.absolute.dir}" excludes="**/*.java ${android.package.excludes}" />
</jar>
<echo level="info">----------</echo>
<!-- Create a tar archive of the build artifacts. -->
<echo message="Archiving build artifacts ..." />
<tar destfile="${out.absolute.dir}/${ant.project.name}.tar"
basedir="${out.absolute.dir}"
includes="${out.custom.jar.file},${out.custom.docs.dir}" />
<!-- GZip the build artifacts. -->
<gzip destfile="${out.absolute.dir}/${ant.project.name}-${git.short}.tar.gz"
src="${out.absolute.dir}/${ant.project.name}.tar" />
<delete file="${out.absolute.dir}/${ant.project.name}.tar"
failonerror="true"
quiet="true" />
</target>
</project>