void (ProjectResolverContext context, File gradleUserHomeDir, LibraryData libraryData) { boolean sourceResolved = !libraryData.getPaths(LibraryPathType.SOURCE).isEmpty(); boolean docResolved = !libraryData.getPaths(LibraryPathType.DOC).isEmpty(); if (sourceResolved && docResolved) { return; } Map<String, Map<LibraryPathType, List<String>>> pathsCache = null; if (context != null) { // skip already processed libraries Set<LibraryData> libsCache = context.getUserData(LIBRARIES_CACHE); if (libsCache == null) { libsCache = context.putUserDataIfAbsent(LIBRARIES_CACHE, Collections.newSetFromMap(new IdentityHashMap<>())); } if (!libsCache.add(libraryData)) return; pathsCache = context.getUserData(PATHS_CACHE); if (pathsCache == null) pathsCache = context.putUserDataIfAbsent(PATHS_CACHE, new HashMap<>()); } for (String path : libraryData.getPaths(LibraryPathType.BINARY)) { if (!FileUtil.isAncestor(gradleUserHomeDir.getPath(), path, true)) continue; // take already processed paths from cache Map<LibraryPathType, List<String>> collectedPaths = pathsCache == null ? null : pathsCache.get(path); if (collectedPaths == null) { collectedPaths = new HashMap<>(); if (pathsCache != null) { pathsCache.put(path, collectedPaths); } if (path.contains("/caches/modules-2/files-2.1") || path.contains("/caches/transforms-")) { UnifiedCoordinates coordinates = getLibraryCoordinates(libraryData); Set<LibraryPathType> requiredComponentTypes = getRequiredComponentTypes(sourceResolved, docResolved); final Map<LibraryPathType, List<Path>> cachedComponents; if (coordinates != null) { cachedComponents = findArtifactComponents(coordinates, gradleUserHomeDir.toPath(), requiredComponentTypes); } else { cachedComponents = findAdjacentComponents(Paths.get(path), requiredComponentTypes); } mergeCollectedArtifacts(collectedPaths, cachedComponents); } else { collectSourcesAndJavadocsFromTheSameFolder(path, collectedPaths, sourceResolved, docResolved); } } for (Map.Entry<LibraryPathType, List<String>> each : collectedPaths.entrySet()) { for (String cachedPath : each.getValue()) { libraryData.addPath(each.getKey(), cachedPath); } } } }