in src/main/kotlin/org/jetbrains/intellij/platform/gradle/providers/ModuleDescriptorsValueSource.kt [31:64]
override fun obtain(): Set<Coordinates> {
val productInfo = parameters.intellijPlatformPath.asPath.productInfo()
val platformPath = parameters.intellijPlatformPath.asPath
val moduleDescriptorsFile = ModuleDescriptorsPathResolver(platformPath)
.runCatching { resolve() }
.getOrNull()
// Fallback to the hardcoded transitive dependencies list to be excluded if there's no `modules/module-descriptor.jar` file present to read from.
if (moduleDescriptorsFile == null) {
return fallbackExclusions + explicitExclusions
}
val collectedJars =
collectIntelliJPlatformJars(productInfo, platformPath)
.plus(collectBundledPluginsJars(platformPath))
.map { platformPath.relativize(it).invariantSeparatorsPathString }
val jarFile = JarFile(moduleDescriptorsFile.toFile())
return jarFile
.entries()
.asSequence()
.filter { it.name.endsWith(".xml") }
.map { jarFile.getInputStream(it) }
.mapNotNull { decode<ModuleDescriptor>(it) }
.map { it.path to Coordinates(it.groupId, it.artifactId) }
.groupBy(keySelector = { it.first }, valueTransform = { it.second })
.filterKeys { collectedJars.contains(it) }
.values
.flatten()
.toSet()
.plus(explicitExclusions)
}