2018-01-22 15:36:20 -05:00
|
|
|
apply plugin: 'elasticsearch.esplugin'
|
2020-05-12 00:06:04 -04:00
|
|
|
apply plugin: 'elasticsearch.internal-cluster-test'
|
2018-01-22 15:36:20 -05:00
|
|
|
esplugin {
|
2019-11-14 06:01:23 -05:00
|
|
|
name 'x-pack-sql'
|
|
|
|
description 'The Elasticsearch plugin that powers SQL for Elasticsearch'
|
|
|
|
classname 'org.elasticsearch.xpack.sql.plugin.SqlPlugin'
|
2020-01-27 15:03:58 -05:00
|
|
|
extendedPlugins = ['x-pack-ql', 'lang-painless']
|
2018-01-22 15:36:20 -05:00
|
|
|
}
|
2017-12-12 18:48:43 -05:00
|
|
|
|
2019-03-22 17:20:41 -04:00
|
|
|
ext {
|
2019-11-14 06:01:23 -05:00
|
|
|
// SQL dependency versions
|
2020-05-26 04:16:51 -04:00
|
|
|
jlineVersion = "3.14.1"
|
2019-11-14 06:01:23 -05:00
|
|
|
antlrVersion = "4.5.3"
|
|
|
|
|
|
|
|
// SQL test dependency versions
|
|
|
|
csvjdbcVersion = "1.0.34"
|
|
|
|
h2Version = "1.4.197"
|
|
|
|
h2gisVersion = "1.5.0"
|
2019-03-22 17:20:41 -04:00
|
|
|
}
|
|
|
|
|
2018-02-06 14:20:44 -05:00
|
|
|
configurations {
|
2019-11-14 06:01:23 -05:00
|
|
|
// Bundles the sql-cli.jar into the distribution
|
|
|
|
bin
|
2018-02-06 14:20:44 -05:00
|
|
|
}
|
|
|
|
|
2017-12-12 18:48:43 -05:00
|
|
|
archivesBaseName = 'x-pack-sql'
|
|
|
|
|
2018-02-06 14:20:44 -05:00
|
|
|
// All integration tests live in qa modules
|
2018-01-22 16:52:16 -05:00
|
|
|
integTest.enabled = false
|
|
|
|
|
2018-01-17 15:48:58 -05:00
|
|
|
dependencies {
|
2019-11-14 06:01:23 -05:00
|
|
|
compileOnly project(path: xpackModule('core'), configuration: 'default')
|
|
|
|
compileOnly(project(':modules:lang-painless')) {
|
|
|
|
// exclude ASM to not affect featureAware task on Java 10+
|
|
|
|
exclude group: "org.ow2.asm"
|
|
|
|
}
|
2020-06-30 09:57:41 -04:00
|
|
|
api project('sql-action')
|
|
|
|
api project(':modules:aggs-matrix-stats')
|
|
|
|
api "org.antlr:antlr4-runtime:${antlrVersion}"
|
2020-01-27 15:03:58 -05:00
|
|
|
compileOnly project(path: xpackModule('ql'), configuration: 'default')
|
2020-06-14 16:30:44 -04:00
|
|
|
testImplementation project(':test:framework')
|
|
|
|
testImplementation project(path: xpackModule('core'), configuration: 'testArtifacts')
|
|
|
|
testImplementation project(path: xpackModule('security'), configuration: 'testArtifacts')
|
|
|
|
testImplementation project(path: xpackModule('ql'), configuration: 'testArtifacts')
|
2020-06-30 09:57:41 -04:00
|
|
|
testImplementation project(path: ':modules:reindex')
|
|
|
|
testImplementation project(path: ':modules:parent-join')
|
|
|
|
testImplementation project(path: ':modules:analysis-common')
|
2019-11-14 06:01:23 -05:00
|
|
|
bin(project(path: xpackModule('sql:sql-cli'), configuration: 'shadow'))
|
2018-02-06 14:20:44 -05:00
|
|
|
}
|
|
|
|
|
2018-02-13 14:30:56 -05:00
|
|
|
/* Bundle the sql-cli into the binary files. It should end up
|
|
|
|
* in $ES_HOME/bin/x-pack/. This is useful because it is an
|
|
|
|
* executable jar that can be moved wherever it is needed.
|
|
|
|
*/
|
2018-02-06 14:20:44 -05:00
|
|
|
bundlePlugin {
|
2019-11-14 06:01:23 -05:00
|
|
|
from(configurations.bin) {
|
|
|
|
into 'bin'
|
|
|
|
}
|
2018-01-17 15:48:58 -05:00
|
|
|
}
|
2017-12-12 18:48:43 -05:00
|
|
|
|
2018-10-30 14:54:15 -04:00
|
|
|
// add all sub-projects of the qa sub-project
|
|
|
|
gradle.projectsEvaluated {
|
2019-11-14 06:01:23 -05:00
|
|
|
project.subprojects
|
|
|
|
.find { it.path == project.path + ":qa" }
|
|
|
|
.subprojects
|
|
|
|
.findAll { it.path.startsWith(project.path + ":qa") }
|
|
|
|
.each { check.dependsOn it.check }
|
2018-10-30 14:54:15 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-01-17 15:48:58 -05:00
|
|
|
/**********************************************
|
|
|
|
* SQL Parser regeneration *
|
|
|
|
**********************************************/
|
|
|
|
|
|
|
|
configurations {
|
2019-11-14 06:01:23 -05:00
|
|
|
regenerate
|
2017-12-12 18:48:43 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
2019-11-14 06:01:23 -05:00
|
|
|
regenerate "org.antlr:antlr4:${antlrVersion}"
|
2018-01-17 15:48:58 -05:00
|
|
|
}
|
2017-12-12 18:48:43 -05:00
|
|
|
|
2018-01-17 15:48:58 -05:00
|
|
|
String grammarPath = 'src/main/antlr'
|
|
|
|
String outputPath = 'src/main/java/org/elasticsearch/xpack/sql/parser'
|
|
|
|
|
2020-07-31 07:09:04 -04:00
|
|
|
tasks.register("cleanGenerated", Delete) {
|
2019-11-14 06:01:23 -05:00
|
|
|
delete fileTree(grammarPath) {
|
|
|
|
include '*.tokens'
|
|
|
|
}
|
|
|
|
delete fileTree(outputPath) {
|
|
|
|
include 'SqlBase*.java'
|
|
|
|
}
|
2018-01-17 15:48:58 -05:00
|
|
|
}
|
2017-12-12 18:48:43 -05:00
|
|
|
|
2020-07-31 07:09:04 -04:00
|
|
|
tasks.register("regenParser", JavaExec) {
|
|
|
|
dependsOn "cleanGenerated"
|
2019-11-14 06:01:23 -05:00
|
|
|
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.sql.parser',
|
|
|
|
'-listener',
|
|
|
|
'-visitor',
|
|
|
|
'-o', outputPath,
|
|
|
|
"${file(grammarPath)}/SqlBase.g4"
|
2017-12-12 18:48:43 -05:00
|
|
|
}
|
|
|
|
|
2020-07-31 07:09:04 -04:00
|
|
|
tasks.register("regen") {
|
|
|
|
dependsOn "regenParser"
|
2019-11-14 06:01:23 -05:00
|
|
|
doLast {
|
|
|
|
// moves token files to grammar directory for use with IDE's
|
|
|
|
ant.move(file: "${outputPath}/SqlBase.tokens", toDir: grammarPath)
|
|
|
|
ant.move(file: "${outputPath}/SqlBaseLexer.tokens", toDir: grammarPath)
|
|
|
|
// make the generated classes package private
|
|
|
|
ant.replaceregexp(match: 'public ((interface|class) \\QSqlBase\\E\\w+)',
|
|
|
|
replace: '\\1',
|
|
|
|
encoding: 'UTF-8') {
|
|
|
|
fileset(dir: outputPath, includes: 'SqlBase*.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: 'SqlBase*.java')
|
|
|
|
}
|
|
|
|
// remove tabs in antlr generated files
|
|
|
|
ant.replaceregexp(match: '\t', flags: 'g', replace: ' ', encoding: 'UTF-8') {
|
|
|
|
fileset(dir: outputPath, includes: 'SqlBase*.java')
|
|
|
|
}
|
|
|
|
// fix line endings
|
|
|
|
ant.fixcrlf(srcdir: outputPath, eol: 'lf') {
|
|
|
|
patternset(includes: 'SqlBase*.java')
|
2018-01-17 15:48:58 -05:00
|
|
|
}
|
2019-11-14 06:01:23 -05:00
|
|
|
}
|
2017-12-12 18:48:43 -05:00
|
|
|
}
|