[tor-commits] [orbot/master] add custom ant rules for automating the release process

n8fr8 at torproject.org n8fr8 at torproject.org
Thu Jun 25 14:59:58 UTC 2015


commit 6775f86b6537d4485964f48f0a8c4aa22700e9b5
Author: Hans-Christoph Steiner <hans at eds.org>
Date:   Thu Jun 4 15:21:00 2015 -0400

    add custom ant rules for automating the release process
---
 custom_rules.xml |   57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 57 insertions(+)

diff --git a/custom_rules.xml b/custom_rules.xml
new file mode 100644
index 0000000..5f473de
--- /dev/null
+++ b/custom_rules.xml
@@ -0,0 +1,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>





More information about the tor-commits mailing list