use of org.gradle.internal.hash.HashCode in project gradle by gradle.
the class JarSnapshot method affectedSince.
private DependentsSet affectedSince(JarSnapshot other) {
final Set<String> affected = new HashSet<String>();
for (Map.Entry<String, HashCode> otherClass : other.getHashes().entrySet()) {
String otherClassName = otherClass.getKey();
HashCode otherClassBytes = otherClass.getValue();
HashCode thisClsBytes = getHashes().get(otherClassName);
if (thisClsBytes == null || !thisClsBytes.equals(otherClassBytes)) {
// removed since or changed since
affected.add(otherClassName);
DependentsSet dependents = other.getAnalysis().getRelevantDependents(otherClassName, IntSets.EMPTY_SET);
if (dependents.isDependencyToAll()) {
return dependents;
}
affected.addAll(dependents.getDependentClasses());
}
}
return DependentsSet.dependents(affected);
}
use of org.gradle.internal.hash.HashCode in project gradle by gradle.
the class CacheBackedTaskHistoryRepository method collectActionImplementations.
private static ImmutableList<ImplementationSnapshot> collectActionImplementations(Collection<ContextAwareTaskAction> taskActions, ClassLoaderHierarchyHasher classLoaderHierarchyHasher) {
if (taskActions.isEmpty()) {
return ImmutableList.of();
}
ImmutableList.Builder<ImplementationSnapshot> actionImplementations = ImmutableList.builder();
for (ContextAwareTaskAction taskAction : taskActions) {
String typeName = taskAction.getActionClassName();
HashCode classLoaderHash = classLoaderHierarchyHasher.getClassLoaderHash(taskAction.getClassLoader());
actionImplementations.add(new ImplementationSnapshot(typeName, classLoaderHash));
}
return actionImplementations.build();
}
use of org.gradle.internal.hash.HashCode in project gradle by gradle.
the class CachingFileHasher method snapshot.
private FileInfo snapshot(File file, long length, long timestamp) {
String absolutePath = file.getAbsolutePath();
if (timestampInspector.timestampCanBeUsedToDetectFileChange(absolutePath, timestamp)) {
FileInfo info = cache.get(absolutePath);
if (info != null && length == info.length && timestamp == info.timestamp) {
return info;
}
}
HashCode hash = delegate.hash(file);
FileInfo info = new FileInfo(hash, length, timestamp);
cache.put(stringInterner.intern(absolutePath), info);
return info;
}
use of org.gradle.internal.hash.HashCode in project gradle by gradle.
the class DefaultHashingClassLoaderFactory method createChildClassLoader.
@Override
public ClassLoader createChildClassLoader(ClassLoader parent, ClassPath classPath, HashCode implementationHash) {
HashCode hashCode = implementationHash != null ? implementationHash : calculateClassLoaderHash(classPath);
ClassLoader classLoader = super.doCreateClassLoader(parent, classPath);
hashCodes.put(classLoader, hashCode);
return classLoader;
}
Aggregations