Search in sources :

Example 1 with DownloadAction

use of de.undercouch.gradle.tasks.download.DownloadAction in project zaproxy by zaproxy.

the class DownloadAddOns method downloadFile.

private void downloadFile(AddOnDownloadData downloadData) throws IOException {
    File file = downloadData.getOutputFile();
    DownloadAction downloadAction = new DownloadAction(getProject());
    downloadAction.src(downloadData.getUrl());
    downloadAction.dest(file);
    downloadAction.execute();
    String computedHash = hash(file);
    if (!computedHash.equalsIgnoreCase(downloadData.getHash())) {
        throw new IOException("Hash mismatch for file " + file + " expected " + downloadData.getHash() + " but got " + computedHash);
    }
}
Also used : DownloadAction(de.undercouch.gradle.tasks.download.DownloadAction) IOException(java.io.IOException) File(java.io.File) InputFile(org.gradle.api.tasks.InputFile)

Aggregations

DownloadAction (de.undercouch.gradle.tasks.download.DownloadAction)1 File (java.io.File)1 IOException (java.io.IOException)1 InputFile (org.gradle.api.tasks.InputFile)1