Source:
private List<Dependency> calculateDependencies(Project project) throws Exception { Set<Configuration> configurationSet = project.getConfigurations(); List<Dependency> dependencies = newArrayList(); for (Configuration configuration : configurationSet) { DefaultConfiguration defaultConfiguration = (DefaultConfiguration) configuration; if (defaultConfiguration.getResolvedState().compareTo(ConfigurationInternal.InternalState.GRAPH_RESOLVED) < 0) { log.info("Artifacts for configuration '{}' were not all resolved, skipping", configuration.getName()); continue; } ResolvedConfiguration resolvedConfiguration = SingleMessageLogger.whileDisabled(() -> configuration.getResolvedConfiguration()); Set<ResolvedArtifact> resolvedArtifactSet = resolvedConfiguration.getResolvedArtifacts(); for (final ResolvedArtifact artifact : resolvedArtifactSet) { File file = artifact.getFile(); if (file != null && file.exists()) { ModuleVersionIdentifier id = artifact.getModuleVersion().getId(); final String depId = getModuleIdString(id.getGroup(), id.getName(), id.getVersion()); Predicate<Dependency> idEqualsPredicate = new Predicate<Dependency>() { public boolean apply(@Nullable Dependency input) { return input.getId().equals(depId); } }; if (any(dependencies, idEqualsPredicate)) { Dependency existingDependency = find(dependencies, idEqualsPredicate); Set<String> existingScopes = existingDependency.getScopes(); existingScopes.add(configuration.getName()); existingDependency.setScopes(existingScopes); } else { DependencyBuilder dependencyBuilder = new DependencyBuilder() .type(getTypeString(artifact.getType(), artifact.getClassifier(), artifact.getExtension())) .id(depId) .scopes(Sets.newHashSet(configuration.getName())); if (file.isFile()) { Map<String, String> checksums = FileChecksumCalculator.calculateChecksums(file, MD5, SHA1); dependencyBuilder.md5(checksums.get(MD5)).sha1(checksums.get(SHA1)); } dependencies.add(dependencyBuilder.build()); } } } } return dependencies; }

Target:
private List<Dependency> calculateDependencies(Project project) throws Exception { Set<Configuration> configurationSet = project.getConfigurations(); List<Dependency> dependencies = newArrayList(); for (Configuration configuration : configurationSet) { DefaultConfiguration defaultConfiguration = (DefaultConfiguration) configuration; if (defaultConfiguration.getResolvedState().compareTo(ConfigurationInternal.InternalState.GRAPH_RESOLVED) < 0) { log.info("Artifacts for configuration '{}' were not all resolved, skipping", configuration.getName()); continue; } ResolvedConfiguration resolvedConfiguration = SingleMessageLogger.whileDisabled(configuration::getResolvedConfiguration); Set<ResolvedArtifact> resolvedArtifactSet = resolvedConfiguration.getResolvedArtifacts(); for (final ResolvedArtifact artifact : resolvedArtifactSet) { File file = artifact.getFile(); if (file != null && file.exists()) { ModuleVersionIdentifier id = artifact.getModuleVersion().getId(); final String depId = getModuleIdString(id.getGroup(), id.getName(), id.getVersion()); Predicate<Dependency> idEqualsPredicate = new Predicate<Dependency>() { public boolean apply(@Nullable Dependency input) { return input.getId().equals(depId); } }; if (any(dependencies, idEqualsPredicate)) { Dependency existingDependency = find(dependencies, idEqualsPredicate); Set<String> existingScopes = existingDependency.getScopes(); existingScopes.add(configuration.getName()); existingDependency.setScopes(existingScopes); } else { DependencyBuilder dependencyBuilder = new DependencyBuilder() .type(getTypeString(artifact.getType(), artifact.getClassifier(), artifact.getExtension())) .id(depId) .scopes(Sets.newHashSet(configuration.getName())); if (file.isFile()) { Map<String, String> checksums = FileChecksumCalculator.calculateChecksums(file, MD5, SHA1); dependencyBuilder.md5(checksums.get(MD5)).sha1(checksums.get(SHA1)); } dependencies.add(dependencyBuilder.build()); } } } } return dependencies; }