void (@Nullable final File libFile, @NotNull final LibraryData library, @NotNull final File gradleHomeDir, @NotNull final GradleVersion gradleVersion) { if (libFile == null || !libFile.getName().startsWith("gradle-")) return; if (!FileUtil.isAncestor(gradleHomeDir, libFile, true)) { File libFileParent = libFile.getParentFile(); if (libFileParent == null || !StringUtil.equals("generated-gradle-jars", libFileParent.getName())) return; if (("gradle-api-" + gradleVersion.getVersion() + ".jar").equals(libFile.getName())) { File gradleSrc = new File(gradleHomeDir, "src"); File[] gradleSrcRoots = gradleSrc.listFiles(); if (gradleSrcRoots == null) return; for (File srcRoot : gradleSrcRoots) { library.addPath(LibraryPathType.SOURCE, srcRoot.getPath()); } } return; } File libOrPluginsFile = libFile.getParentFile(); if (libOrPluginsFile != null && ("plugins".equals(libOrPluginsFile.getName()))) { libOrPluginsFile = libOrPluginsFile.getParentFile(); } if (libOrPluginsFile != null && "lib".equals(libOrPluginsFile.getName()) && libOrPluginsFile.getParentFile() != null) { File srcDir = new File(libOrPluginsFile.getParentFile(), "src"); if (gradleVersion.compareTo(GradleVersion.version("1.9")) >= 0) { int endIndex = libFile.getName().indexOf(gradleVersion.getVersion()); if (endIndex != -1) { String srcDirChild = libFile.getName().substring("gradle-".length(), endIndex - 1); srcDir = new File(srcDir, srcDirChild); } } if (srcDir.isDirectory()) { library.addPath(LibraryPathType.SOURCE, srcDir.getPath()); } } }