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

main.name.remal.gradle_plugins.plugins.dependencies.DependenciesModifierPlugin.kt Maven / Gradle / Ivy

There is a newer version: 1.9.2
Show newest version
package name.remal.gradle_plugins.plugins.dependencies

import name.remal.gradle_plugins.dsl.BaseReflectiveProjectPlugin
import name.remal.gradle_plugins.dsl.Plugin
import name.remal.gradle_plugins.dsl.PluginAction
import name.remal.loadServicesList
import org.gradle.api.artifacts.ConfigurationContainer

@Plugin(
    id = "name.remal.dependencies-modifier",
    description = "Plugin that modifies dependencies.",
    tags = ["common", "dependencies"]
)
class DependenciesModifierPlugin : BaseReflectiveProjectPlugin() {

    companion object {
        private val dependencyModifiers = loadServicesList(DependencyModifier::class.java)
    }

    @PluginAction
    fun ConfigurationContainer.`Modify dependencies of all configurations`() {
        if (dependencyModifiers.isNotEmpty()) {
            all {
                it.dependencies.all { dep ->
                    dependencyModifiers.forEach { it.modify(dep) }
                }
            }
        }
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy