[Android] Gradle: don't use a UNIX shell to read the dav1d version

Steve Lhomme git at videolan.org
Fri May 23 05:08:56 UTC 2025


vlc-android | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Thu May 22 07:27:08 2025 +0200| [dcf5238e92d57b6b1f60f0608c29090a4dd61bb2] | committer: Steve Lhomme

Gradle: don't use a UNIX shell to read the dav1d version

We can use the gradle/java file classes.

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

 application/vlc-android/build.gradle | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/application/vlc-android/build.gradle b/application/vlc-android/build.gradle
index daf4a9edd7..e801cc74a8 100644
--- a/application/vlc-android/build.gradle
+++ b/application/vlc-android/build.gradle
@@ -267,15 +267,17 @@ def revision() {
 }
 
 def dav1dVersion() {
-    def code = new ByteArrayOutputStream()
-    if (file("../../libvlcjni/vlc/contrib/src/dav1d/rules.mak").exists()) {
-        exec {
-            commandLine 'bash', '-c', 'grep "DAV1D_VERSION := " ../../libvlcjni/vlc/contrib/src/dav1d/rules.mak | cut -d = -f2'
-            standardOutput = code
+    def code = "0.0.0"
+    File dav1dContribFile = file('../../libvlcjni/vlc/contrib/src/dav1d/rules.mak')
+    if (dav1dContribFile.exists()) {
+        dav1dContribFile.readLines().each {
+            if (it.contains('DAV1D_VERSION := ')) {
+                code = it.replaceAll("DAV1D_VERSION := ", "")
+                return
+            }
         }
-        return code.toString().replaceAll(" ", "")
     }
-    return "0.0.0"
+    return code
 }
 
 /**



More information about the Android mailing list