From 403619065cc76b08f64a17d4a60c6d3e8c0c5436 Mon Sep 17 00:00:00 2001 From: Ryan Kurtz Date: Wed, 28 Aug 2024 09:29:22 -0400 Subject: [PATCH] GP-0: Adding option to disable download progress output in fetchDependencies.gradle --- gradle/support/fetchDependencies.gradle | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/gradle/support/fetchDependencies.gradle b/gradle/support/fetchDependencies.gradle index 95a004a2b0..f0f7fda81b 100644 --- a/gradle/support/fetchDependencies.gradle +++ b/gradle/support/fetchDependencies.gradle @@ -51,6 +51,7 @@ ext.DOWNLOADS_DIR = file("${DEPS_DIR}/downloads") ext.FID_DIR = file("${DEPS_DIR}/fidb") ext.FLAT_REPO_DIR = file("${DEPS_DIR}/flatRepo") ext.OFFLINE = System.properties["offline"] != null +ext.HIDE_DOWNLOAD_PROGRESS = System.properties["hideDownloadProgress"] != null ext.createdDirs = [] as Set file("${REPO_DIR}/Ghidra/application.properties").withReader { reader -> @@ -275,17 +276,22 @@ def download(url, file) { def dataBuffer = new byte[1024]; int bytesRead; int totalRead; + if (HIDE_DOWNLOAD_PROGRESS) { + print " Downloading..." + } while ((bytesRead = istream.read(dataBuffer, 0, 1024)) != -1) { ostream.write(dataBuffer, 0, bytesRead); totalRead += bytesRead - print "\r" - print " Downloading: " + totalRead + " of " + size - if (!size.equals("???")) { - int pctComplete = (totalRead / size) * 100 - print " (" + pctComplete + "%)" + if (!HIDE_DOWNLOAD_PROGRESS) { + print "\r" + print " Downloading: " + totalRead + " of " + size + if (!size.equals("???")) { + int pctComplete = (totalRead / size) * 100 + print " (" + pctComplete + "%)" + } + print " " // overwrite gradle timer output + System.out.flush() } - print " " // overwrite gradle timer output - System.out.flush() } println() istream.close();