Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 22 additions & 15 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,23 @@ subprojects {
}
}

/*
* Gradle only resolve project substitutions during dependency resolution but
* we sometimes want to do the resolution at other times. This creates a
* convenient method we can call to do it.
*/
ext.dependencyToProject = { Dependency dep ->
if (dep instanceof ProjectDependency) {
return dep.dependencyProject
} else {
String substitution = projectSubstitutions.get("${dep.group}:${dep.name}:${dep.version}")
if (substitution != null) {
return findProject(substitution)
}
return null
}
}

project.afterEvaluate {
configurations.all {
resolutionStrategy.dependencySubstitution { DependencySubstitutions subs ->
Expand All @@ -249,11 +266,11 @@ subprojects {
Closure sortClosure = { a, b -> b.group <=> a.group }
Closure depJavadocClosure = { dep ->
if (dep.group != null && dep.group.startsWith('org.elasticsearch')) {
String substitution = project.ext.projectSubstitutions.get("${dep.group}:${dep.name}:${dep.version}")
if (substitution != null) {
project.javadoc.dependsOn substitution + ':javadoc'
Project upstreamProject = dependencyToProject(dep)
if (upstreamProject != null) {
project.javadoc.dependsOn "${upstreamProject.path}:javadoc"
String artifactPath = dep.group.replaceAll('\\.', '/') + '/' + dep.name.replaceAll('\\.', '/') + '/' + dep.version
project.javadoc.options.linksOffline artifactsHost + "/javadoc/" + artifactPath, "${project.project(substitution).buildDir}/docs/javadoc/"
project.javadoc.options.linksOffline artifactsHost + "/javadoc/" + artifactPath, "${upstreamProject.buildDir}/docs/javadoc/"
}
}
}
Expand All @@ -275,17 +292,7 @@ gradle.projectsEvaluated {
}
configurations.all {
dependencies.all { Dependency dep ->
Project upstreamProject = null
if (dep instanceof ProjectDependency) {
upstreamProject = dep.dependencyProject
} else {
// gradle doesn't apply substitutions until resolve time, so they won't
// show up as a ProjectDependency above
String substitution = projectSubstitutions.get("${dep.group}:${dep.name}:${dep.version}")
if (substitution != null) {
upstreamProject = findProject(substitution)
}
}
Project upstreamProject = dependencyToProject(dep)
if (upstreamProject != null) {
if (project.path == upstreamProject.path) {
// TODO: distribution integ tests depend on themselves (!), fix that
Expand Down
46 changes: 46 additions & 0 deletions libs/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

subprojects {
/*
* All subprojects are java projects using Elasticsearch's standard build
* tools.
*/
apply plugin: 'elasticsearch.build'

/*
* Subprojects may depend on the "core" lib but may not depend on any
* other libs. This keeps are dependencies simpler.
*/
project.afterEvaluate {
configurations.all { Configuration conf ->
dependencies.all { Dependency dep ->
Project depProject = dependencyToProject(dep)
if (depProject != null
&& false == depProject.path.equals(':libs:elasticsearch-core')
&& depProject.path.startsWith(':libs')) {
throw new InvalidUserDataException("projects in :libs "
+ "may not depend on other projects libs except "
+ ":libs:elasticsearch-core but "
+ "${project.path} depends on ${depProject.path}")
}
}
}
}
}
1 change: 0 additions & 1 deletion libs/elasticsearch-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import org.elasticsearch.gradle.precommit.PrecommitTasks
* under the License.
*/

apply plugin: 'elasticsearch.build'
apply plugin: 'nebula.optional-base'
apply plugin: 'nebula.maven-base-publish'
apply plugin: 'nebula.maven-scm'
Expand Down
3 changes: 1 addition & 2 deletions libs/elasticsearch-nio/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

import org.elasticsearch.gradle.precommit.PrecommitTasks

apply plugin: 'elasticsearch.build'
apply plugin: 'nebula.maven-base-publish'
apply plugin: 'nebula.maven-scm'

Expand All @@ -39,7 +38,7 @@ dependencies {
testCompile "com.carrotsearch.randomizedtesting:randomizedtesting-runner:${versions.randomizedrunner}"
testCompile "junit:junit:${versions.junit}"
testCompile "org.hamcrest:hamcrest-all:${versions.hamcrest}"

if (isEclipse == false || project.path == ":libs:elasticsearch-nio-tests") {
testCompile("org.elasticsearch.test:framework:${version}") {
exclude group: 'org.elasticsearch', module: 'elasticsearch-nio'
Expand Down
2 changes: 0 additions & 2 deletions libs/grok/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ import org.elasticsearch.gradle.precommit.PrecommitTasks
* under the License.
*/

apply plugin: 'elasticsearch.build'

archivesBaseName = 'elasticsearch-grok'

dependencies {
Expand Down
2 changes: 0 additions & 2 deletions libs/plugin-classloader/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
* under the License.
*/

apply plugin: 'elasticsearch.build'

test.enabled = false

// test depend on ES core...
Expand Down
1 change: 0 additions & 1 deletion libs/secure-sm/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

import org.elasticsearch.gradle.precommit.PrecommitTasks

apply plugin: 'elasticsearch.build'
apply plugin: 'nebula.maven-base-publish'
apply plugin: 'nebula.maven-scm'

Expand Down