Open
Description
Describe the bug
If the URL has changed but the destination path hasn't then the existing destination file should be ignored for the purposes of onlyIfModified
. Otherwise, if the timestamp of the new URL is older than the existing download, it will be skipped and you'll continue using the wrong download.
Sample build script
plugins {
id 'de.undercouch.download' version '5.5.0'
}
def welcomeScreenVersion = '6.46.0'
tasks.register('downloadWelcomeScreen', Download) {
src "https://github.com/endlessm/kolibri-explore-plugin/releases/download/v${welcomeScreenVersion}/welcome-screen.zip"
dest layout.buildDirectory.file('welcome-screen.zip')
onlyIfModified true
}
tasks.register('clean', Delete) {
delete buildDir
}
If I run the task and then change welcomeScreenVersion
to 6.44.0
, the task is skipped:
$ ls -l build/welcome-screen.zip
-rw-rw-r-- 1 dan dan 5336916 Sep 12 16:32 build/welcome-screen.zip
$ ./gradlew -i downloadWelcomeScreen
...
> Task :downloadWelcomeScreen UP-TO-DATE
Caching disabled for task ':downloadWelcomeScreen' because:
Build cache is disabled
Task ':downloadWelcomeScreen' is not up-to-date because:
Task.upToDateWhen is false.
Watching 3 directories to track changes
Download https://github.com/endlessm/kolibri-explore-plugin/releases/download/v6.44.0/welcome-screen.zip
Not modified. Skipping 'https://github.com/endlessm/kolibri-explore-plugin/releases/download/v6.44.0/welcome-screen.zip'
Watching 4 directories to track changes
BUILD SUCCESSFUL in 1s
1 actionable task: 1 up-to-date
$ ls -l build/welcome-screen.zip
-rw-rw-r-- 1 dan dan 5336916 Sep 12 16:32 build/welcome-screen.zip
Activity