Build: Setup standalone tests to compile in intellij

This adds the standalone tests so they will compile (and thus can be
modified with import completion) within IntelliJ. It also explicitly
sets up buildSrc as a module.

Note that this does *not* mean eg evil-tests can be run from intellij.
These are special tests that require special settings (eg disabling
security manager). They need to be run from the command line.

closes #15075
This commit is contained in:
Ryan Ernst 2015-11-28 16:54:51 -08:00
parent b375084305
commit 30fe74b5df
2 changed files with 12 additions and 3 deletions

View File

@ -177,6 +177,12 @@ tasks.idea.doLast {
if (System.getProperty('idea.active') != null && ideaMarker.exists() == false) {
throw new GradleException('You must run gradle idea from the root of elasticsearch before importing into IntelliJ')
}
// add buildSrc itself as a groovy project
task buildSrcIdea(type: GradleBuild) {
buildFile = 'buildSrc/build.gradle'
tasks = ['cleanIdea', 'ideaModule']
}
tasks.idea.dependsOn(buildSrcIdea)
// eclipse configuration

View File

@ -39,9 +39,6 @@ class StandaloneTestBasePlugin implements Plugin<Project> {
BuildPlugin.globalBuildInfo(project)
BuildPlugin.configureRepositories(project)
// remove some unnecessary tasks for a qa test
project.tasks.removeAll { it.name in ['assemble', 'buildDependents'] }
// only setup tests to build
project.sourceSets {
test
@ -56,6 +53,12 @@ class StandaloneTestBasePlugin implements Plugin<Project> {
plusConfigurations = [project.configurations.testRuntime]
}
}
project.idea {
module {
testSourceDirs += project.sourceSets.test.java.srcDirs
scopes['TEST'] = [plus: [project.configurations.testRuntime]]
}
}
PrecommitTasks.configure(project)
}
}