From 2fef5dee96ccfee1d7b58abc13c85d34a84063f2 Mon Sep 17 00:00:00 2001 From: Ryan Ernst Date: Thu, 4 Feb 2016 15:44:30 -0800 Subject: [PATCH 1/4] Build: use separate build directories for eclipse and intellij This fixes the problem where doing a gradle clean from the command line completely breaks the IDE. --- .gitignore | 6 +++--- build.gradle | 19 ++++++++++++++----- buildSrc/build.gradle | 2 +- .../gradle/plugin/PluginPropertiesTask.groovy | 2 +- 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index add7a22e840..af7e64fc895 100644 --- a/.gitignore +++ b/.gitignore @@ -4,12 +4,13 @@ *.iml *.ipr *.iws +build-idea/ # eclipse files .project .classpath -eclipse-build .settings +build-eclipse/ # netbeans files nb-configuration.xml @@ -18,7 +19,6 @@ nbactions.xml # gradle stuff .gradle/ build/ -generated-resources/ # maven stuff (to be removed when trunk becomes 4.x) *-execution-hints.log @@ -38,5 +38,5 @@ html_docs # random old stuff that we should look at the necessity of... /tmp/ backwards/ - +eclipse-build diff --git a/build.gradle b/build.gradle index c31fe88f5d2..1e7a8cbef84 100644 --- a/build.gradle +++ b/build.gradle @@ -75,8 +75,9 @@ subprojects { allprojects { // injecting groovy property variables into all projects project.ext { - // for eclipse hacks... + // for ide hacks... isEclipse = System.getProperty("eclipse.launcher") != null || gradle.startParameter.taskNames.contains('eclipse') || gradle.startParameter.taskNames.contains('cleanEclipse') + isIdea = System.getProperty("idea.active") != null || gradle.startParameter.taskNames.contains('idea') || gradle.startParameter.taskNames.contains('cleanIdea') } } @@ -170,12 +171,15 @@ gradle.projectsEvaluated { allprojects { apply plugin: 'idea' + if (isIdea) { + project.buildDir = file('build-idea') + } idea { module { // same as for the IntelliJ Gradle tooling integration inheritOutputDirs = false - outputDir = file('build/classes/main') - testOutputDir = file('build/classes/test') + outputDir = file('build-idea/classes/main') + testOutputDir = file('build-idea/classes/test') iml { // fix so that Gradle idea plugin properly generates support for resource folders @@ -222,14 +226,19 @@ allprojects { apply plugin: 'eclipse' plugins.withType(JavaBasePlugin) { - eclipse.classpath.defaultOutputDir = new File(project.buildDir, 'eclipse') + File eclipseBuild = project.file('build-eclipse') + eclipse.classpath.defaultOutputDir = eclipseBuild + if (isEclipse) { + // set this so generated dirs will be relative to eclipse build + project.buildDir = eclipseBuild + } eclipse.classpath.file.whenMerged { classpath -> // give each source folder a unique corresponding output folder int i = 0; classpath.entries.findAll { it instanceof SourceFolder }.each { folder -> i++; // this is *NOT* a path or a file. - folder.output = "build/eclipse/" + i + folder.output = "build-eclipse/" + i } } } diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle index a0f06343d30..de3b7d02a0c 100644 --- a/buildSrc/build.gradle +++ b/buildSrc/build.gradle @@ -78,7 +78,7 @@ extraArchive { eclipse { classpath { - defaultOutputDir = new File(file('build'), 'eclipse') + defaultOutputDir = file('build-eclipse') } } diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/plugin/PluginPropertiesTask.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/plugin/PluginPropertiesTask.groovy index de3d060ff26..7b525d39f53 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/plugin/PluginPropertiesTask.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/plugin/PluginPropertiesTask.groovy @@ -29,7 +29,7 @@ import org.gradle.api.tasks.Copy class PluginPropertiesTask extends Copy { PluginPropertiesExtension extension - File generatedResourcesDir = new File(project.projectDir, 'generated-resources') + File generatedResourcesDir = new File(project.buildDir, 'generated-resources') PluginPropertiesTask() { File templateFile = new File(project.buildDir, 'templates/plugin-descriptor.properties') From dcec4791c4a456b4f95c7fdec965c6ea9e5f3552 Mon Sep 17 00:00:00 2001 From: Robert Muir Date: Thu, 4 Feb 2016 18:57:53 -0500 Subject: [PATCH 2/4] fix eclipse to compile at all. why does the build not fail? --- .../org/elasticsearch/index/store/ESBaseDirectoryTestCase.java | 2 +- .../org/elasticsearch/index/store/SmbMMapDirectoryTests.java | 2 +- .../elasticsearch/index/store/SmbSimpleFSDirectoryTests.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/store-smb/src/test/java/org/elasticsearch/index/store/ESBaseDirectoryTestCase.java b/plugins/store-smb/src/test/java/org/elasticsearch/index/store/ESBaseDirectoryTestCase.java index 0e61a84d118..855ddce9ebd 100644 --- a/plugins/store-smb/src/test/java/org/elasticsearch/index/store/ESBaseDirectoryTestCase.java +++ b/plugins/store-smb/src/test/java/org/elasticsearch/index/store/ESBaseDirectoryTestCase.java @@ -1,4 +1,4 @@ -package org.elastiscearch.index.store; +package org.elasticsearch.index.store; /* * Licensed to Elasticsearch under one or more contributor diff --git a/plugins/store-smb/src/test/java/org/elasticsearch/index/store/SmbMMapDirectoryTests.java b/plugins/store-smb/src/test/java/org/elasticsearch/index/store/SmbMMapDirectoryTests.java index 323fa418596..b368a3e99e7 100644 --- a/plugins/store-smb/src/test/java/org/elasticsearch/index/store/SmbMMapDirectoryTests.java +++ b/plugins/store-smb/src/test/java/org/elasticsearch/index/store/SmbMMapDirectoryTests.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elastiscearch.index.store; +package org.elasticsearch.index.store; import java.io.IOException; import java.nio.file.Path; diff --git a/plugins/store-smb/src/test/java/org/elasticsearch/index/store/SmbSimpleFSDirectoryTests.java b/plugins/store-smb/src/test/java/org/elasticsearch/index/store/SmbSimpleFSDirectoryTests.java index 9e314ea35f7..d18057a106b 100644 --- a/plugins/store-smb/src/test/java/org/elasticsearch/index/store/SmbSimpleFSDirectoryTests.java +++ b/plugins/store-smb/src/test/java/org/elasticsearch/index/store/SmbSimpleFSDirectoryTests.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elastiscearch.index.store; +package org.elasticsearch.index.store; import java.io.IOException; import java.nio.file.Path; From b9342b305be11ac7d834aee88a79c0febd8d4833 Mon Sep 17 00:00:00 2001 From: Ryan Ernst Date: Thu, 4 Feb 2016 15:47:55 -0800 Subject: [PATCH 3/4] Also use separte buildSrc build dir for intellij --- build.gradle | 1 - buildSrc/build.gradle | 8 ++++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 1e7a8cbef84..be47690d8eb 100644 --- a/build.gradle +++ b/build.gradle @@ -176,7 +176,6 @@ allprojects { } idea { module { - // same as for the IntelliJ Gradle tooling integration inheritOutputDirs = false outputDir = file('build-idea/classes/main') testOutputDir = file('build-idea/classes/test') diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle index de3b7d02a0c..f994bd528e1 100644 --- a/buildSrc/build.gradle +++ b/buildSrc/build.gradle @@ -76,6 +76,14 @@ extraArchive { tests = false } +idea { + module { + inheritOutputDirs = false + outputDir = file('build-idea/classes/main') + testOutputDir = file('build-idea/classes/test') + } +} + eclipse { classpath { defaultOutputDir = file('build-eclipse') From 89a5eadfea5158a7f228a8acb5534f46c2e2ae52 Mon Sep 17 00:00:00 2001 From: Yannick Welsch Date: Fri, 5 Feb 2016 10:13:17 +0100 Subject: [PATCH 4/4] Change path separator for Checkstyle suppressions to be Windows compatible --- .../gradle/precommit/PrecommitTasks.groovy | 4 +- .../resources/checkstyle_suppressions.xml | 3408 +++++++++-------- 2 files changed, 1708 insertions(+), 1704 deletions(-) diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/precommit/PrecommitTasks.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/precommit/PrecommitTasks.groovy index 1cdeec762d2..dd77c38e679 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/precommit/PrecommitTasks.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/precommit/PrecommitTasks.groovy @@ -91,11 +91,12 @@ class PrecommitTasks { // on them. But we want `precommit` to depend on `checkstyle` which depends on them so // we have to swap them. project.pluginManager.apply('checkstyle') + URL checkstyleSuppressions = PrecommitTasks.getResource('/checkstyle_suppressions.xml') project.checkstyle { config = project.resources.text.fromFile( PrecommitTasks.getResource('/checkstyle.xml'), 'UTF-8') configProperties = [ - suppressions: PrecommitTasks.getResource('/checkstyle_suppressions.xml') + suppressions: checkstyleSuppressions ] } for (String taskName : ['checkstyleMain', 'checkstyleTest']) { @@ -103,6 +104,7 @@ class PrecommitTasks { if (task != null) { project.tasks['check'].dependsOn.remove(task) checkstyleTask.dependsOn(task) + task.inputs.file(checkstyleSuppressions) } } return checkstyleTask diff --git a/buildSrc/src/main/resources/checkstyle_suppressions.xml b/buildSrc/src/main/resources/checkstyle_suppressions.xml index 3b3f91bc233..476d1269884 100644 --- a/buildSrc/src/main/resources/checkstyle_suppressions.xml +++ b/buildSrc/src/main/resources/checkstyle_suppressions.xml @@ -4,1712 +4,1714 @@ "http://www.puppycrawl.com/dtds/suppressions_1_1.dtd"> + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + +