[Android] Fix the release CI to make the remote access version available

Nicolas Pomepuy git at videolan.org
Wed Jan 22 12:26:02 UTC 2025


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Wed Jan 22 07:33:17 2025 +0100| [5c4e12762b18b0c850bd7c9a751bb966d1889d89] | committer: Nicolas Pomepuy

Fix the release CI to make the remote access version available

> https://code.videolan.org/videolan/vlc-android/commit/5c4e12762b18b0c850bd7c9a751bb966d1889d89
---

 application/vlc-android/build.gradle               | 30 --------------------
 .../videolan/vlc/gui/dialogs/AboutVersionDialog.kt | 14 ++++++++--
 application/webserver/build.gradle                 | 32 ++++++++++++++++++++++
 3 files changed, 44 insertions(+), 32 deletions(-)

diff --git a/application/vlc-android/build.gradle b/application/vlc-android/build.gradle
index 7b62a53ae7..e37071da8a 100644
--- a/application/vlc-android/build.gradle
+++ b/application/vlc-android/build.gradle
@@ -22,8 +22,6 @@ android {
         resValue "string", "build_revision", revision()
         resValue "string", "changelog", changelog()
         resValue "string", "dav1d_version", dav1dVersion()
-        resValue "string", "remote_access_version", remoteAccessVersion()
-        resValue "string", "build_remote_access_revision", remoteAccessRevision()
         resValue 'string', 'tv_provider_authority', "${rootProject.ext.appId}.tv"
         buildConfigField 'String', 'LIBVLC_VERSION', "\"${rootProject.ext.libvlcVersion}\""
         buildConfigField 'String', 'ML_VERSION', "\"${rootProject.ext.medialibraryVersion}\""
@@ -263,34 +261,6 @@ def dav1dVersion() {
     return "0.0.0"
 }
 
-def remoteAccessVersion() {
-    def code = new ByteArrayOutputStream()
-    if (file("../../remoteaccess/package.json").exists()) {
-        try {
-            exec {
-                commandLine = ['bash', '-c', 'grep -m1 "version" ../../remoteaccess/package.json']
-                standardOutput = code
-            }
-            return code.toString().split("\"")[3]
-        } catch (Exception e) {
-        }
-    }
-    return "unknown"
-}
-
-def remoteAccessRevision() {
-    try {
-        def hash = new ByteArrayOutputStream()
-        exec {
-            commandLine = ['bash', '-c', 'git -C ../../remoteaccess rev-parse --short HEAD']
-            standardOutput = hash
-        }
-        return hash.toString()
-    } catch (Exception e) {
-    }
-    return "unknown"
-}
-
 /**
  * Generate a changelog string from the NEWS file
  * @return a string containing the latest changelog entry
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/dialogs/AboutVersionDialog.kt b/application/vlc-android/src/org/videolan/vlc/gui/dialogs/AboutVersionDialog.kt
index 712ca7c990..7096aa0c99 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/dialogs/AboutVersionDialog.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/dialogs/AboutVersionDialog.kt
@@ -22,6 +22,7 @@
 package org.videolan.vlc.gui.dialogs
 
 import android.content.pm.PackageManager
+import android.content.res.Resources
 import android.os.Build
 import android.os.Bundle
 import android.util.Log
@@ -29,6 +30,7 @@ import android.view.LayoutInflater
 import android.view.View
 import android.view.ViewGroup
 import com.google.android.material.bottomsheet.BottomSheetBehavior.STATE_EXPANDED
+import org.videolan.tools.resIdByName
 import org.videolan.vlc.BuildConfig
 import org.videolan.vlc.R
 import org.videolan.vlc.databinding.DialogAboutVersionBinding
@@ -74,8 +76,16 @@ class AboutVersionDialog : VLCBottomSheetDialogFragment() {
         binding.vlcRevision.text = getString(R.string.build_vlc_revision)
         binding.libvlcRevision.text = getString(R.string.build_libvlc_revision)
         binding.libvlcVersion.text = BuildConfig.LIBVLC_VERSION
-        binding.remoteAccessVersion.text = getString(R.string.remote_access_version)
-        binding.remoteAccessRevision.text = getString(R.string.build_remote_access_revision)
+        binding.remoteAccessVersion.text = try {
+            getString(requireActivity().resIdByName("remote_access_version", "string"))
+        } catch (e: Resources.NotFoundException) {
+            "unknown"
+        }
+        binding.remoteAccessRevision.text = try {
+            getString(requireActivity().resIdByName("build_remote_access_revision", "string"))
+        } catch (e: Resources.NotFoundException) {
+            "unknown"
+        }
         binding.compiledBy.text = getString(R.string.build_host)
         binding.moreButton.setOnClickListener {
             val whatsNewDialog = WhatsNewDialog()
diff --git a/application/webserver/build.gradle b/application/webserver/build.gradle
index 1820f7425a..589bf32145 100644
--- a/application/webserver/build.gradle
+++ b/application/webserver/build.gradle
@@ -23,6 +23,8 @@ android {
         testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
         consumerProguardFiles "consumer-rules.pro"
         buildConfigField 'Boolean', 'VLC_REMOTE_ACCESS_DEBUG', project.hasProperty("vlc_remote_access_debug") ? vlc_remote_access_debug : "false"
+        resValue "string", "build_remote_access_revision", remoteAccessRevision()
+        resValue "string", "remote_access_version", remoteAccessVersion()
 
     }
 
@@ -77,6 +79,36 @@ android {
     }
 }
 
+def remoteAccessVersion() {
+    def code = new ByteArrayOutputStream()
+    try {
+        if (file("../../remoteaccess/package.json").exists()) {
+
+            exec {
+                commandLine = ['bash', '-c', 'grep -m1 "version" ../../remoteaccess/package.json']
+                standardOutput = code
+            }
+            return code.toString().split("\"")[3]
+
+        }
+    } catch (Exception e) {
+    }
+    return "unknown"
+}
+
+def remoteAccessRevision() {
+    try {
+        def hash = new ByteArrayOutputStream()
+        exec {
+            commandLine = ['bash', '-c', 'git -C ../../remoteaccess rev-parse --short HEAD']
+            standardOutput = hash
+        }
+        return hash.toString()
+    } catch (Exception e) {
+    }
+    return "unknown"
+}
+
 preBuild.dependsOn(webCopy)
 
 dependencies {



More information about the Android mailing list