For example in this forum post or there at stackoverflow …
At this point I don’t get the difference between incremental build and cache or let’s say, what “fingerprints” go into the cache or how and why is a task cachable or not.
We discussed in the Best Practice To Enable Incremental Build that generateProto should depend on the fetchProtoFiles via outputs and not plain dependsOn.
And all the files we are talking about, being it cloned, copied or auto-generated are localed in the build/ directory.
Exactly that folder is purged, when doing .gradlew cleanand thus onlyIf { targetFolder } will lead to execution of the fetchProtoFiles task, because targetFolder does not exists.
The same holds implicitely true for the generateProto-task, no? No source files from the targetFolder, no output of generated code, since the whole build/ folder is gone …
But … but … for any reason, guess that’s the caching mechanism, when building with --build-cache then purging the build/ directory does not affect the generateProto task. Although the source files as well as the generated java files based on the proto-files are gone, everything is gone … these information are stored in the cache?
So, if caching successfully prevents generateProto from runing again - which is awesome - then I guess it simply would make sense to also prevent the fetchProtoFiles task from running again, since generateProto, which depends on it, doesn’t need it - no? ![]()
Can we somehow manually add fetchProtoFiles to the cache?
Generally, I want to make usage of bitbucket’s caching. ![]()