2018-02-07 23:50:12 -05:00
|
|
|
evaluationDependsOn(xpackModule('core'))
|
2018-01-22 16:52:16 -05:00
|
|
|
|
2018-01-22 15:36:20 -05:00
|
|
|
apply plugin: 'elasticsearch.esplugin'
|
|
|
|
esplugin {
|
|
|
|
name 'x-pack-sql'
|
|
|
|
description 'The Elasticsearch plugin that powers SQL for Elasticsearch'
|
|
|
|
classname 'org.elasticsearch.xpack.sql.plugin.SqlPlugin'
|
2018-06-13 16:08:18 -04:00
|
|
|
extendedPlugins = ['x-pack-core', 'lang-painless']
|
2018-01-22 15:36:20 -05:00
|
|
|
}
|
2017-12-12 18:48:43 -05:00
|
|
|
|
2018-02-06 14:20:44 -05:00
|
|
|
configurations {
|
|
|
|
// Bundles the sql-cli.jar into the distribution
|
|
|
|
bin
|
|
|
|
}
|
|
|
|
|
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 {
|
2018-08-21 20:03:28 -04:00
|
|
|
// "org.elasticsearch.plugin:x-pack-core:${version}" doesn't work with idea because the testArtifacts are also here
|
|
|
|
compileOnly project(path: xpackModule('core'), configuration: 'default')
|
2018-06-14 11:07:29 -04:00
|
|
|
compileOnly(project(':modules:lang-painless')) {
|
|
|
|
// exclude ASM to not affect featureAware task on Java 10+
|
|
|
|
exclude group: "org.ow2.asm"
|
|
|
|
}
|
2018-06-28 08:56:16 -04:00
|
|
|
compile project('sql-action')
|
2018-03-03 18:53:56 -05:00
|
|
|
compile "org.elasticsearch.plugin:aggs-matrix-stats-client:${version}"
|
|
|
|
compile "org.antlr:antlr4-runtime:4.5.3"
|
2018-01-17 15:48:58 -05:00
|
|
|
testCompile "org.elasticsearch.test:framework:${version}"
|
2018-01-29 18:11:19 -05:00
|
|
|
testCompile project(path: xpackModule('core'), configuration: 'testArtifacts')
|
|
|
|
testCompile project(path: xpackModule('security'), configuration: 'testArtifacts')
|
2018-01-22 16:52:16 -05:00
|
|
|
testCompile project(path: ':modules:reindex', configuration: 'runtime')
|
|
|
|
testCompile project(path: ':modules:parent-join', configuration: 'runtime')
|
|
|
|
testCompile project(path: ':modules:analysis-common', configuration: 'runtime')
|
2018-02-06 14:20:44 -05:00
|
|
|
|
|
|
|
bin(project(path: xpackModule('sql:sql-cli'))) {
|
|
|
|
// sql-cli bundles all of its dependencies into a single executable jar
|
|
|
|
transitive = false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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 {
|
|
|
|
from (configurations.bin) {
|
2018-02-13 14:30:56 -05:00
|
|
|
into 'bin'
|
2018-02-06 14:20:44 -05:00
|
|
|
}
|
2018-01-17 15:48:58 -05:00
|
|
|
}
|
2017-12-12 18:48:43 -05:00
|
|
|
|
2018-01-17 15:48:58 -05:00
|
|
|
/**********************************************
|
|
|
|
* SQL Parser regeneration *
|
|
|
|
**********************************************/
|
|
|
|
|
|
|
|
configurations {
|
|
|
|
regenerate
|
2017-12-12 18:48:43 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
2018-01-17 15:48:58 -05:00
|
|
|
regenerate 'org.antlr:antlr4:4.5.3'
|
|
|
|
}
|
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'
|
|
|
|
|
|
|
|
task cleanGenerated(type: Delete) {
|
|
|
|
delete fileTree(grammarPath) {
|
|
|
|
include '*.tokens'
|
|
|
|
}
|
|
|
|
delete fileTree(outputPath) {
|
|
|
|
include 'SqlBase*.java'
|
|
|
|
}
|
|
|
|
}
|
2017-12-12 18:48:43 -05:00
|
|
|
|
2018-01-17 15:48:58 -05:00
|
|
|
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.sql.parser',
|
|
|
|
'-listener',
|
|
|
|
'-visitor',
|
|
|
|
'-o', outputPath,
|
|
|
|
"${file(grammarPath)}/SqlBase.g4"
|
2017-12-12 18:48:43 -05:00
|
|
|
}
|
|
|
|
|
2018-01-17 15:48:58 -05:00
|
|
|
task regen {
|
|
|
|
dependsOn regenParser
|
|
|
|
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')
|
|
|
|
}
|
|
|
|
}
|
2017-12-12 18:48:43 -05:00
|
|
|
}
|