PluginPlatformInfo (@NotNull Module module) { final PsiClass markerClass = JavaPsiFacade.getInstance(module.getProject()) .findClass(JBList.class.getName(), GlobalSearchScope.moduleWithDependenciesAndLibrariesScope(module, false)); if (markerClass == null) { return UNRESOLVED_INSTANCE; } final OrderEntry entry = LibraryUtil.findLibraryEntry(markerClass.getContainingFile().getVirtualFile(), module.getProject()); if ((!(entry instanceof LibraryOrderEntry))) { return UNRESOLVED_INSTANCE; } final String libraryName = entry.getPresentableName(); String version = StringUtil.substringAfterLast(libraryName, ":"); if (StringUtil.isEmpty(version)) { return UNRESOLVED_INSTANCE; } // Gradle using 'localPath': strip product prefix if (Character.isUpperCase(version.charAt(0))) { version = StringUtil.substringAfter(version, "-"); assert version != null; } if (version.contains("-")) { version = StringUtil.substringBefore(version, "-"); assert version != null; } String major = version.contains(".") ? StringUtil.substringBefore(version, ".") : version; if (major == null) { return UNRESOLVED_INSTANCE; } String branch; if (major.length() == 4 && version.length() >= 6) { version = StringUtil.replace(version, ".", "").substring(2); if (version.length() < 3) { return UNRESOLVED_INSTANCE; } branch = version.substring(0, 3); } else if (major.length() == 3) { branch = version; } else { return UNRESOLVED_INSTANCE; } final BuildNumber number = BuildNumber.fromStringOrNull(branch); if (number == null) { return UNRESOLVED_INSTANCE; } return new PluginPlatformInfo(PlatformResolveStatus.GRADLE, null, number); }