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

com.jetbrains.pluginverifier.options.PluginParsingConfigurationResolution.kt Maven / Gradle / Ivy

Go to download

Command-line interface for JetBrains Plugin Verifier with set of high-level tasks for plugin and IDE validation

There is a newer version: 1.379
Show newest version
package com.jetbrains.pluginverifier.options

import com.jetbrains.plugin.structure.intellij.problems.*
import com.jetbrains.plugin.structure.intellij.problems.remapping.ProblemLevelRemappingManager
import com.jetbrains.plugin.structure.intellij.problems.remapping.RemappingSet
import com.jetbrains.plugin.structure.intellij.problems.remapping.ignored.CliIgnoredProblemLevelRemappingManager
import com.jetbrains.pluginverifier.options.SubmissionType.EXISTING
import com.jetbrains.pluginverifier.options.SubmissionType.NEW

class PluginParsingConfigurationResolution {
  fun resolveProblemLevelMapping(configuration: PluginParsingConfiguration,
                                 problemLevelMappingManager: ProblemLevelRemappingManager
  ): PluginCreationResultResolver {
    val remappingSet = when (configuration.pluginSubmissionType) {
      EXISTING -> RemappingSet.EXISTING_PLUGIN_REMAPPING_SET
      NEW -> RemappingSet.NEW_PLUGIN_REMAPPING_SET
    }
    val defaultResolver = problemLevelMappingManager.newDefaultResolver(remappingSet)
    return JetBrainsPluginCreationResultResolver.fromClassPathJson(delegatedResolver = defaultResolver)
      .withCliIgnoredProblemResolver(configuration)
  }

  private fun PluginCreationResultResolver.withCliIgnoredProblemResolver(configuration: PluginParsingConfiguration): PluginCreationResultResolver {
    val cliIgnoredProblems = CliIgnoredProblemLevelRemappingManager(configuration.ignoredPluginProblems).asLevelRemappingDefinition()
    return LevelRemappingPluginCreationResultResolver(this, cliIgnoredProblems, unwrapRemappedProblems = true)
  }
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy