so Gradle obviously has some support for gzip. However I’m trying to write a Gradle task that simply decompresses a flat gzipped text file, and I’m stuck.
Of course I can do
commandLine 'gunzip', '-k', 'textfile.gz'
and it works (at least under unix) but that’s hardly elegant.
As per the Gradle Build Language Reference and Javadoc, ‘project.resources.gzip(‘textfile.gz’).read()’ should give you an ‘InputStream’. Have you tried that?
I was unaware of this .text functionality. However I suspect it may not be a good idea for me because some of the gzip files are huge (some 250MB, some larger.) Does resources.gzip(‘test.txt.gz’).read().text attempt to load the entire thing into memory?
I was expecting there would be some solution of the form
task unzipTheFile(type: Copy) {
def gzipFile = ...
def parentDir = ...
from gzipFile
into parentDir
}
but perhaps there is not. Everything I’ve tried along those lines has failed, but I’m new at this.