[Android] Save build time and builder name via gradle

Geoffrey Métais git at videolan.org
Tue Feb 10 14:14:52 CET 2015


vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Feb 10 14:14:10 2015 +0100| [652642f8c857419c1cd990dc88b6230b9eb81105] | committer: Geoffrey Métais

Save build time and builder name via gradle

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=652642f8c857419c1cd990dc88b6230b9eb81105
---

 vlc-android/build.gradle                                |   11 +++++++++++
 vlc-android/src/org/videolan/vlc/gui/AboutFragment.java |    4 ++--
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/vlc-android/build.gradle b/vlc-android/build.gradle
index 887c26c..eca896b 100644
--- a/vlc-android/build.gradle
+++ b/vlc-android/build.gradle
@@ -16,6 +16,9 @@ android {
         minSdkVersion 7
         targetSdkVersion 21
 
+        resValue "string", "build_time", buildTime()
+        resValue "string", "build_host", hostName()
+
         //Set the build ABI according to build types
         tasks.whenTaskAdded { task ->
             if (task.name.startsWith('assemble')) {
@@ -173,3 +176,11 @@ dependencies {
     compile 'com.android.support:recyclerview-v7:21.0.+'
     tvCompile 'com.android.support:leanback-v17:21.0.+'
 }
+
+def buildTime() {
+    return new Date().format("yyyy-MM-dd", TimeZone.getTimeZone("UTC"))
+}
+
+def hostName() {
+    return System.getProperty("user.name") + "@" + InetAddress.localHost.hostName
+}
\ No newline at end of file
diff --git a/vlc-android/src/org/videolan/vlc/gui/AboutFragment.java b/vlc-android/src/org/videolan/vlc/gui/AboutFragment.java
index d1a0417..2aaad4e 100644
--- a/vlc-android/src/org/videolan/vlc/gui/AboutFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/AboutFragment.java
@@ -69,8 +69,8 @@ public class AboutFragment extends Fragment {
         TextView link = (TextView) v.findViewById(R.id.main_link);
         link.setText(Html.fromHtml(this.getString(R.string.about_link)));
 
-        String builddate = Util.readAsset("builddate.txt", "Unknown");
-        String builder = Util.readAsset("builder.txt", "unknown");
+        String builddate = getString(R.string.build_time);
+        String builder = getString(R.string.build_host);
 
         TextView compiled = (TextView) v.findViewById(R.id.main_compiled);
         compiled.setText(builder + " (" + builddate + ")");



More information about the Android mailing list