[Android] gradle: use providers.exec to get the vlc-android git revision

Steve Lhomme git at videolan.org
Tue Feb 17 09:19:15 UTC 2026


vlc-android | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Thu Jul  3 10:24:27 2025 +0200| [422ddddb4c0b510cf9d8501d3697131a93e7ace3] | committer: Steve Lhomme

gradle: use providers.exec to get the vlc-android git revision

This is the preferred way to allow the configuration cache [^1].

[^1]: https://docs.gradle.org/8.14/userguide/configuration_cache.html#config_cache:requirements:external_processes

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

 application/vlc-android/build.gradle | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/application/vlc-android/build.gradle b/application/vlc-android/build.gradle
index af5e466e24..c8712d190a 100644
--- a/application/vlc-android/build.gradle
+++ b/application/vlc-android/build.gradle
@@ -6,6 +6,10 @@ plugins {
     id 'kotlin-parcelize'
 }
 
+def build_revision = providers.exec {
+    commandLine('git', 'rev-parse', '--short', 'HEAD')
+}.standardOutput.asText.get().trim()
+
 android {
 
     dataBinding {
@@ -22,7 +26,7 @@ android {
 
         resValue "string", "build_time", buildTime(project)
         resValue "string", "build_host", hostName(project)
-        resValue "string", "build_revision", revision()
+        resValue "string", "build_revision", build_revision
         resValue "string", "changelog", changelog()
         resValue "string", "dav1d_version", dav1dVersion()
         resValue 'string', 'tv_provider_authority', "${rootProject.ext.appId}.tv"
@@ -258,15 +262,6 @@ static def hostName(project) {
     return "${System.getProperty("user.name")}@${InetAddress.localHost.hostName}"
 }
 
-def revision() {
-    def code = new ByteArrayOutputStream()
-    exec {
-        commandLine 'git', 'rev-parse', '--short', 'HEAD'
-        standardOutput = code
-    }
-    return code.toString()
-}
-
 def dav1dVersion() {
     def code = "0.0.0"
     File dav1dContribFile = file('../../libvlcjni/vlc/contrib/src/dav1d/rules.mak')



More information about the Android mailing list