Modifying file contents on Zip tasks

Hi - I know what I’m doing can be done in separate steps, but just curious if there is a simpler way to achieve this via gradle.

I’m essentially trying to create an archive from a set of files, but as each file is added to the archive I would also like to manipulate the entire contents of the file.( I would actually like to gzip then base64 the file - please don’t ask why!)

tasks.add( name: "zip_foo", type: Zip) { task ->
   extension = 'zip'
   from "tmp/foo" {
      //filter - seems to work line by line - not sure if java.io.FilterReader can work on an entire file
   }
   eachFile { fileCopyDetails ->
      // i could get fileCopyDetails.getFile() and modify it, but might as well do that external to this task.
   }
}

Not sure if this can be done or not. I’d like to do this as a step when archiving as to preserver the original source.

Any help is appreciated.

Jules

For modifications other than filtering text files, it’s probably better to use a separate task.

Ok thanks. I’ll stop trying to jam the square peg in!