Splits nio project into two for eclipse build only (#27939)

* Splits nio project into two for eclipse build only

https://github.com/elastic/elasticsearch/pull/27801 introduced a new gradle project `:libs:elasticsearch-nio` which creates cyclical project dependencies when importingthe projects into Eclipse.

This change applies the same trick as we have for the core project where, and building for Eclipse, splits the `:libs:elasticsearch-nio` project into `:libs:elasticsearch-nio` which points to `src/main` and `:libs:elasticsearch-nio-tests` which points to `src/test`. This prevents cyclical project dependencies in Eclipse arising from the fact that eclipse does not separate compile/runtime dependencies from test dependencies.

* Removes integTest bits since there are none
This commit is contained in:
Colin Goodheart-Smithe 2017-12-21 14:34:15 +00:00 committed by GitHub
parent c753b82ca8
commit d63b1efb14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 33 additions and 2 deletions

View File

@ -39,8 +39,24 @@ dependencies {
testCompile "com.carrotsearch.randomizedtesting:randomizedtesting-runner:${versions.randomizedrunner}"
testCompile "junit:junit:${versions.junit}"
testCompile "org.hamcrest:hamcrest-all:${versions.hamcrest}"
testCompile("org.elasticsearch.test:framework:${version}") {
exclude group: 'org.elasticsearch', module: 'elasticsearch-nio'
if (isEclipse == false || project.path == ":libs:elasticsearch-nio-tests") {
testCompile("org.elasticsearch.test:framework:${version}") {
exclude group: 'org.elasticsearch', module: 'elasticsearch-nio'
}
}
}
if (isEclipse) {
// in eclipse the project is under a fake root, we need to change around the source sets
sourceSets {
if (project.path == ":libs:elasticsearch-nio") {
main.java.srcDirs = ['java']
main.resources.srcDirs = ['resources']
} else {
test.java.srcDirs = ['java']
test.resources.srcDirs = ['resources']
}
}
}

View File

@ -0,0 +1,3 @@
// this is just shell gradle file for eclipse to have separate projects for elasticsearch-nio src and tests
apply from: '../../build.gradle'

View File

@ -0,0 +1,7 @@
// this is just shell gradle file for eclipse to have separate projects for elasticsearch-nio src and tests
apply from: '../../build.gradle'
dependencies {
testCompile project(':libs:elasticsearch-nio')
}

View File

@ -109,6 +109,7 @@ if (isEclipse) {
// eclipse cannot handle an intermediate dependency between main and test, so we must create separate projects
// for core-src and core-tests
projects << 'core-tests'
projects << 'libs:elasticsearch-nio-tests'
}
include projects.toArray(new String[0])
@ -131,6 +132,10 @@ if (isEclipse) {
project(":core").buildFileName = 'eclipse-build.gradle'
project(":core-tests").projectDir = new File(rootProject.projectDir, 'core/src/test')
project(":core-tests").buildFileName = 'eclipse-build.gradle'
project(":libs:elasticsearch-nio").projectDir = new File(rootProject.projectDir, 'libs/elasticsearch-nio/src/main')
project(":libs:elasticsearch-nio").buildFileName = 'eclipse-build.gradle'
project(":libs:elasticsearch-nio-tests").projectDir = new File(rootProject.projectDir, 'libs/elasticsearch-nio/src/test')
project(":libs:elasticsearch-nio-tests").buildFileName = 'eclipse-build.gradle'
}
/**