How to obtain file hashes generated by Gradle?

The manual says nothing, the source code is nowhere to be found (even grepcode seems to only know some bits of Gradle’s code but not the others). Google isn’t helping either.
I would be happy right now to get a specific answer to my question, but I’d be even happier if there was a way to find answers to the question like this w/o invoking forums and personalized communication in general.

Because there is no public API to do that. The fact that Gradle uses hashes is an implementation detail.

Is this supposed to be helpful?

I answered your question and pointed you to the source code that you said you couldn’t find.

If you want more help, you should start with describing the problem you are trying to solve.

Hi wvxvw,

The hashes are not advertised feature of Gradle, but a mechanism to implement the up-to-date checks (which are documented and supported feature).

In practice, it doesn’t take much digging to find that the hashes are stored in <project-root>/.gradle/<version>/taskArtifacts using proprietary binary format. The <version> in the path implies that the format may change with each Gradle release, and is part of Gradle’s internal structures. Searching the Github project which Stefan pointed you to for taskArtifacts and filtering for Java classes finds you the internal API which you should not rely on. FWIW, a future version of Gradle may even stop using hashes and do a rebuild on first run and rely on INOTIFY afterwards.

Finally, despite Stefan being terse, he did answer your questions, while your reply has been less than civil. With this kind of attitude, you can expect you will be generally dismissed you and it wouldn’t matter much how much do you have to give to the world.

3 Likes

Proprietary binary format? In an “open-source” project? LOL! Oh, I’m so
happy I’m not going to touch this crap ever again!