use of org.gradle.internal.hash.Hasher in project gradle by gradle.
the class DefaultScriptSourceHasher method hash.
@Override
public HashCode hash(ScriptSource scriptSource) {
TextResource resource = scriptSource.getResource();
File file = resource.getFile();
if (file != null) {
try {
return fileHasher.hash(file);
} catch (UncheckedIOException e) {
if (e.getCause() instanceof FileNotFoundException) {
throw new UncheckedIOException("Could not read " + scriptSource.getDisplayName() + " as it does not exist.", e.getCause());
}
throw e;
}
}
Hasher hasher = contentHasherFactory.create();
hasher.putString(resource.getText());
return hasher.hash();
}
use of org.gradle.internal.hash.Hasher in project gradle by gradle.
the class DefaultHashingClassLoaderFactory method calculateFilterSpecHash.
private static HashCode calculateFilterSpecHash(FilteringClassLoader.Spec spec) {
Hasher hasher = Hashing.md5().newHasher();
addToHash(hasher, spec.getClassNames());
addToHash(hasher, spec.getPackageNames());
addToHash(hasher, spec.getPackagePrefixes());
addToHash(hasher, spec.getResourcePrefixes());
addToHash(hasher, spec.getResourceNames());
addToHash(hasher, spec.getDisallowedClassNames());
addToHash(hasher, spec.getDisallowedPackagePrefixes());
return hasher.hash();
}
Aggregations