Fix ESQL tests in IntelliJ (#107313)
Landing #107018 broke running ESQL unit tests in IntelliJ. It has *something* to do with turning on the stringtemplate plugin in the esql project but I don't really know what. After that PR we'd often get errors about trying to regenerate evaluators twice. I dunno. This fixes it. But I don't really know why. The way this fixes it is by making the `esql` project more like the `copmute` project. It makes sense that that would help - they both have the same code generation configuration. Anyway, the operative change is landing the generated files in the same place as the `compute` project. Thus all of the file moves. Again, I have no idea why this works. It's build black magic and I just shook it until it worked. Most of the credit goes to git-bisect for finding the commit that broke this.
This commit is contained in:
parent
648c9cb05c
commit
2c0e90fcc8
|
@ -68,4 +68,4 @@ testfixtures_shared/
|
|||
|
||||
# Generated
|
||||
checkstyle_ide.xml
|
||||
x-pack/plugin/esql/gen/
|
||||
x-pack/plugin/esql/src/main/generated-src/generated/
|
||||
|
|
|
@ -40,23 +40,10 @@ dependencies {
|
|||
internalClusterTestImplementation project(":modules:mapper-extras")
|
||||
}
|
||||
|
||||
/*
|
||||
* IntelliJ will always put the java files generated by the annotation processor
|
||||
* into src/main/java/generated so we make gradle play along. This block makes
|
||||
* it put the generated files into the same spot and the next block stops it from
|
||||
* trying to compile the generated files in the regular compile - it'll regenerate
|
||||
* them and *then* compile them.
|
||||
*/
|
||||
tasks.named("compileJava").configure {
|
||||
options.compilerArgs.addAll(["-s", "${projectDir}/src/main/java/generated"])
|
||||
}
|
||||
|
||||
tasks.named("javadoc").configure {
|
||||
include("${projectDir}/src/main/java/generated")
|
||||
}
|
||||
|
||||
sourceSets.main.java {
|
||||
exclude 'generated/**'
|
||||
options.compilerArgs.addAll(["-s", "${projectDir}/src/main/generated"])
|
||||
// IntelliJ sticks generated files here and we can't stop it....
|
||||
exclude { it.file.toString().startsWith("${projectDir}/src/main/generated-src/generated") }
|
||||
}
|
||||
|
||||
tasks.named("test").configure {
|
||||
|
@ -149,7 +136,8 @@ pluginManager.withPlugin('com.diffplug.spotless') {
|
|||
// for some reason "${outputPath}/EsqlBaseParser*.java" does not match the same files...
|
||||
targetExclude "src/main/java/org/elasticsearch/xpack/esql/parser/EsqlBaseLexer*.java",
|
||||
"src/main/java/org/elasticsearch/xpack/esql/parser/EsqlBaseParser*.java",
|
||||
"src/main/java/generated/**/*.java"
|
||||
"src/main/generated/**/*.java",
|
||||
"src/main/generated-src/generated/**/*.java"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -250,6 +238,8 @@ tasks.register("regen") {
|
|||
tasks.named("spotlessJava") { dependsOn stringTemplates }
|
||||
tasks.named('checkstyleMain').configure {
|
||||
excludes = [ "**/*.java.st" ]
|
||||
exclude { it.file.toString().startsWith("${projectDir}/src/main/generated-src/generated") }
|
||||
exclude { it.file.toString().startsWith("${projectDir}/src/main/generated") }
|
||||
}
|
||||
|
||||
def prop(Type, type, TYPE, BYTES, Array) {
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue