forked from guardianproject/orbot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
custom_rules.xml
57 lines (53 loc) · 2.43 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
<?xml version="1.0" encoding="UTF-8"?>
<project>
<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>
</target>
<target name="rename-release-with-version-number" depends="-getgitdetails">
<xmlproperty file="AndroidManifest.xml"
prefix="themanifest"
collapseAttributes="true"/>
<!-- see ${sdk.dir}/tools/ant/build.xml -set-release-mode -->
<property name="out.packaged.file"
location="${out.absolute.dir}/${ant.project.name}-v${git.describe}-unsigned.apk" />
<property name="out.final.file"
location="${out.absolute.dir}/${ant.project.name}-v${git.describe}.apk" />
</target>
<target name="-set-release-mode"
depends="rename-release-with-version-number,android_rules.-set-release-mode">
<echo message="target: ${build.target}"></echo>
</target>
<target name="-post-package" depends="-getgitdetails">
<property file="${sdk.dir}/tools/source.properties"/>
<property name="meta.inf.dir" value="${out.dir}/META-INF"/>
<property name="build.manifest.file" value="${meta.inf.dir}/BUILD.MF"/>
<mkdir dir="${meta.inf.dir}"/>
<manifest file="${build.manifest.file}">
<attribute name="Implementation-Package-Name" value="${themanifest.manifest.package}"/>
<attribute name="Implementation-Version-Name" value="${themanifest.manifest.android:versionName}"/>
<attribute name="Implementation-Version-Code" value="${themanifest.manifest.android:versionCode}"/>
<attribute name="Git-Revision" value="${git.revision}"/>
<attribute name="Android-SDK-Release" value="${Pkg.Revision}"/>
<attribute name="Android-SDK-Host-OS" value="${Archive.HostOs}"/>
<attribute name="Android-SDK-aapt" value="${aapt}"/>
<attribute name="Android-SDK-zipalign" value="${zipalign}"/>
</manifest>
<condition property="build.is.debug" value="true" else="false">
<equals arg1="${build.target}" arg2="debug" />
</condition>
<!-- adding BUILD.MF breaks debug builds, but not releases -->
<if condition="${build.is.debug}">
<else>
<jar update="true" destfile="${out.packaged.file}">
<fileset dir="${out.dir}" includes="META-INF/BUILD.MF"/>
</jar>
</else>
</if>
</target>
</project>