This message was deleted.
# caching
s
This message was deleted.
e
It looks like I could use
upToDateWhen
i
Gradle automatically generates
clean
tasks when the outputs are set correctly
e.g. if your task is named
downloadFoo
, Gradle automatically generates
cleanDownloadFoo
, so you don't have to do anything to force the download (just tell the user to clean the task before running it again)
e
Yeah, but will it get it from cache or execute task again?
I probably just need to try and find out myself
👀 1
Unfortunately, it takes it from cache
v
Maybe it is not a good idea to cache task that downloads a file from a sever that could change?
You can just use
--rerun
on the task to not use the cached output
e
That is what I actually removed from my project 🙂
v
But why?
e
We used it just for downloading our files are super tiny
We don’t check the check sum
v
We used it just for downloading
Well, that is its sole functionality, so sounds like a perfect fit 😄
e
We don’t use it in parallel
Oke, the last benefit is concurrent executrion
e
if you get Gradle to download it like a normal artifact (e.g. set up an ivy "repository" in just the right way), you can set the resolution strategy's changing time
v
Or that, yeah
e
Let me state the problem - we have a manifest file that is json of bunch of different resources that is variable and not known on the build phase.
We load the manifest, check if it was changed, and if yes, we download files that are specified in manifest
e
example. Gradle will cache the manifest itself, and the task is also cached. if Gradle's cache expires (24 hours by default, or force it to be ignored with
--refresh-dependencies
), it'll re-download the manifest. if the file changes, then the task cache is invalidated and it'll be rerun.
e
Interesting! Let me check tomorrow and maybe rewrite our case
Thank you!
@ephemient that repository definition - does it work for any url? (Not just maven layout)
v
That was not maven Layout. And yes, any layout: https://ant.apache.org/ivy/history/master/concept.html#patterns
👍 1
e
Ah, for our resources even repository urls are different
e
that example doesn't use the Gradle repository or caches for the resources, only the manifest