use of org.gradle.api.internal.tasks.compile.incremental.deps.ClassAnalysis in project gradle by gradle.
the class ClassFilesAnalyzer method visitFile.
@Override
public void visitFile(FileVisitDetails fileDetails) {
if (!fileDetails.getName().endsWith(".class")) {
return;
}
HashCode hash = hasher.hash(fileDetails);
ClassAnalysis analysis = analyzer.getClassAnalysis(hash, fileDetails);
accumulator.addClass(fileDetails.getFile(), analysis);
}
use of org.gradle.api.internal.tasks.compile.incremental.deps.ClassAnalysis in project gradle by gradle.
the class DefaultJarSnapshotter method createSnapshot.
public JarSnapshot createSnapshot(HashCode hash, JarArchive jarArchive) {
final Map<String, HashCode> hashes = Maps.newHashMap();
final ClassDependentsAccumulator accumulator = new ClassDependentsAccumulator();
jarArchive.contents.visit(new FileVisitor() {
public void visitDir(FileVisitDetails dirDetails) {
}
public void visitFile(FileVisitDetails fileDetails) {
if (!fileDetails.getName().endsWith(".class")) {
return;
}
HashCode classFileHash;
InputStream inputStream = fileDetails.open();
try {
classFileHash = hasher.hash(inputStream);
} finally {
try {
inputStream.close();
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
ClassAnalysis analysis = analyzer.getClassAnalysis(classFileHash, fileDetails);
accumulator.addClass(analysis);
hashes.put(analysis.getClassName(), classFileHash);
}
});
return new JarSnapshot(new JarSnapshotData(hash, hashes, accumulator.getAnalysis()));
}
Aggregations