diff --git a/build.gradle b/build.gradle index 042a43ca9ca56..2310bb52b25d0 100644 --- a/build.gradle +++ b/build.gradle @@ -337,14 +337,6 @@ gradle.projectsEvaluated { integTest.mustRunAfter test } 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 -> Project upstreamProject = dependencyToProject(dep) if (upstreamProject != null) { @@ -356,7 +348,7 @@ gradle.projectsEvaluated { Task task = project.tasks.findByName(taskName) Task upstreamTask = upstreamProject.tasks.findByName(taskName) if (task != null && upstreamTask != null) { - task.mustRunAfter(upstreamTask) + task.shouldRunAfter(upstreamTask) } } } @@ -381,21 +373,6 @@ allprojects { // also ignore other possible build dirs excludeDirs += file('build') 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') - } - } - } } } @@ -413,14 +390,6 @@ idea { 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 allprojects { diff --git a/qa/full-cluster-restart/build.gradle b/qa/full-cluster-restart/build.gradle index 60c552fc100b9..a856dd1f0ec39 100644 --- a/qa/full-cluster-restart/build.gradle +++ b/qa/full-cluster-restart/build.gradle @@ -105,3 +105,15 @@ task bwcTestSnapshots { check.dependsOn(bwcTestSnapshots) +configurations { + testArtifacts.extendsFrom testRuntime +} + +task testJar(type: Jar) { + appendix 'test' + from sourceSets.test.output +} + +artifacts { + testArtifacts testJar +} \ No newline at end of file diff --git a/x-pack/plugin/core/build.gradle b/x-pack/plugin/core/build.gradle index ed61fc9e3e703..8fc5ff56a31c9 100644 --- a/x-pack/plugin/core/build.gradle +++ b/x-pack/plugin/core/build.gradle @@ -48,6 +48,9 @@ dependencies { testCompile project(path: ':modules:reindex', configuration: 'runtime') testCompile project(path: ':modules:parent-join', 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}") } @@ -95,8 +98,8 @@ licenseHeaders { } // make LicenseSigner available for testing signed licenses -sourceSets.test.java { - srcDir '../../license-tools/src/main/java' +sourceSets.test.resources { + srcDir 'src/main/config' } unitTest { diff --git a/x-pack/plugin/security/build.gradle b/x-pack/plugin/security/build.gradle index cc0b7cbd9b7c3..4df0f8cd336ff 100644 --- a/x-pack/plugin/security/build.gradle +++ b/x-pack/plugin/security/build.gradle @@ -126,6 +126,11 @@ dependencies { compileJava.options.compilerArgs << "-Xlint:-deprecation,-rawtypes,-serial,-try,-unchecked" compileTestJava.options.compilerArgs << "-Xlint:-deprecation,-rawtypes,-serial,-try,-unchecked" +processTestResources { + from(project(xpackModule('core')).file('src/main/config')) + from(project(xpackModule('core')).file('src/test/resources')) +} + configurations { testArtifacts.extendsFrom testRuntime } @@ -138,10 +143,7 @@ artifacts { archives jar testArtifacts testJar } -sourceSets.test.resources { - srcDir '../core/src/test/resources' - srcDir '../core/src/main/config' -} + dependencyLicenses { mapping from: /java-support|opensaml-.*/, to: 'shibboleth' mapping from: /http.*/, to: 'httpclient' diff --git a/x-pack/plugin/sql/qa/security/build.gradle b/x-pack/plugin/sql/qa/security/build.gradle index 45ab8c92f1e7f..79ebff0085439 100644 --- a/x-pack/plugin/sql/qa/security/build.gradle +++ b/x-pack/plugin/sql/qa/security/build.gradle @@ -13,15 +13,17 @@ subprojects { // Use resources from the parent project in subprojects sourceSets { test { - java { - srcDirs = ["${mainProject.projectDir}/src/test/java"] - } - resources { - srcDirs = ["${mainProject.projectDir}/src/test/resources"] + mainProject.sourceSets.test.output.classesDirs.each { dir -> + output.addClassesDir { dir } } + runtimeClasspath += mainProject.sourceSets.test.output } } + processTestResources { + from mainProject.file('src/test/resources') + } + dependencies { testCompile "org.elasticsearch.plugin:x-pack-core:${version}" } diff --git a/x-pack/qa/full-cluster-restart/build.gradle b/x-pack/qa/full-cluster-restart/build.gradle index 40dca76abc913..da06c6ac5efd7 100644 --- a/x-pack/qa/full-cluster-restart/build.gradle +++ b/x-pack/qa/full-cluster-restart/build.gradle @@ -25,6 +25,7 @@ dependencies { // 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" } + testCompile project(path: ':qa:full-cluster-restart', configuration: 'testArtifacts') } Closure waitWithAuth = { NodeInfo node, AntBuilder ant -> @@ -70,15 +71,6 @@ Closure waitWithAuth = { NodeInfo node, AntBuilder ant -> return tmpFile.exists() } -String coreFullClusterRestartPath = project(':qa:full-cluster-restart').projectDir.toPath().resolve('src/test/java').toString() -sourceSets { - test { - java { - srcDirs += [coreFullClusterRestartPath] - } - } -} - licenseHeaders { approvedLicenses << 'Apache' } diff --git a/x-pack/qa/security-tools-tests/build.gradle b/x-pack/qa/security-tools-tests/build.gradle index 5df22c557db3c..135f82bb4a617 100644 --- a/x-pack/qa/security-tools-tests/build.gradle +++ b/x-pack/qa/security-tools-tests/build.gradle @@ -8,7 +8,9 @@ dependencies { } // 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 forbiddenPatterns { diff --git a/x-pack/qa/third-party/active-directory/build.gradle b/x-pack/qa/third-party/active-directory/build.gradle index e33c0fa6d69f8..d50a530620c43 100644 --- a/x-pack/qa/third-party/active-directory/build.gradle +++ b/x-pack/qa/third-party/active-directory/build.gradle @@ -9,7 +9,10 @@ dependencies { testFixtures.useFixture ":x-pack:test:smb-fixture" // 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:-deprecation,-rawtypes,-serial,-try,-unchecked" // we have to repeat these patterns because the security test resources are effectively in the src of this project