Collection<ModuleLookupResult> (String path) { List<ModuleLookupResult> results = new ArrayList<>(); GradleSourceSetData targetModule = Optional.ofNullable(resolverContext.getSettings()) .map(GradleExecutionSettings::getExecutionWorkspace) .map(ws -> ws.findModuleDataByArtifacts(Collections.singleton(new File(path)))) .filter(md -> md instanceof GradleSourceSetData) .map(GradleSourceSetData.class::cast) .orElse(null); if (targetModule != null) { return Collections.singleton(new ModuleLookupResult(new DataNode<>(GradleSourceSetData.KEY, targetModule, null), null)); } final String moduleId; final Pair<String, ExternalSystemSourceType> sourceTypePair = moduleOutputsMap.get(path); if (sourceTypePair != null) { moduleId = sourceTypePair.first; final Pair<DataNode<GradleSourceSetData>, ExternalSourceSet> pair = sourceSetMap.get(moduleId); if (pair != null) { return Collections.singleton(new ModuleLookupResult(pair.first, pair.second)); } } ModuleMappingInfo mapping = artifactsMap.getModuleMapping(path); if (mapping != null) { for (String id : mapping.getModuleIds()) { final Pair<DataNode<GradleSourceSetData>, ExternalSourceSet> pair = sourceSetMap.get(id); if (pair != null) { results.add(new ModuleLookupResult(pair.first, pair.second)); } } } return results; }