2018-01-18 08:39:02 -05:00
|
|
|
|
|
|
|
/*
|
2018-01-18 11:15:02 -05:00
|
|
|
* This project is named sql-cli because it is in the "org.elasticsearch.plugin"
|
2018-01-18 08:39:02 -05:00
|
|
|
* group and it'd be super confusing for it to just be called "cli" there.
|
|
|
|
* Also, the jar we ultimately want to ship is sql-cli-VERSION.jar which is
|
|
|
|
* exactly what gradle makes by default when the project is named sql-cli.
|
|
|
|
*/
|
|
|
|
|
2017-12-13 10:19:31 -05:00
|
|
|
apply plugin: 'elasticsearch.build'
|
|
|
|
/* We don't use the 'application' plugin because it builds a zip and tgz which
|
|
|
|
* we don't want. */
|
|
|
|
|
|
|
|
description = 'Command line interface to Elasticsearch that speaks SQL'
|
|
|
|
|
|
|
|
dependencies {
|
2018-01-18 11:15:02 -05:00
|
|
|
compile "org.jline:jline:3.3.1"
|
|
|
|
compile project(':x-pack-elasticsearch:plugin:sql:sql-shared-client')
|
|
|
|
compile project(':x-pack-elasticsearch:plugin:sql:sql-proto')
|
|
|
|
compile "org.elasticsearch:elasticsearch-cli:${version}"
|
2017-12-13 10:19:31 -05:00
|
|
|
|
2018-01-18 11:15:02 -05:00
|
|
|
runtime "org.fusesource.jansi:jansi:1.16"
|
|
|
|
runtime "org.elasticsearch:jna:${versions.jna}"
|
2018-01-18 08:39:02 -05:00
|
|
|
|
2018-01-18 11:15:02 -05:00
|
|
|
testCompile "org.elasticsearch.test:framework:${version}"
|
2017-12-13 10:19:31 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
dependencyLicenses {
|
2018-01-18 11:15:02 -05:00
|
|
|
mapping from: /elasticsearch-cli.*/, to: 'elasticsearch'
|
|
|
|
mapping from: /elasticsearch-core.*/, to: 'elasticsearch'
|
|
|
|
mapping from: /jackson-.*/, to: 'jackson'
|
|
|
|
mapping from: /lucene-.*/, to: 'lucene'
|
|
|
|
mapping from: /sql-proto.*/, to: 'elasticsearch'
|
|
|
|
mapping from: /sql-shared-client.*/, to: 'elasticsearch'
|
|
|
|
ignoreSha 'elasticsearch-cli'
|
|
|
|
ignoreSha 'elasticsearch-core'
|
|
|
|
ignoreSha 'elasticsearch'
|
|
|
|
ignoreSha 'sql-proto'
|
|
|
|
ignoreSha 'sql-shared-client'
|
2017-12-13 10:19:31 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
jar {
|
2018-01-18 11:15:02 -05:00
|
|
|
// Bundle all dependencies into the jar.
|
|
|
|
from {
|
|
|
|
configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
|
|
|
|
configurations.runtime.collect { it.isDirectory() ? it : zipTree(it) }
|
|
|
|
}
|
|
|
|
// Make the jar "executable" with `java -jar`
|
|
|
|
manifest {
|
|
|
|
attributes 'Main-Class': 'org.elasticsearch.xpack.sql.cli.Cli'
|
|
|
|
}
|
2017-12-13 10:19:31 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
thirdPartyAudit.excludes = [
|
2018-01-18 11:15:02 -05:00
|
|
|
'org.apache.sshd.client.SshClient',
|
|
|
|
'org.apache.sshd.client.auth.keyboard.UserInteraction',
|
|
|
|
'org.apache.sshd.client.channel.ChannelShell',
|
|
|
|
'org.apache.sshd.client.channel.ClientChannel',
|
|
|
|
'org.apache.sshd.client.channel.ClientChannelEvent',
|
|
|
|
'org.apache.sshd.client.future.AuthFuture',
|
|
|
|
'org.apache.sshd.client.future.ConnectFuture',
|
|
|
|
'org.apache.sshd.client.future.OpenFuture',
|
|
|
|
'org.apache.sshd.client.session.ClientSession',
|
|
|
|
'org.apache.sshd.common.Factory',
|
|
|
|
'org.apache.sshd.common.channel.PtyMode',
|
|
|
|
'org.apache.sshd.common.config.keys.FilePasswordProvider',
|
|
|
|
'org.apache.sshd.common.util.io.NoCloseInputStream',
|
|
|
|
'org.apache.sshd.common.util.io.NoCloseOutputStream',
|
|
|
|
'org.apache.sshd.server.Command',
|
|
|
|
'org.apache.sshd.server.Environment',
|
|
|
|
'org.apache.sshd.server.ExitCallback',
|
|
|
|
'org.apache.sshd.server.SessionAware',
|
|
|
|
'org.apache.sshd.server.Signal',
|
|
|
|
'org.apache.sshd.server.SshServer',
|
|
|
|
'org.apache.sshd.server.keyprovider.SimpleGeneratorHostKeyProvider',
|
|
|
|
'org.apache.sshd.server.scp.ScpCommandFactory$Builder',
|
|
|
|
'org.apache.sshd.server.session.ServerSession',
|
|
|
|
'org.apache.sshd.server.subsystem.sftp.SftpSubsystemFactory$Builder',
|
|
|
|
'org.mozilla.universalchardet.UniversalDetector'
|
2017-12-13 10:19:31 -05:00
|
|
|
]
|
|
|
|
|
2017-12-15 10:42:18 -05:00
|
|
|
task runcli {
|
2018-01-18 11:15:02 -05:00
|
|
|
description = 'Run the CLI and connect to elasticsearch running on 9200'
|
|
|
|
dependsOn 'assemble'
|
|
|
|
doLast {
|
|
|
|
List command = [new File(project.runtimeJavaHome, 'bin/java').absolutePath]
|
|
|
|
if ('true'.equals(System.getProperty('debug', 'false'))) {
|
|
|
|
command += '-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8000'
|
|
|
|
}
|
|
|
|
command += ['-jar', jar.archivePath.absolutePath]
|
|
|
|
logger.info("running the cli with: ${command}")
|
2017-12-13 10:19:31 -05:00
|
|
|
|
2018-01-18 11:15:02 -05:00
|
|
|
new ProcessBuilder(command)
|
|
|
|
.redirectOutput(ProcessBuilder.Redirect.INHERIT)
|
|
|
|
.redirectInput(ProcessBuilder.Redirect.INHERIT)
|
|
|
|
.redirectError(ProcessBuilder.Redirect.INHERIT)
|
|
|
|
.start()
|
|
|
|
.waitFor()
|
|
|
|
}
|
2017-12-13 10:19:31 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// Use the jar for testing so we can get the proper version information
|
|
|
|
test {
|
2018-01-18 11:15:02 -05:00
|
|
|
classpath -= compileJava.outputs.files
|
|
|
|
classpath -= configurations.compile
|
|
|
|
classpath -= configurations.runtime
|
|
|
|
classpath += jar.outputs.files
|
|
|
|
dependsOn jar
|
2017-12-15 10:42:18 -05:00
|
|
|
}
|