Merge pull request #14592 from rjernst/eclipse_cycles
Build: Fix eclipse generation to add a core-tests projects
This commit is contained in:
commit
59a1cda9bb
10
build.gradle
10
build.gradle
|
@ -97,13 +97,14 @@ allprojects {
|
|||
randomizedrunner: '2.2.0',
|
||||
httpclient: '4.3.6'
|
||||
]
|
||||
|
||||
// for eclipse hacks...
|
||||
isEclipse = System.getProperty("eclipse.launcher") != null || gradle.startParameter.taskNames.contains('eclipse') || gradle.startParameter.taskNames.contains('cleanEclipse')
|
||||
}
|
||||
}
|
||||
|
||||
subprojects {
|
||||
repositories {
|
||||
// Uncomment the following line to first resolve against the maven local repo. This is useful for eclipse users who want to work on test-framework.
|
||||
// mavenLocal()
|
||||
mavenCentral()
|
||||
maven {
|
||||
name 'sonatype-snapshots'
|
||||
|
@ -137,12 +138,7 @@ subprojects {
|
|||
dependencySubstitution {
|
||||
substitute module("org.elasticsearch:rest-api-spec:${version}") with project("${projectsPrefix}:rest-api-spec")
|
||||
substitute module("org.elasticsearch:elasticsearch:${version}") with project("${projectsPrefix}:core")
|
||||
// so that eclipse doesn't have circular references
|
||||
// the downside is, if you hack on test-framework, you have to gradle install
|
||||
// the first prop detects eclipse itself, the second detects eclipse from commandline
|
||||
if (System.getProperty("eclipse.launcher") == null && gradle.startParameter.taskNames.contains('eclipse') == false) {
|
||||
substitute module("org.elasticsearch:test-framework:${version}") with project("${projectsPrefix}:test-framework")
|
||||
}
|
||||
substitute module("org.elasticsearch.distribution.zip:elasticsearch:${version}") with project("${projectsPrefix}:distribution:zip")
|
||||
substitute module("org.elasticsearch.distribution.tar:elasticsearch:${version}") with project("${projectsPrefix}:distribution:tar")
|
||||
}
|
||||
|
|
|
@ -89,11 +89,26 @@ dependencies {
|
|||
|
||||
compile 'net.java.dev.jna:jna:4.1.0', optional
|
||||
|
||||
if (isEclipse == false || project.path == "${projectsPrefix}:core-tests") {
|
||||
testCompile("org.elasticsearch:test-framework:${version}") {
|
||||
// tests use the locally compiled version of core
|
||||
exclude group: 'org.elasticsearch', module: 'elasticsearch'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isEclipse) {
|
||||
// in eclipse the project is under a fake root, we need to change around the source sets
|
||||
sourceSets {
|
||||
if (project.path == "${projectsPrefix}:core") {
|
||||
main.java.srcDirs = ['java']
|
||||
main.resources.srcDirs = ['resources']
|
||||
} else {
|
||||
test.java.srcDirs = ['java']
|
||||
test.resources.srcDirs = ['resources']
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
compileJava.options.compilerArgs << "-Xlint:-cast,-deprecation,-fallthrough,-overrides,-rawtypes,-serial,-try,-unchecked"
|
||||
compileTestJava.options.compilerArgs << "-Xlint:-cast,-deprecation,-fallthrough,-overrides,-rawtypes,-serial,-try,-unchecked"
|
||||
|
@ -104,6 +119,7 @@ forbiddenPatterns {
|
|||
exclude '**/org/elasticsearch/cluster/routing/shard_routes.txt'
|
||||
}
|
||||
|
||||
if (isEclipse == false || project.path == "${projectsPrefix}:core-tests") {
|
||||
task integTest(type: RandomizedTestingTask,
|
||||
group: JavaBasePlugin.VERIFICATION_GROUP,
|
||||
description: 'Multi-node tests',
|
||||
|
@ -119,4 +135,5 @@ integTest.mustRunAfter test
|
|||
RestSpecHack.configureDependencies(project)
|
||||
Task copyRestSpec = RestSpecHack.configureTask(project, true)
|
||||
integTest.dependsOn copyRestSpec
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
|
||||
// this is just shell gradle file for eclipse to have separate projects for core src and tests
|
||||
apply from: '../../build.gradle'
|
|
@ -0,0 +1,7 @@
|
|||
|
||||
// this is just shell gradle file for eclipse to have separate projects for core src and tests
|
||||
apply from: '../../build.gradle'
|
||||
|
||||
dependencies {
|
||||
testCompile project("${projectsPrefix}:core")
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
rootProject.name = 'elasticsearch'
|
||||
|
||||
String[] projects = [
|
||||
List projects = [
|
||||
'rest-api-spec',
|
||||
'core',
|
||||
'distribution:zip',
|
||||
|
@ -35,9 +35,19 @@ String[] projects = [
|
|||
'qa:vagrant',
|
||||
]
|
||||
|
||||
if (hasProperty('elasticsearch.projectsPrefix')) {
|
||||
String prefix = getProperty('elasticsearch.projectsPrefix')
|
||||
projects = projects.collect { "${prefix}:${it}" }
|
||||
boolean isEclipse = System.getProperty("eclipse.launcher") != null || gradle.startParameter.taskNames.contains('eclipse') || gradle.startParameter.taskNames.contains('cleanEclipse')
|
||||
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'
|
||||
}
|
||||
|
||||
include projects.toArray(new String[0])
|
||||
|
||||
if (isEclipse) {
|
||||
project(":core").projectDir = new File(rootProject.projectDir, 'core/src/main')
|
||||
project(":core").buildFileName = 'eclipse-build.gradle'
|
||||
project(":core-tests").projectDir = new File(rootProject.projectDir, 'core/src/test')
|
||||
project(":core-tests").buildFileName = 'eclipse-build.gradle'
|
||||
}
|
||||
|
||||
include projects
|
||||
|
|
Loading…
Reference in New Issue