From a518599e27047549347ac58d66d66b7bfd27f988 Mon Sep 17 00:00:00 2001 From: Ryan Ernst Date: Sun, 20 Dec 2015 17:57:42 -0800 Subject: [PATCH] Allow plugins to upgrade slf4j-api to a compile dep This was originally intended to be general purpose in #15555, but that still had problems. Instead, this change fixes the issue explicitly for slf4j-api, since that is the problematic dep that is not actually included in the distributions. --- .../elasticsearch/gradle/plugin/PluginBuildPlugin.groovy | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/plugin/PluginBuildPlugin.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/plugin/PluginBuildPlugin.groovy index db3f3eca50a..042e8d22529 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/plugin/PluginBuildPlugin.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/plugin/PluginBuildPlugin.groovy @@ -22,6 +22,7 @@ import org.elasticsearch.gradle.BuildPlugin import org.elasticsearch.gradle.test.RestIntegTestTask import org.elasticsearch.gradle.test.RunTask import org.gradle.api.Project +import org.gradle.api.artifacts.Dependency import org.gradle.api.tasks.SourceSet import org.gradle.api.tasks.bundling.Zip @@ -100,6 +101,11 @@ public class PluginBuildPlugin extends BuildPlugin { from pluginMetadata // metadata (eg custom security policy) from project.jar // this plugin's jar from project.configurations.runtime - project.configurations.provided // the dep jars + // hack just for slf4j, in case it is "upgrade" from provided to compile, + // since it is not actually provided in distributions + from project.configurations.runtime.fileCollection { Dependency dep -> + return dep.name == 'slf4j-api' && project.configurations.compile.dependencies.contains(dep) + } // extra files for the plugin to go into the zip from('src/main/packaging') // TODO: move all config/bin/_size/etc into packaging from('src/main') {