|
@@ -79,8 +79,9 @@ class BuildPlugin implements Plugin<Project> {
|
|
|
}
|
|
|
project.pluginManager.apply('java')
|
|
|
project.pluginManager.apply('carrotsearch.randomized-testing')
|
|
|
- // these plugins add lots of info to our jars
|
|
|
+ configureConfigurations(project)
|
|
|
configureJars(project) // jar config must be added before info broker
|
|
|
+ // these plugins add lots of info to our jars
|
|
|
project.pluginManager.apply('nebula.info-broker')
|
|
|
project.pluginManager.apply('nebula.info-basic')
|
|
|
project.pluginManager.apply('nebula.info-java')
|
|
@@ -91,8 +92,8 @@ class BuildPlugin implements Plugin<Project> {
|
|
|
|
|
|
globalBuildInfo(project)
|
|
|
configureRepositories(project)
|
|
|
- configureConfigurations(project)
|
|
|
project.ext.versions = VersionProperties.versions
|
|
|
+ configureSourceSets(project)
|
|
|
configureCompile(project)
|
|
|
configureJavadoc(project)
|
|
|
configureSourcesJar(project)
|
|
@@ -421,8 +422,10 @@ class BuildPlugin implements Plugin<Project> {
|
|
|
project.configurations.compile.dependencies.all(disableTransitiveDeps)
|
|
|
project.configurations.testCompile.dependencies.all(disableTransitiveDeps)
|
|
|
project.configurations.compileOnly.dependencies.all(disableTransitiveDeps)
|
|
|
+
|
|
|
project.plugins.withType(ShadowPlugin).whenPluginAdded {
|
|
|
- project.configurations.shadow.dependencies.all(disableTransitiveDeps)
|
|
|
+ Configuration bundle = project.configurations.create('bundle')
|
|
|
+ bundle.dependencies.all(disableTransitiveDeps)
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -556,30 +559,6 @@ class BuildPlugin implements Plugin<Project> {
|
|
|
publications {
|
|
|
nebula(MavenPublication) {
|
|
|
artifacts = [ project.tasks.shadowJar ]
|
|
|
- artifactId = project.archivesBaseName
|
|
|
- /*
|
|
|
- * Configure the pom to include the "shadow" as compile dependencies
|
|
|
- * because that is how we're using them but remove all other dependencies
|
|
|
- * because they've been shaded into the jar.
|
|
|
- */
|
|
|
- pom.withXml { XmlProvider xml ->
|
|
|
- Node root = xml.asNode()
|
|
|
- root.remove(root.dependencies)
|
|
|
- Node dependenciesNode = root.appendNode('dependencies')
|
|
|
- project.configurations.shadow.allDependencies.each {
|
|
|
- if (false == it instanceof SelfResolvingDependency) {
|
|
|
- Node dependencyNode = dependenciesNode.appendNode('dependency')
|
|
|
- dependencyNode.appendNode('groupId', it.group)
|
|
|
- dependencyNode.appendNode('artifactId', it.name)
|
|
|
- dependencyNode.appendNode('version', it.version)
|
|
|
- dependencyNode.appendNode('scope', 'compile')
|
|
|
- }
|
|
|
- }
|
|
|
- // Be tidy and remove the element if it is empty
|
|
|
- if (dependenciesNode.children.empty) {
|
|
|
- root.remove(dependenciesNode)
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -587,6 +566,20 @@ class BuildPlugin implements Plugin<Project> {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * Add dependencies that we are going to bundle to the compile classpath.
|
|
|
+ */
|
|
|
+ static void configureSourceSets(Project project) {
|
|
|
+ project.plugins.withType(ShadowPlugin).whenPluginAdded {
|
|
|
+ ['main', 'test'].each {name ->
|
|
|
+ SourceSet sourceSet = project.sourceSets.findByName(name)
|
|
|
+ if (sourceSet != null) {
|
|
|
+ sourceSet.compileClasspath += project.configurations.bundle
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/** Adds compiler settings to the project */
|
|
|
static void configureCompile(Project project) {
|
|
|
if (project.compilerJavaVersion < JavaVersion.VERSION_1_10) {
|
|
@@ -764,9 +757,16 @@ class BuildPlugin implements Plugin<Project> {
|
|
|
* better to be safe
|
|
|
*/
|
|
|
mergeServiceFiles()
|
|
|
+ /*
|
|
|
+ * Bundle dependencies of the "bundled" configuration.
|
|
|
+ */
|
|
|
+ configurations = [project.configurations.bundle]
|
|
|
}
|
|
|
// Make sure we assemble the shadow jar
|
|
|
project.tasks.assemble.dependsOn project.tasks.shadowJar
|
|
|
+ project.artifacts {
|
|
|
+ apiElements project.tasks.shadowJar
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -873,13 +873,8 @@ class BuildPlugin implements Plugin<Project> {
|
|
|
exclude '**/*$*.class'
|
|
|
|
|
|
project.plugins.withType(ShadowPlugin).whenPluginAdded {
|
|
|
- /*
|
|
|
- * If we make a shaded jar we test against it.
|
|
|
- */
|
|
|
+ // Test against a shadow jar if we made one
|
|
|
classpath -= project.tasks.compileJava.outputs.files
|
|
|
- classpath -= project.configurations.compile
|
|
|
- classpath -= project.configurations.runtime
|
|
|
- classpath += project.configurations.shadow
|
|
|
classpath += project.tasks.shadowJar.outputs.files
|
|
|
dependsOn project.tasks.shadowJar
|
|
|
}
|
|
@@ -905,26 +900,6 @@ class BuildPlugin implements Plugin<Project> {
|
|
|
additionalTest.dependsOn(project.tasks.testClasses)
|
|
|
project.check.dependsOn(additionalTest)
|
|
|
});
|
|
|
-
|
|
|
- project.plugins.withType(ShadowPlugin).whenPluginAdded {
|
|
|
- /*
|
|
|
- * We need somewhere to configure dependencies that we don't wish
|
|
|
- * to shade into the jar. The shadow plugin creates a "shadow"
|
|
|
- * configuration which is *almost* exactly that. It is never
|
|
|
- * bundled into the shaded jar but is used for main source
|
|
|
- * compilation. Unfortunately, by default it is not used for
|
|
|
- * *test* source compilation and isn't used in tests at all. This
|
|
|
- * change makes it available for test compilation.
|
|
|
- *
|
|
|
- * Note that this isn't going to work properly with qa projects
|
|
|
- * but they have no business applying the shadow plugin in the
|
|
|
- * firstplace.
|
|
|
- */
|
|
|
- SourceSet testSourceSet = project.sourceSets.findByName('test')
|
|
|
- if (testSourceSet != null) {
|
|
|
- testSourceSet.compileClasspath += project.configurations.shadow
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
private static configurePrecommit(Project project) {
|
|
@@ -936,7 +911,7 @@ class BuildPlugin implements Plugin<Project> {
|
|
|
it.group.startsWith('org.elasticsearch') == false
|
|
|
} - project.configurations.compileOnly
|
|
|
project.plugins.withType(ShadowPlugin).whenPluginAdded {
|
|
|
- project.dependencyLicenses.dependencies += project.configurations.shadow.fileCollection {
|
|
|
+ project.dependencyLicenses.dependencies += project.configurations.bundle.fileCollection {
|
|
|
it.group.startsWith('org.elasticsearch') == false
|
|
|
}
|
|
|
}
|
|
@@ -947,7 +922,7 @@ class BuildPlugin implements Plugin<Project> {
|
|
|
deps.runtimeConfiguration = project.configurations.runtime
|
|
|
project.plugins.withType(ShadowPlugin).whenPluginAdded {
|
|
|
deps.runtimeConfiguration = project.configurations.create('infoDeps')
|
|
|
- deps.runtimeConfiguration.extendsFrom(project.configurations.runtime, project.configurations.shadow)
|
|
|
+ deps.runtimeConfiguration.extendsFrom(project.configurations.runtime, project.configurations.bundle)
|
|
|
}
|
|
|
deps.compileOnlyConfiguration = project.configurations.compileOnly
|
|
|
project.afterEvaluate {
|