[gradle 1.6 and 1.7] dependency directory drops leading 0


(George Stockfisch) #1

I’m doing some reverse lookups in artifactory to get some info about an artifact that gradle downloads, as a dependency. It stores them in the ~/.gradle/caches directory, but the sha1sum is incorrect. It is storing the file

/home/gstockfisch/.gradle/caches/artifacts-26/filestore/my.group/cobbler/2.2.3-2.el6.noarch/rpm/1333834b9145c428d80a7bc7f19fc62ec469dab/cobbler-2.2.3-2.el6.noarch.rpm

Unfortunatly the sha1sum of that file is actually 01333834b9145c428d80a7bc7f19fc62ec469dab, with the leading 0, but the directory drops it. Is this intentional? Is there another way to get the sha1sum without calculating it on every file? I have some large files, so that could take a while.


#2

The Gradle cache layout is considered an implementation detail, and is not intended to serve as a source of SHA1 checksum data. The current scheme works, because it produces a unique value for any file, even if the leading zeros are truncated.

If you want to use the directory name as a quick method of determining artifact SHA1, you should be able to left-pad the directory name with zeros to a 40 character length.