[Android] gradle: use providers.exec to get the remote access 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:47:54 2025 +0200| [bad5cfc4689a48a6d75e6d68faee3d069afc1810] | committer: Steve Lhomme

gradle: use providers.exec to get the remote access 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/bad5cfc4689a48a6d75e6d68faee3d069afc1810
---

 application/remote-access-client/build.gradle | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)

diff --git a/application/remote-access-client/build.gradle b/application/remote-access-client/build.gradle
index 5fa0c30aa1..514f074bcc 100644
--- a/application/remote-access-client/build.gradle
+++ b/application/remote-access-client/build.gradle
@@ -32,13 +32,19 @@ ext {
     library_version = "$rootProject.ext.remoteAccessVersion"
 }
 
+File remoteAccessPackage = file("remoteaccess/package.json")
+def remoteAccessRevision = remoteAccessPackage.exists() ? providers.exec {
+    workingDir('remoteaccess')
+    commandLine('git', 'rev-parse', '--short', 'HEAD')
+}.standardOutput.asText.get().trim() : 'unknown'
+
 android {
     namespace = 'org.videolan.vlc.remoteaccessclient'
 
     defaultConfig {
         testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
         consumerProguardFiles "consumer-rules.pro"
-        resValue "string", "build_remote_access_revision", remoteAccessRevision()
+        resValue "string", "build_remote_access_revision", remoteAccessRevision
         resValue "string", "remote_access_version", remoteAccessVersion()
     }
 
@@ -99,18 +105,6 @@ def remoteAccessVersion() {
     return "unknown"
 }
 
-def remoteAccessRevision() {
-    try {
-        def hash = new ByteArrayOutputStream()
-        exec {
-            commandLine 'git', '-C', 'remoteaccess', 'rev-parse', '--short', 'HEAD'
-            standardOutput = hash
-        }
-        return hash.toString()
-    } catch (Exception e) {
-    }
-    return "unknown"
-}
 
 dependencies {
 



More information about the Android mailing list