Skip to content

Commit

Permalink
Splits nio project into two for eclipse build only (#27939)
Browse files Browse the repository at this point in the history
* Splits nio project into two for eclipse build only

#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
  • Loading branch information
colings86 authored Dec 21, 2017
1 parent c753b82 commit d63b1ef
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 2 deletions.
20 changes: 18 additions & 2 deletions libs/elasticsearch-nio/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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']
}
}
}

Expand Down
3 changes: 3 additions & 0 deletions libs/elasticsearch-nio/src/main/eclipse-build.gradle
Original file line number Diff line number Diff line change
@@ -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'
7 changes: 7 additions & 0 deletions libs/elasticsearch-nio/src/test/eclipse-build.gradle
Original file line number Diff line number Diff line change
@@ -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')
}
5 changes: 5 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand All @@ -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'
}

/**
Expand Down

0 comments on commit d63b1ef

Please sign in to comment.