-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
custom_rules.xml
96 lines (86 loc) · 3.63 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
<?xml version="1.0" encoding="UTF-8"?>
<project name="custom_rules">
<property name="name" value="panic" />
<target name="-getgitdetails" >
<exec executable="git" outputproperty="git.describe">
<arg value="describe"/>
</exec>
<exec executable="git" outputproperty="git.revision">
<arg value="rev-parse"/>
<arg value="HEAD"/>
</exec>
<property name="jar.name" value="${name}-${git.describe}" />
<property name="javadoc.jar" value="${jar.name}-javadoc.jar" />
<property name="source.jar" value="${jar.name}-source.jar" />
</target>
<target name="-pre-clean" depends="-getgitdetails">
<property name="delete.pattern" value="${jar.name}*.jar*" />
<echo message="deleting ${delete.pattern}" />
<delete failonerror="false">
<fileset dir="." includes="${delete.pattern}" />
</delete>
</target>
<target name="-create-manifest">
<echo message="Creating custom MANIFEST.MF" />
<manifest file="MANIFEST.MF">
<attribute name="Extension-Name" value="info.guardianproject.${name}"/>
<attribute name="Implementation-Vendor" value="Guardian Project"/>
<attribute name="Implementation-Title" value="PanicKit"/>
<attribute name="Implementation-URL" value="https://dev.guardianproject.info/projects/${name}"/>
<attribute name="Implementation-Git-URL" value="https://github.com/guardianproject/PanicKit"/>
</manifest>
<replaceregexp file="MANIFEST.MF"
match="\nCreated-By:.*?\n"
replace=""
flags="m"/>
</target>
<target name="-pre-build" depends="-getgitdetails,-create-manifest">
<echo message="running" />
</target>
<target name="javadoc" description="Generate Javadocs" depends="-pre-build">
<property name="javadoc.dir" value="${out.dir}/javadoc" />
<javadoc sourcepath="${source.dir}"
classpath="${toString:project.all.jars.path}:${toString:project.target.class.path}"
destdir="${javadoc.dir}"
packagenames="info.guardianproject.*"
additionalparam="-notimestamp"
windowtitle="${ant.project.name}"
linkoffline="https://developer.android.com/reference ${sdk.dir}/docs/reference"
linksource="true"
doctitle="${ant.project.name}" />
<zip destfile="${javadoc.jar}">
<zipfileset dir="." includes="MANIFEST.MF" prefix="META-INF" />
<zipfileset dir="${javadoc.dir}" />
</zip>
</target>
<target name="source" description="Generate Javadocs" depends="-build-setup,-getgitdetails">
<zip destfile="${source.jar}">
<zipfileset dir="." includes="MANIFEST.MF" prefix="META-INF" />
<zipfileset dir="${source.dir}"
includes="info/**" />
</zip>
<delete file="${source.jar}.asc"/>
</target>
<target name="-post-build" depends="-getgitdetails">
<condition property="build.is.debug" value="true" else="false">
<equals arg1="${build.target}" arg2="debug" />
</condition>
<if condition="${build.is.debug}">
<then>
<property name="release.jar" value="${jar.name}-debug.jar" />
</then>
<else>
<property name="release.jar" value="${jar.name}.jar" />
</else>
</if>
<property file="${sdk.dir}/tools/source.properties" />
<delete file="${release.jar}"/>
<zip destfile="${release.jar}">
<zipfileset dir="." includes="MANIFEST.MF" prefix="META-INF" />
<zipfileset dir="${out.classes.absolute.dir}"
includes="info/**"
excludes="**/BuildConfig.class" />
</zip>
</target>
<target name="release-all" depends="clean,release,javadoc,source" />
</project>