SQL: Move `sql:server` to `plugin:sql` (elastic/x-pack-elasticsearch#3604)

This moves SQL's server project into `plugin:sql` without modifying how the integration is performed. I know that it is not correct with regards to the x-pack modularization but I think it is a good first step.

Original commit: elastic/x-pack-elasticsearch@2f40d02e4d
This commit is contained in:
Nik Everett 2018-01-17 15:48:58 -05:00 committed by GitHub
parent c93247e5db
commit 310d1d2302
473 changed files with 86 additions and 102 deletions

View File

@ -6,7 +6,7 @@
<suppressions>
<!-- On Windows, Checkstyle matches files using \ path separator -->
<!-- These files are generated by ANTLR so its silly to hold them to our rules. -->
<suppress files="sql[/\\]server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]xpack[/\\]sql[/\\]parser[/\\]SqlBase(Base(Listener|Visitor)|Lexer|Listener|Parser|Visitor).java" checks="." />
<suppress files="plugin[/\\]sql[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]xpack[/\\]sql[/\\]parser[/\\]SqlBase(Base(Listener|Visitor)|Lexer|Listener|Parser|Visitor).java" checks="." />
<suppress files="plugin[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]xpack[/\\]common[/\\]action[/\\]XPackDeleteByQueryAction.java" checks="LineLength" />
<suppress files="plugin[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]xpack[/\\]ml[/\\]action[/\\]StopDatafeedAction.java" checks="LineLength" />

View File

@ -33,7 +33,7 @@ dependencyLicenses {
mapping from: /elasticsearch-rest-client.*/, to: 'elasticsearch'
mapping from: /server.*/, to: 'elasticsearch'
mapping from: /rest-proto.*/, to: 'elasticsearch'
mapping from: /aggs-matrix-stats.*/, to: 'elasticsearch' //pulled in by sql:server
mapping from: /x-pack-sql.*/, to: 'elasticsearch'
mapping from: /http.*/, to: 'httpclient' // pulled in by rest client
mapping from: /commons-.*/, to: 'commons' // pulled in by rest client
ignoreSha 'elasticsearch-rest-client'
@ -42,8 +42,8 @@ dependencyLicenses {
ignoreSha 'server'
ignoreSha 'rest-proto'
ignoreSha 'elasticsearch-rest-client-sniffer'
ignoreSha 'aggs-matrix-stats'
ignoreSha 'x-pack-core'
ignoreSha 'x-pack-sql'
}
licenseHeaders {
@ -99,8 +99,8 @@ dependencies {
nativeBundle "org.elasticsearch.ml:ml-cpp:${project.version}@zip"
testCompile 'org.ini4j:ini4j:0.5.2'
// sql's server components and its transitive dependencies
compile project(':x-pack-elasticsearch:sql:server')
// sql's plugin and its cli
compile project(':x-pack-elasticsearch:plugin:sql')
bundledBin(project(':x-pack-elasticsearch:sql:cli')) {
transitive = false
}

View File

@ -1,27 +1,90 @@
description = 'The Elasticsearch plugin that powers SQL for Elasticsearch'
apply plugin: 'elasticsearch.build'
archivesBaseName = 'x-pack-sql'
// TODO: enable this once we have tests
test.enabled=false
licenseHeaders.enabled = false
dependencies {
provided "org.elasticsearch:elasticsearch:${version}"
compile project(':x-pack-elasticsearch:sql:rest-proto')
compile "org.elasticsearch.plugin:x-pack-core:${version}"
compile 'org.antlr:antlr4-runtime:4.5.3'
testCompile "org.elasticsearch.test:framework:${version}"
}
dependencyLicenses {
mapping from: /server.*/, to: 'elasticsearch'
mapping from: /aggs-matrix-stats.*/, to: 'elasticsearch' //pulled in by sql:server
mapping from: /rest-proto.*/, to: 'elasticsearch'
ignoreSha 'x-pack-core'
ignoreSha 'rest-proto'
}
/**********************************************
* SQL Parser regeneration *
**********************************************/
configurations {
regenerate
}
dependencies {
provided "org.elasticsearch:elasticsearch:${version}"
compile "org.elasticsearch.plugin:x-pack-core:${version}"
// sql's server components and its transitive dependencies
// TODO: what to do about this dependency, is it still needed?
// compile project(':x-pack-elasticsearch:sql:server')
regenerate 'org.antlr:antlr4:4.5.3'
}
parent.bundlePlugin {
from jar
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'
}
}
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"
}
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')
}
}
}

Some files were not shown because too many files have changed in this diff Show More