Search in sources :

Example 1 with PropDepsPlugin

use of org.springframework.gradle.propdeps.PropDepsPlugin in project spring-security by spring-projects.

the class ManagementConfigurationPlugin method apply.

@Override
public void apply(Project project) {
    ConfigurationContainer configurations = project.getConfigurations();
    configurations.create(MANAGEMENT_CONFIGURATION_NAME, (management) -> {
        management.setVisible(false);
        management.setCanBeConsumed(false);
        management.setCanBeResolved(false);
        PluginContainer plugins = project.getPlugins();
        plugins.withType(JavaPlugin.class, (javaPlugin) -> {
            configurations.getByName(JavaPlugin.COMPILE_CLASSPATH_CONFIGURATION_NAME).extendsFrom(management);
            configurations.getByName(JavaPlugin.RUNTIME_CLASSPATH_CONFIGURATION_NAME).extendsFrom(management);
            configurations.getByName(JavaPlugin.TEST_COMPILE_CLASSPATH_CONFIGURATION_NAME).extendsFrom(management);
            configurations.getByName(JavaPlugin.TEST_RUNTIME_CLASSPATH_CONFIGURATION_NAME).extendsFrom(management);
        });
        plugins.withType(JavaTestFixturesPlugin.class, (javaTestFixturesPlugin) -> {
            configurations.getByName("testFixturesCompileClasspath").extendsFrom(management);
            configurations.getByName("testFixturesRuntimeClasspath").extendsFrom(management);
        });
        plugins.withType(MavenPublishPlugin.class, (mavenPublish) -> {
            PublishingExtension publishing = project.getExtensions().getByType(PublishingExtension.class);
            publishing.getPublications().withType(MavenPublication.class, (mavenPublication -> {
                mavenPublication.versionMapping((versions) -> versions.allVariants(versionMapping -> versionMapping.fromResolutionResult()));
            }));
        });
        plugins.withType(PropDepsPlugin.class, (propDepsPlugin -> {
            configurations.getByName("optional").extendsFrom(management);
            configurations.getByName("provided").extendsFrom(management);
        }));
    });
}
Also used : PublishingExtension(org.gradle.api.publish.PublishingExtension) Project(org.gradle.api.Project) ConfigurationContainer(org.gradle.api.artifacts.ConfigurationContainer) MavenPublishPlugin(org.gradle.api.publish.maven.plugins.MavenPublishPlugin) JavaTestFixturesPlugin(org.gradle.api.plugins.JavaTestFixturesPlugin) PropDepsPlugin(org.springframework.gradle.propdeps.PropDepsPlugin) PluginContainer(org.gradle.api.plugins.PluginContainer) JavaPlugin(org.gradle.api.plugins.JavaPlugin) MavenPublication(org.gradle.api.publish.maven.MavenPublication) Plugin(org.gradle.api.Plugin) PluginContainer(org.gradle.api.plugins.PluginContainer) ConfigurationContainer(org.gradle.api.artifacts.ConfigurationContainer) PublishingExtension(org.gradle.api.publish.PublishingExtension)

Aggregations

Plugin (org.gradle.api.Plugin)1 Project (org.gradle.api.Project)1 ConfigurationContainer (org.gradle.api.artifacts.ConfigurationContainer)1 JavaPlugin (org.gradle.api.plugins.JavaPlugin)1 JavaTestFixturesPlugin (org.gradle.api.plugins.JavaTestFixturesPlugin)1 PluginContainer (org.gradle.api.plugins.PluginContainer)1 PublishingExtension (org.gradle.api.publish.PublishingExtension)1 MavenPublication (org.gradle.api.publish.maven.MavenPublication)1 MavenPublishPlugin (org.gradle.api.publish.maven.plugins.MavenPublishPlugin)1 PropDepsPlugin (org.springframework.gradle.propdeps.PropDepsPlugin)1