in src/main/kotlin/org/jetbrains/intellij/platform/gradle/tasks/PrepareJarSearchableOptionsTask.kt [74:101]
fun prepareJarSearchableOptions() {
val pluginXml = FileSystems
.newFileSystem(composedJarFile.asPath, null as ClassLoader?)
.getPath("META-INF", "plugin.xml")
val pluginId = pluginXml.parse { id }
val modules = pluginXml.parse { pluginContent.flatMap { it.modules.map { module -> module.moduleName } } }
fileSystemOperations.sync {
from(inputDirectory)
into(outputDirectory)
include {
when {
it.isDirectory -> true
it.name.endsWith(pluginId + SEARCHABLE_OPTIONS_SUFFIX_JSON) -> true
it.name.substringAfter('-').removeSuffix(SEARCHABLE_OPTIONS_SUFFIX_JSON) in modules -> true
it.name.endsWith(SEARCHABLE_OPTIONS_SUFFIX_JSON) -> false
!it.name.endsWith(SEARCHABLE_OPTIONS_SUFFIX_XML) -> false
else -> libContainer.asPath.resolve(it.name.removeSuffix(SEARCHABLE_OPTIONS_SUFFIX_XML)).exists()
}
}
eachFile {
path = when {
name.endsWith(SEARCHABLE_OPTIONS_SUFFIX_JSON) -> name
else -> "search/$name"
}
}
}
}