Question

Using Gradle I want to:

  1. copy a ZIP to a target network machine
  2. extract the ZIP on the target
  3. delete the ZIP from the target

The assumption is that it is faster to copy the ZIP file over than lots of little files. I achieve this with the following script:

copy {
    from (srcZipFile)
    into (destZipDir)
}
copy {
    from zipTree(destZipFile)
    into (destZipDir)
}
delete {destZipFile}

However, after some profiling this does not seem to be working correctly. These are my results:

  1. copy of ZIP file +- 16s
  2. extracting ZIP from source machine to target +- 1m07s
  3. extracting ZIP on target machine (copy inclusive) +- 1m25s

It would seem to me that it is copying the ZIP from the source machine to the target machine, though it seems that the extraction is happening on the source machine and being copied over to the target machine.

Is there any way to get Gradle to extract the ZIP on the target machine?

Was it helpful?

Solution

Is there any way to get Gradle to extract the ZIP on the target machine?

You'd have to execute Gradle on the target machine (for step 3), or use some remote execution facility (e.g. SSH) from the Gradle build on the source machine. (If SSH is an option, there is a nifty third-party SSH plugin for Gradle.)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top