LUCENE-9311: detect intellij reimport and modify sourceset to exclude solr-ref-guide/tools (#1422)

This commit is contained in:
Dawid Weiss 2020-04-09 13:55:42 +02:00 committed by GitHub
parent c7cac5749a
commit 2437f3f56c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 2 deletions

View File

@ -88,8 +88,8 @@ apply from: file('gradle/jar-manifest.gradle')
// Maven publishing.
apply from: file('gradle/maven/defaults-maven.gradle')
// IDE settings and specials.
apply from: file('gradle/defaults-idea.gradle')
// IDE support, settings and specials.
apply from: file('gradle/ide/intellij-idea.gradle')
// Validation tasks
apply from: file('gradle/validation/precommit.gradle')

View File

@ -15,6 +15,15 @@
* limitations under the License.
*/
// Try to detect IntelliJ model loader ("reimport") early.
def isIdea = System.getProperty("idea.active") != null ||
gradle.startParameter.taskNames.contains('idea') ||
gradle.startParameter.taskNames.contains('cleanIdea')
if (isIdea) {
logger.warn("IntelliJ Idea IDE detected.")
}
allprojects {
apply plugin: 'idea'
@ -27,3 +36,18 @@ allprojects {
}
}
// Remove tools source set entirely if we're running under IntelliJ. Otherwise
// files that reference ant can't be compiled.
if (isIdea) {
configure(project(":solr:solr-ref-guide")) {
afterEvaluate {
sourceSets {
main {
java {
srcDirs = []
}
}
}
}
}
}