[Android] buildsystem: avoid using bash to find a line in a JSON file
Steve Lhomme
git at videolan.org
Mon Jun 16 05:45:44 UTC 2025
vlc-android | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Thu Jun 12 15:18:38 2025 +0200| [b84b5f8582ee50d9f1192714c8d6ded4fb27e052] | committer: Steve Lhomme
buildsystem: avoid using bash to find a line in a JSON file
> https://code.videolan.org/videolan/vlc-android/commit/b84b5f8582ee50d9f1192714c8d6ded4fb27e052
---
application/remote-access-client/build.gradle | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/application/remote-access-client/build.gradle b/application/remote-access-client/build.gradle
index 42d94b57b6..99f6cf32c1 100644
--- a/application/remote-access-client/build.gradle
+++ b/application/remote-access-client/build.gradle
@@ -89,14 +89,14 @@ preBuild.dependsOn(webCopy)
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
+ File remoteAccessPackage = file("remoteaccess/package.json")
+ if (remoteAccessPackage.exists()) {
+ remoteAccessPackage.readLines().each {
+ if (it.contains('"version"')) {
+ code = it.split("\"")[3]
+ return
+ }
}
- return code.toString().split("\"")[3]
-
}
} catch (Exception e) {
}
More information about the Android
mailing list