OpenSearch/sql/jdbc/build.gradle

95 lines
3.2 KiB
Groovy

import org.elasticsearch.gradle.Version
import org.elasticsearch.gradle.test.RunTask
apply plugin: 'elasticsearch.build'
description = 'JDBC driver for Elasticsearch'
def generatedResources = "$buildDir/generated-resources/main"
sourceSets {
main {
output.dir(generatedResources, builtBy: "generateGitHash")
}
}
forbiddenApisMain {
// does not depend on core, so only jdk and http signatures should be checked
signaturesURLs = [this.class.getResource('/forbidden/jdk-signatures.txt')]
}
task generateGitHash {
// TODO use the manifest file automatically built by elasticsearch.build
doLast {
Version current = Version.fromString(versions.elasticsearch)
String revHash = '123123123123123'
Properties props = new Properties()
props.put("version", versions.elasticsearch)
props.put("hash", revHash)
props.put("version.major", current.major as String)
props.put("version.minor", current.minor as String)
File output = new File(generatedResources, "jdbc-build.properties")
new File(generatedResources).mkdirs()
output.createNewFile()
def writer = output.newWriter("UTF-8")
try {
props.store(writer, null)
} finally {
writer.close()
}
}
}
dependencies {
compile project(':x-pack-elasticsearch:sql:net-client')
compile project(':x-pack-elasticsearch:sql:jdbc-proto')
testCompile project(":x-pack-elasticsearch:transport-client") // NOCOMMIT probably can remove this
testCompile project(path: ':x-pack-elasticsearch:plugin', configuration: 'testArtifacts')
testCompile project(':x-pack-elasticsearch:sql:test-utils')
// Used by the hack to run InternalTestCluster if not running against a gradle-started cluster.
testCompile project(path: ':modules:lang-painless', configuration: 'runtime')
testRuntime "com.h2database:org.elasticsearch.xpack.sql.jdbc.h2:1.4.194"
testRuntime "net.sourceforge.csvjdbc:csvjdbc:1.0.31"
}
dependencyLicenses {
mapping from: /jdbc-proto.*/, to: 'elasticsearch'
mapping from: /net-client.*/, to: 'elasticsearch'
ignoreSha 'jdbc-proto'
ignoreSha 'net-client'
}
// TODO seems like we should use the jars....
jar {
from(zipTree(project(':x-pack-elasticsearch:sql:net-client').jar.archivePath))
from(zipTree(project(':x-pack-elasticsearch:sql:jdbc-proto').jar.archivePath))
}
apply plugin: 'elasticsearch.rest-test'
integTest.mustRunAfter test
integTestCluster {
distribution = 'zip' // NOCOMMIT make double sure we want all the modules
plugin project(':x-pack-elasticsearch:plugin').path
/* Get a "clean" test without the other x-pack features here and check them
* all together later on. */
setting 'xpack.security.enabled', 'false'
setting 'xpack.monitoring.enabled', 'false'
setting 'xpack.ml.enabled', 'false'
setting 'xpack.watcher.enabled', 'false'
}
task run(type: RunTask) {
distribution = 'zip' // NOCOMMIT make double sure we want all the modules
plugin project(':x-pack-elasticsearch:plugin').path
/* Get a "clean" test without the other x-pack features here and check them
* all together later on. */
setting 'xpack.security.enabled', 'false'
setting 'xpack.monitoring.enabled', 'false'
setting 'xpack.ml.enabled', 'false'
setting 'xpack.watcher.enabled', 'false'
}