Avoid sharing source directories as it breaks intellij (#40877)
* Avoid sharing source directories as it breaks intellij * Subprojects share main project output classes directory * Fix jar hell * Fix sql security with ssl integ tests * Relax dependency ordering rule so we don't explode on cycles
This commit is contained in:
parent
21b99a3aeb
commit
2569fb60de
33
build.gradle
33
build.gradle
|
@ -338,14 +338,6 @@ gradle.projectsEvaluated {
|
||||||
integTest.mustRunAfter test
|
integTest.mustRunAfter test
|
||||||
}
|
}
|
||||||
configurations.all { Configuration configuration ->
|
configurations.all { Configuration configuration ->
|
||||||
/*
|
|
||||||
* The featureAwarePlugin configuration has a dependency on x-pack:plugin:core and x-pack:plugin:core has a dependency on the
|
|
||||||
* featureAwarePlugin configuration. The below task ordering logic would force :x-pack:plugin:core:test
|
|
||||||
* :x-pack:test:feature-aware:test to depend on each other circularly. We break that cycle here.
|
|
||||||
*/
|
|
||||||
if (configuration.name == "featureAwarePlugin") {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
dependencies.all { Dependency dep ->
|
dependencies.all { Dependency dep ->
|
||||||
Project upstreamProject = dependencyToProject(dep)
|
Project upstreamProject = dependencyToProject(dep)
|
||||||
if (upstreamProject != null) {
|
if (upstreamProject != null) {
|
||||||
|
@ -357,7 +349,7 @@ gradle.projectsEvaluated {
|
||||||
Task task = project.tasks.findByName(taskName)
|
Task task = project.tasks.findByName(taskName)
|
||||||
Task upstreamTask = upstreamProject.tasks.findByName(taskName)
|
Task upstreamTask = upstreamProject.tasks.findByName(taskName)
|
||||||
if (task != null && upstreamTask != null) {
|
if (task != null && upstreamTask != null) {
|
||||||
task.mustRunAfter(upstreamTask)
|
task.shouldRunAfter(upstreamTask)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -382,21 +374,6 @@ allprojects {
|
||||||
// also ignore other possible build dirs
|
// also ignore other possible build dirs
|
||||||
excludeDirs += file('build')
|
excludeDirs += file('build')
|
||||||
excludeDirs += file('build-eclipse')
|
excludeDirs += file('build-eclipse')
|
||||||
|
|
||||||
iml {
|
|
||||||
// fix so that Gradle idea plugin properly generates support for resource folders
|
|
||||||
// see also https://issues.gradle.org/browse/GRADLE-2975
|
|
||||||
withXml {
|
|
||||||
it.asNode().component.content.sourceFolder.findAll { it.@url == 'file://$MODULE_DIR$/src/main/resources' }.each {
|
|
||||||
it.attributes().remove('isTestSource')
|
|
||||||
it.attributes().put('type', 'java-resource')
|
|
||||||
}
|
|
||||||
it.asNode().component.content.sourceFolder.findAll { it.@url == 'file://$MODULE_DIR$/src/test/resources' }.each {
|
|
||||||
it.attributes().remove('isTestSource')
|
|
||||||
it.attributes().put('type', 'java-test-resource')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -414,14 +391,6 @@ idea {
|
||||||
vcs = 'Git'
|
vcs = 'Git'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Make sure gradle idea was run before running anything in intellij (including import).
|
|
||||||
File ideaMarker = new File(projectDir, '.local-idea-is-configured')
|
|
||||||
tasks.idea.doLast {
|
|
||||||
ideaMarker.setText('', 'UTF-8')
|
|
||||||
}
|
|
||||||
if (System.getProperty('idea.active') != null && ideaMarker.exists() == false) {
|
|
||||||
throw new GradleException('You must run `./gradlew idea` from the root of elasticsearch before importing into IntelliJ')
|
|
||||||
}
|
|
||||||
|
|
||||||
// eclipse configuration
|
// eclipse configuration
|
||||||
allprojects {
|
allprojects {
|
||||||
|
|
|
@ -105,3 +105,15 @@ task bwcTestSnapshots {
|
||||||
|
|
||||||
check.dependsOn(bwcTestSnapshots)
|
check.dependsOn(bwcTestSnapshots)
|
||||||
|
|
||||||
|
configurations {
|
||||||
|
testArtifacts.extendsFrom testRuntime
|
||||||
|
}
|
||||||
|
|
||||||
|
task testJar(type: Jar) {
|
||||||
|
appendix 'test'
|
||||||
|
from sourceSets.test.output
|
||||||
|
}
|
||||||
|
|
||||||
|
artifacts {
|
||||||
|
testArtifacts testJar
|
||||||
|
}
|
|
@ -48,6 +48,9 @@ dependencies {
|
||||||
testCompile project(path: ':modules:reindex', configuration: 'runtime')
|
testCompile project(path: ':modules:reindex', configuration: 'runtime')
|
||||||
testCompile project(path: ':modules:parent-join', configuration: 'runtime')
|
testCompile project(path: ':modules:parent-join', configuration: 'runtime')
|
||||||
testCompile project(path: ':modules:analysis-common', configuration: 'runtime')
|
testCompile project(path: ':modules:analysis-common', configuration: 'runtime')
|
||||||
|
testCompile(project(':x-pack:license-tools')) {
|
||||||
|
transitive = false
|
||||||
|
}
|
||||||
testCompile ("org.elasticsearch.client:elasticsearch-rest-high-level-client:${version}")
|
testCompile ("org.elasticsearch.client:elasticsearch-rest-high-level-client:${version}")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,8 +98,8 @@ licenseHeaders {
|
||||||
}
|
}
|
||||||
|
|
||||||
// make LicenseSigner available for testing signed licenses
|
// make LicenseSigner available for testing signed licenses
|
||||||
sourceSets.test.java {
|
sourceSets.test.resources {
|
||||||
srcDir '../../license-tools/src/main/java'
|
srcDir 'src/main/config'
|
||||||
}
|
}
|
||||||
|
|
||||||
unitTest {
|
unitTest {
|
||||||
|
|
|
@ -126,6 +126,11 @@ dependencies {
|
||||||
compileJava.options.compilerArgs << "-Xlint:-rawtypes,-unchecked"
|
compileJava.options.compilerArgs << "-Xlint:-rawtypes,-unchecked"
|
||||||
compileTestJava.options.compilerArgs << "-Xlint:-rawtypes,-unchecked"
|
compileTestJava.options.compilerArgs << "-Xlint:-rawtypes,-unchecked"
|
||||||
|
|
||||||
|
processTestResources {
|
||||||
|
from(project(xpackModule('core')).file('src/main/config'))
|
||||||
|
from(project(xpackModule('core')).file('src/test/resources'))
|
||||||
|
}
|
||||||
|
|
||||||
configurations {
|
configurations {
|
||||||
testArtifacts.extendsFrom testRuntime
|
testArtifacts.extendsFrom testRuntime
|
||||||
}
|
}
|
||||||
|
@ -138,10 +143,7 @@ artifacts {
|
||||||
archives jar
|
archives jar
|
||||||
testArtifacts testJar
|
testArtifacts testJar
|
||||||
}
|
}
|
||||||
sourceSets.test.resources {
|
|
||||||
srcDir '../core/src/test/resources'
|
|
||||||
srcDir '../core/src/main/config'
|
|
||||||
}
|
|
||||||
dependencyLicenses {
|
dependencyLicenses {
|
||||||
mapping from: /java-support|opensaml-.*/, to: 'shibboleth'
|
mapping from: /java-support|opensaml-.*/, to: 'shibboleth'
|
||||||
mapping from: /http.*/, to: 'httpclient'
|
mapping from: /http.*/, to: 'httpclient'
|
||||||
|
|
|
@ -13,13 +13,15 @@ subprojects {
|
||||||
// Use resources from the parent project in subprojects
|
// Use resources from the parent project in subprojects
|
||||||
sourceSets {
|
sourceSets {
|
||||||
test {
|
test {
|
||||||
java {
|
mainProject.sourceSets.test.output.classesDirs.each { dir ->
|
||||||
srcDirs = ["${mainProject.projectDir}/src/test/java"]
|
output.addClassesDir { dir }
|
||||||
}
|
}
|
||||||
resources {
|
runtimeClasspath += mainProject.sourceSets.test.output
|
||||||
srcDirs = ["${mainProject.projectDir}/src/test/resources"]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
processTestResources {
|
||||||
|
from mainProject.file('src/test/resources')
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|
|
@ -25,6 +25,7 @@ dependencies {
|
||||||
// This is total #$%, but the solution is to get the SAML realm (which uses guava) out of security proper
|
// This is total #$%, but the solution is to get the SAML realm (which uses guava) out of security proper
|
||||||
exclude group: "com.google.guava", module: "guava"
|
exclude group: "com.google.guava", module: "guava"
|
||||||
}
|
}
|
||||||
|
testCompile project(path: ':qa:full-cluster-restart', configuration: 'testArtifacts')
|
||||||
}
|
}
|
||||||
|
|
||||||
Closure waitWithAuth = { NodeInfo node, AntBuilder ant ->
|
Closure waitWithAuth = { NodeInfo node, AntBuilder ant ->
|
||||||
|
@ -70,15 +71,6 @@ Closure waitWithAuth = { NodeInfo node, AntBuilder ant ->
|
||||||
return tmpFile.exists()
|
return tmpFile.exists()
|
||||||
}
|
}
|
||||||
|
|
||||||
String coreFullClusterRestartPath = project(':qa:full-cluster-restart').projectDir.toPath().resolve('src/test/java').toString()
|
|
||||||
sourceSets {
|
|
||||||
test {
|
|
||||||
java {
|
|
||||||
srcDirs += [coreFullClusterRestartPath]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
licenseHeaders {
|
licenseHeaders {
|
||||||
approvedLicenses << 'Apache'
|
approvedLicenses << 'Apache'
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,9 @@ dependencies {
|
||||||
}
|
}
|
||||||
|
|
||||||
// add test resources from security, so certificate tool tests can use example certs
|
// add test resources from security, so certificate tool tests can use example certs
|
||||||
sourceSets.test.resources.srcDirs(project(xpackModule('security')).sourceSets.test.resources.srcDirs)
|
processTestResources {
|
||||||
|
from(project(xpackModule('security')).sourceSets.test.resources.srcDirs)
|
||||||
|
}
|
||||||
|
|
||||||
// we have to repeate these patterns because the security test resources are effectively in the src of this project
|
// we have to repeate these patterns because the security test resources are effectively in the src of this project
|
||||||
forbiddenPatterns {
|
forbiddenPatterns {
|
||||||
|
|
|
@ -9,7 +9,10 @@ dependencies {
|
||||||
testFixtures.useFixture ":x-pack:test:smb-fixture"
|
testFixtures.useFixture ":x-pack:test:smb-fixture"
|
||||||
|
|
||||||
// add test resources from security, so tests can use example certs
|
// add test resources from security, so tests can use example certs
|
||||||
sourceSets.test.resources.srcDirs(project(xpackModule('security')).sourceSets.test.resources.srcDirs)
|
processTestResources {
|
||||||
|
from(project(xpackModule('security')).sourceSets.test.resources.srcDirs)
|
||||||
|
}
|
||||||
|
|
||||||
compileTestJava.options.compilerArgs << "-Xlint:-rawtypes,-unchecked"
|
compileTestJava.options.compilerArgs << "-Xlint:-rawtypes,-unchecked"
|
||||||
|
|
||||||
// we have to repeat these patterns because the security test resources are effectively in the src of this project
|
// we have to repeat these patterns because the security test resources are effectively in the src of this project
|
||||||
|
|
Loading…
Reference in New Issue