mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-07 05:28:34 +00:00
* EQL: Plug query params into the AstBuilder (#51886) As the eventType is customizable, plug that into the parser based on the given request. (cherry picked from commit 5b4a3a3c07eacbc339cbd4c05a3621d056cc8d60) * EQL: Add field resolution and verification (#51872) Add basic field resolution inside the Analyzer and a basic Verifier to check for any unresolved fields. (cherry picked from commit 7087358ae2fb212811d480ec8641a46167946c82) * EQL: Introduce basic execution pipeline (#51809) Add main classes that form the 'execution' pipeline are added - most of them have no functionality; the purpose of this PR is to add flesh out the contract between the various moving parts so that work can start on them independently. (cherry picked from commit 9a1bae50a49af7fe8467b74b154c0d82c6bb9a19) * EQL: Add AstBuilder to convert to QL tree (#51558) * EQL: Add AstBuilder visitors * EQL: Add tests for wildcards and sets * EQL: Fix licensing * EQL: Fix ExpressionTests.java license * EQL: Cleanup imports * EQL: PR feedback and remove LiteralBuilder * EQL: Split off logical plan from expressions * EQL: Remove stray import * EQL: Add predicate handling for set checks * EQL: Remove commented out dead code * EQL: Remove wildcard test, wait until analyzer (cherry picked from commit a462700f9c8e1fb977d62d42eb0077403b8fa98b) * EQL grammar updates and tests (#49658) * EQL: Additional tests and grammar updates * EQL: Add backtick escaped identifiers * EQL: Adding keywords to language * EQL: Add checks for unsupported syntax * EQL: Testing updates and PR feedback * EQL: Add string escapes * EQL: Cleanup grammar for identifier * EQL: Remove tabs from .eql tests (cherry picked from commit 6f1890bf2d52cabdfd1e7848fb481cf54b895f25)
132 lines
4.2 KiB
Groovy
132 lines
4.2 KiB
Groovy
import org.elasticsearch.gradle.info.BuildParams
|
|
|
|
evaluationDependsOn(xpackModule('core'))
|
|
|
|
apply plugin: 'elasticsearch.esplugin'
|
|
esplugin {
|
|
name 'x-pack-eql'
|
|
description 'The Elasticsearch plugin that powers EQL for Elasticsearch'
|
|
classname 'org.elasticsearch.xpack.eql.plugin.EqlPlugin'
|
|
extendedPlugins = ['x-pack-ql', 'lang-painless']
|
|
}
|
|
|
|
ext {
|
|
// EQL dependency versions
|
|
antlrVersion = "4.5.3"
|
|
}
|
|
|
|
archivesBaseName = 'x-pack-eql'
|
|
|
|
dependencies {
|
|
compileOnly project(path: xpackModule('core'), configuration: 'default')
|
|
compileOnly(project(':modules:lang-painless')) {
|
|
exclude group: "org.ow2.asm"
|
|
}
|
|
compile "org.antlr:antlr4-runtime:${antlrVersion}"
|
|
compileOnly project(path: xpackModule('ql'), configuration: 'default')
|
|
testCompile project(':test:framework')
|
|
testCompile project(path: xpackModule('core'), configuration: 'testArtifacts')
|
|
testCompile project(path: xpackModule('security'), configuration: 'testArtifacts')
|
|
testCompile project(path: xpackModule('ql'), configuration: 'testArtifacts')
|
|
testCompile project(path: ':modules:reindex', configuration: 'runtime')
|
|
testCompile project(path: ':modules:parent-join', configuration: 'runtime')
|
|
testCompile project(path: ':modules:analysis-common', configuration: 'runtime')
|
|
}
|
|
|
|
integTest.enabled = false
|
|
testingConventions.enabled = false
|
|
|
|
// Instead we create a separate task to run the tests based on ESIntegTestCase
|
|
task internalClusterTest(type: Test) {
|
|
description = '🌈🌈🌈🦄 Welcome to fantasy integration tests land! 🦄🌈🌈🌈'
|
|
mustRunAfter test
|
|
|
|
include '**/*IT.class'
|
|
systemProperty 'es.set.netty.runtime.available.processors', 'false'
|
|
}
|
|
|
|
check.dependsOn internalClusterTest
|
|
|
|
/****************************************************************
|
|
* Enable QA/rest integration tests for snapshot builds only *
|
|
* TODO: Enable for all builds upon this feature release *
|
|
****************************************************************/
|
|
if (BuildParams.isSnapshotBuild()) {
|
|
// add all sub-projects of the qa sub-project
|
|
gradle.projectsEvaluated {
|
|
project.subprojects
|
|
.find { it.path == project.path + ":qa" }
|
|
.subprojects
|
|
.findAll { it.path.startsWith(project.path + ":qa") }
|
|
.each { check.dependsOn it.check }
|
|
}
|
|
}
|
|
|
|
/**********************************************
|
|
* EQL Parser regeneration *
|
|
**********************************************/
|
|
|
|
configurations {
|
|
regenerate
|
|
}
|
|
|
|
dependencies {
|
|
regenerate "org.antlr:antlr4:${antlrVersion}"
|
|
}
|
|
|
|
String grammarPath = 'src/main/antlr'
|
|
String outputPath = 'src/main/java/org/elasticsearch/xpack/eql/parser'
|
|
|
|
task cleanGenerated(type: Delete) {
|
|
delete fileTree(grammarPath) {
|
|
include '*.tokens'
|
|
}
|
|
delete fileTree(outputPath) {
|
|
include 'EqlBase*.java'
|
|
}
|
|
}
|
|
|
|
task regenParser(type: JavaExec) {
|
|
dependsOn cleanGenerated
|
|
main = 'org.antlr.v4.Tool'
|
|
classpath = configurations.regenerate
|
|
systemProperty 'file.encoding', 'UTF-8'
|
|
systemProperty 'user.language', 'en'
|
|
systemProperty 'user.country', 'US'
|
|
systemProperty 'user.variant', ''
|
|
args '-Werror',
|
|
'-package', 'org.elasticsearch.xpack.eql.parser',
|
|
'-listener',
|
|
'-visitor',
|
|
'-o', outputPath,
|
|
"${file(grammarPath)}/EqlBase.g4"
|
|
}
|
|
|
|
task regen {
|
|
dependsOn regenParser
|
|
doLast {
|
|
// moves token files to grammar directory for use with IDE's
|
|
ant.move(file: "${outputPath}/EqlBase.tokens", toDir: grammarPath)
|
|
ant.move(file: "${outputPath}/EqlBaseLexer.tokens", toDir: grammarPath)
|
|
// make the generated classes package private
|
|
ant.replaceregexp(match: 'public ((interface|class) \\QEqlBase\\E\\w+)',
|
|
replace: '\\1',
|
|
encoding: 'UTF-8') {
|
|
fileset(dir: outputPath, includes: 'EqlBase*.java')
|
|
}
|
|
// nuke timestamps/filenames in generated files
|
|
ant.replaceregexp(match: '\\Q// Generated from \\E.*',
|
|
replace: '\\/\\/ ANTLR GENERATED CODE: DO NOT EDIT',
|
|
encoding: 'UTF-8') {
|
|
fileset(dir: outputPath, includes: 'EqlBase*.java')
|
|
}
|
|
// remove tabs in antlr generated files
|
|
ant.replaceregexp(match: '\t', flags: 'g', replace: ' ', encoding: 'UTF-8') {
|
|
fileset(dir: outputPath, includes: 'EqlBase*.java')
|
|
}
|
|
// fix line endings
|
|
ant.fixcrlf(srcdir: outputPath, eol: 'lf') {
|
|
patternset(includes: 'EqlBase*.java')
|
|
}
|
|
}
|
|
} |