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

com.jetbrains.plugin.structure.intellij.verifiers.DependenciesVerifiers.kt Maven / Gradle / Ivy

Go to download

Library for parsing JetBrains IDE plugins. Can be used to verify that plugin complies with the JetBrains Marketplace requirements.

There is a newer version: 3.290
Show newest version
package com.jetbrains.plugin.structure.intellij.verifiers

import com.jetbrains.plugin.structure.base.problems.PluginProblem
import com.jetbrains.plugin.structure.base.problems.ReusedDescriptorInMultipleDependencies
import com.jetbrains.plugin.structure.intellij.beans.PluginDependencyBean

/**
 * Validates if each dependency in `` provides a unique `config-file`, if such file is declared.
 *
 * Multiple dependencies specified in the same plugin descriptor cannot redeclare same `config-file`.
 */
class ReusedDescriptorVerifier(private val descriptorPath: String? = null) {
  fun verify(dependencies: Collection, problemConsumer: (PluginProblem) -> Unit) {
    dependencies.groupBy { it.configFile }
            .filterKeys { it != null }
            .filterValues { it.size > 1 }
            .forEach { (configFile, dependencies) ->
              val dependencyIdentifiers = dependencies.map { it.dependencyId }
              problemConsumer(ReusedDescriptorInMultipleDependencies(descriptorPath, configFile, dependencyIdentifiers))
            }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy