]> git.saurik.com Git - backport.git/commitdiff
Generate the AndroidManifest using git revisions.
authorJay Freeman (saurik) <saurik@saurik.com>
Sun, 21 Jul 2013 05:04:58 +0000 (22:04 -0700)
committerJay Freeman (saurik) <saurik@saurik.com>
Sun, 21 Jul 2013 05:04:58 +0000 (22:04 -0700)
.gitignore
AndroidManifest.xml [deleted file]
AndroidManifest.xml.in [new file with mode: 0644]
manifest.sh [new file with mode: 0755]

index 5959f86dae3160e53778cd8f05dbc299e20832ef..064f3aa110c2870bbfb8b6723e19b474f5225f7b 100644 (file)
@@ -1,3 +1,4 @@
+AndroidManifest.xml
 ant.properties
 bin
 gen
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
deleted file mode 100644 (file)
index 2c06657..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="com.saurik.backport"
-    android:versionCode="1"
-    android:versionName="1.0"
->
-    <application android:label="Backport" >
-        <meta-data android:name="com.saurik.substrate.main" android:value=".Hook"/>
-    </application>
-
-    <uses-sdk android:minSdkVersion="9" android:targetSdkVersion="17"/>
-    <uses-permission android:name="cydia.permission.SUBSTRATE"/>
-</manifest> 
diff --git a/AndroidManifest.xml.in b/AndroidManifest.xml.in
new file mode 100644 (file)
index 0000000..8df4690
--- /dev/null
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="com.saurik.backport"
+    android:versionCode="${monotonic}"
+    android:versionName="${version}"
+>
+    <application android:label="Backport">
+        <meta-data android:name="com.saurik.substrate.main" android:value=".Hook"/>
+    </application>
+
+    <uses-sdk android:minSdkVersion="9" android:targetSdkVersion="17"/>
+    <uses-permission android:name="cydia.permission.SUBSTRATE"/>
+</manifest>
diff --git a/manifest.sh b/manifest.sh
new file mode 100755 (executable)
index 0000000..7917bd9
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+set -e
+
+if [[ $# -eq 0 ]]; then
+    flags=(--dirty="+")
+else
+    flags=("$@")
+fi
+
+monotonic=$(git log -1 --pretty=format:%ct)
+version=$(git describe --tags --match="v*" "${flags[@]}" | sed -e 's@-\([^-]*\)-\([^-]*\)$@+\1.\2@;s@^v@@;s@%@~@g')
+
+exec sed -e "
+    s/\${monotonic}/${monotonic}/g;
+    s/\${version}/${version}/g;
+" AndroidManifest.xml.in >AndroidManifest.xml