All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.jetbrains.plugin.structure.ide.layout.PluginWithArtifactPathResult.kt Maven / Gradle / Ivy

There is a newer version: 3.289
Show newest version
package com.jetbrains.plugin.structure.ide.layout

import com.jetbrains.plugin.structure.base.problems.PluginProblem
import com.jetbrains.plugin.structure.intellij.plugin.IdePlugin
import org.slf4j.Logger
import java.nio.file.Path

internal sealed class PluginWithArtifactPathResult(open val pluginArtifactPath: Path) {
  data class Success(override val pluginArtifactPath: Path, val plugin: IdePlugin) :
    PluginWithArtifactPathResult(pluginArtifactPath)

  data class Failure(override val pluginArtifactPath: Path, val pluginProblems: List) : PluginWithArtifactPathResult(pluginArtifactPath)

  companion object {
    internal fun logFailures(
      log: Logger,
      failures: List,
      idePath: Path
    ) {
      if (failures.isNotEmpty()) {
        val failedPluginPaths = failures.map {
          idePath.relativize(it.pluginArtifactPath)
        }.joinToString(", ")
        log.atWarn().log("Following ${failures.size} plugins could not be created: $failedPluginPaths")
        if (log.isDebugEnabled) {
          buildString {
            failures
              .filterIsInstance()
              .forEach { (pluginArtifactPath, problems) ->
                append("Unable to load '")
                append(idePath.relativize(pluginArtifactPath)).append("': ")
                append(problems.joinToString("\n* ", "\n* "))
              }
          }.let { log.debug(it) }
        }
      }
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy