in src/main/kotlin/org/jetbrains/intellij/platform/gradle/artifacts/transform/CollectorTransformer.kt [54:99]
override fun transform(outputs: TransformOutputs) {
runCatching {
val path = inputArtifact.asPath
val plugin by lazy {
val pluginPath = path.resolvePluginPath()
manager.safelyCreatePlugin(pluginPath, suppressPluginProblems = true).getOrThrow()
}
val productInfo = runCatching { path.resolvePlatformPath().productInfo() }.getOrNull()
val isIntelliJPlatform = productInfo != null
val isPlugin = !isIntelliJPlatform && runCatching { plugin }.isSuccess
when {
isIntelliJPlatform -> {
requireNotNull(productInfo)
when (productInfo.type) {
IntelliJPlatformType.JetBrainsClient -> collectModuleDescriptorJars(productInfo, path)
else -> collectIntelliJPlatformJars(productInfo, path)
}.forEach {
outputs.file(it)
}
}
/**
* Normally, we get into here for third-party JetBrains Marketplace plugins.
* https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html#non-bundled-plugin
*
* For other plugins, we never (usually?) get into this block because their Ivy artifacts already list jars,
* instead of pointing to a directory, see: [org.jetbrains.intellij.platform.gradle.artifacts.LocalIvyArtifactPathComponentMetadataRule]
*/
isPlugin -> {
plugin.originalFile?.let { pluginPath ->
val jars = collectJars(pluginPath)
jars.forEach {
outputs.file(it)
}
}
}
else -> log.warn("Unknown input: $path")
}
}.onFailure {
log.error("${javaClass.canonicalName} execution failed.", it)
}.getOrThrow()
}