main.name.remal.gradle_plugins.plugins.dependencies.TransitiveDependenciesExtension.kt Maven / Gradle / Ivy
package name.remal.gradle_plugins.plugins.dependencies
import name.remal.Ordered
import name.remal.buildMap
import name.remal.concurrentSetOf
import name.remal.gradle_plugins.api.AutoService
import name.remal.gradle_plugins.dsl.Extension
import name.remal.gradle_plugins.dsl.extensions.getOrNull
import name.remal.gradle_plugins.dsl.extensions.sourceSetConfigurationNames
import name.remal.loadServicesList
import org.gradle.api.Project
import org.gradle.api.artifacts.Configuration
import org.gradle.api.artifacts.ConfigurationContainer
import org.gradle.api.artifacts.ExcludeRule.GROUP_KEY
import org.gradle.api.artifacts.ExcludeRule.MODULE_KEY
import org.gradle.api.artifacts.ExternalDependency
import org.gradle.api.tasks.SourceSetContainer
@Extension
class TransitiveDependenciesExtension(
private val project: Project,
private val configurations: ConfigurationContainer
) {
companion object {
private val transitiveDependenciesConfigurationMatchers = loadServicesList(TransitiveDependenciesConfigurationMatcher::class.java)
private val staticAnalysisTransitiveDependencies = loadServicesList(StaticAnalysisTransitiveDependencies::class.java)
}
private val matchers = transitiveDependenciesConfigurationMatchers.toMutableList()
fun addConfigurationToProcess(vararg configurationNames: String) {
val configurationNamesSet = configurationNames.toSet()
matchers.add(object : TransitiveDependenciesConfigurationMatcher {
override fun matches(project: Project, configuration: Configuration) = configuration.name in configurationNamesSet
})
}
fun addConfigurationToProcess(vararg configurations: Configuration) = addConfigurationToProcess(*configurations.map(Configuration::getName).toTypedArray())
private val appliedExcludeProperties = concurrentSetOf
© 2015 - 2024 Weber Informatics LLC | Privacy Policy