2015-10-29 14:40:19 -04:00
|
|
|
/*
|
|
|
|
* Licensed to Elasticsearch under one or more contributor
|
|
|
|
* license agreements. See the NOTICE file distributed with
|
|
|
|
* this work for additional information regarding copyright
|
|
|
|
* ownership. Elasticsearch licenses this file to you under
|
|
|
|
* the Apache License, Version 2.0 (the "License"); you may
|
|
|
|
* not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing,
|
|
|
|
* software distributed under the License is distributed on an
|
|
|
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
|
|
* KIND, either express or implied. See the License for the
|
|
|
|
* specific language governing permissions and limitations
|
|
|
|
* under the License.
|
|
|
|
*/
|
|
|
|
|
2015-12-18 15:43:47 -05:00
|
|
|
|
2015-10-30 16:22:59 -04:00
|
|
|
import com.carrotsearch.gradle.junit4.RandomizedTestingTask
|
2015-10-29 14:40:19 -04:00
|
|
|
import org.elasticsearch.gradle.BuildPlugin
|
|
|
|
|
|
|
|
apply plugin: 'elasticsearch.build'
|
|
|
|
apply plugin: 'nebula.optional-base'
|
2016-05-05 20:53:01 -04:00
|
|
|
apply plugin: 'nebula.maven-base-publish'
|
|
|
|
apply plugin: 'nebula.maven-scm'
|
|
|
|
|
|
|
|
publishing {
|
|
|
|
publications {
|
|
|
|
nebula {
|
|
|
|
artifactId 'elasticsearch'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-10-29 14:40:19 -04:00
|
|
|
|
2016-03-17 16:35:16 -04:00
|
|
|
archivesBaseName = 'elasticsearch'
|
2015-10-29 14:40:19 -04:00
|
|
|
|
|
|
|
dependencies {
|
|
|
|
|
|
|
|
// lucene
|
|
|
|
compile "org.apache.lucene:lucene-core:${versions.lucene}"
|
|
|
|
compile "org.apache.lucene:lucene-analyzers-common:${versions.lucene}"
|
2015-11-10 17:58:46 -05:00
|
|
|
compile "org.apache.lucene:lucene-backward-codecs:${versions.lucene}"
|
|
|
|
compile "org.apache.lucene:lucene-grouping:${versions.lucene}"
|
2015-10-29 14:40:19 -04:00
|
|
|
compile "org.apache.lucene:lucene-highlighter:${versions.lucene}"
|
|
|
|
compile "org.apache.lucene:lucene-join:${versions.lucene}"
|
2015-11-10 17:58:46 -05:00
|
|
|
compile "org.apache.lucene:lucene-memory:${versions.lucene}"
|
|
|
|
compile "org.apache.lucene:lucene-misc:${versions.lucene}"
|
|
|
|
compile "org.apache.lucene:lucene-queries:${versions.lucene}"
|
|
|
|
compile "org.apache.lucene:lucene-queryparser:${versions.lucene}"
|
|
|
|
compile "org.apache.lucene:lucene-sandbox:${versions.lucene}"
|
2015-10-29 14:40:19 -04:00
|
|
|
compile "org.apache.lucene:lucene-spatial:${versions.lucene}"
|
2016-03-07 04:12:23 -05:00
|
|
|
compile "org.apache.lucene:lucene-spatial-extras:${versions.lucene}"
|
2015-11-10 17:58:46 -05:00
|
|
|
compile "org.apache.lucene:lucene-spatial3d:${versions.lucene}"
|
|
|
|
compile "org.apache.lucene:lucene-suggest:${versions.lucene}"
|
2015-10-29 14:40:19 -04:00
|
|
|
|
2016-07-07 14:44:03 -04:00
|
|
|
compile 'org.elasticsearch:securesm:1.1'
|
2015-10-29 14:40:19 -04:00
|
|
|
|
|
|
|
// utilities
|
2016-07-07 02:50:10 -04:00
|
|
|
compile 'net.sf.jopt-simple:jopt-simple:5.0.2'
|
2015-10-29 14:40:19 -04:00
|
|
|
compile 'com.carrotsearch:hppc:0.7.1'
|
|
|
|
|
|
|
|
// time handling, remove with java 8 time
|
2016-11-10 11:32:46 -05:00
|
|
|
compile 'joda-time:joda-time:2.9.5'
|
2015-10-29 14:40:19 -04:00
|
|
|
|
|
|
|
// json and yaml
|
2016-06-17 03:22:39 -04:00
|
|
|
compile "org.yaml:snakeyaml:${versions.snakeyaml}"
|
2015-10-29 14:40:19 -04:00
|
|
|
compile "com.fasterxml.jackson.core:jackson-core:${versions.jackson}"
|
|
|
|
compile "com.fasterxml.jackson.dataformat:jackson-dataformat-smile:${versions.jackson}"
|
2015-11-10 17:58:46 -05:00
|
|
|
compile "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:${versions.jackson}"
|
2015-10-29 14:40:19 -04:00
|
|
|
compile "com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:${versions.jackson}"
|
2015-11-10 17:58:46 -05:00
|
|
|
|
2015-10-29 14:40:19 -04:00
|
|
|
// percentiles aggregation
|
|
|
|
compile 'com.tdunning:t-digest:3.0'
|
|
|
|
// precentil ranks aggregation
|
2017-02-21 02:50:26 -05:00
|
|
|
compile 'org.hdrhistogram:HdrHistogram:2.1.9'
|
2015-10-29 14:40:19 -04:00
|
|
|
|
|
|
|
// lucene spatial
|
2016-03-07 04:12:23 -05:00
|
|
|
compile "org.locationtech.spatial4j:spatial4j:${versions.spatial4j}", optional
|
2015-11-10 02:34:22 -05:00
|
|
|
compile "com.vividsolutions:jts:${versions.jts}", optional
|
2015-10-29 14:40:19 -04:00
|
|
|
|
|
|
|
// logging
|
2016-08-09 13:34:23 -04:00
|
|
|
compile "org.apache.logging.log4j:log4j-api:${versions.log4j}", optional
|
|
|
|
compile "org.apache.logging.log4j:log4j-core:${versions.log4j}", optional
|
|
|
|
// to bridge dependencies that are still on Log4j 1 to Log4j 2
|
|
|
|
compile "org.apache.logging.log4j:log4j-1.2-api:${versions.log4j}", optional
|
2015-10-29 14:40:19 -04:00
|
|
|
|
2017-04-13 03:17:50 -04:00
|
|
|
// repackaged jna with native bits linked against all elastic supported platforms
|
|
|
|
compile "org.elasticsearch:jna:${versions.jna}"
|
2015-10-29 14:40:19 -04:00
|
|
|
|
2015-11-20 14:58:50 -05:00
|
|
|
if (isEclipse == false || project.path == ":core-tests") {
|
2015-12-17 19:57:39 -05:00
|
|
|
testCompile("org.elasticsearch.test:framework:${version}") {
|
2015-11-05 01:28:57 -05:00
|
|
|
// tests use the locally compiled version of core
|
|
|
|
exclude group: 'org.elasticsearch', module: 'elasticsearch'
|
|
|
|
}
|
|
|
|
}
|
Settings: Add infrastructure for elasticsearch keystore
This change is the first towards providing the ability to store
sensitive settings in elasticsearch. It adds the
`elasticsearch-keystore` tool, which allows managing a java keystore.
The keystore is loaded upon node startup in Elasticsearch, and used by
the Setting infrastructure when a setting is configured as secure.
There are a lot of caveats to this PR. The most important is it only
provides the tool and setting infrastructure for secure strings. It does
not yet provide for keystore passwords, keypairs, certificates, or even
convert any existing string settings to secure string settings. Those
will all come in follow up PRs. But this PR was already too big, so this
at least gets a basic version of the infrastructure in.
The two main things to look at. The first is the `SecureSetting` class,
which extends `Setting`, but removes the assumption for the raw value of the
setting to be a string. SecureSetting provides, for now, a single
helper, `stringSetting()` to create a SecureSetting which will return a
SecureString (which is like String, but is closeable, so that the
underlying character array can be cleared). The second is the
`KeyStoreWrapper` class, which wraps the java `KeyStore` to provide a
simpler api (we do not need the entire keystore api) and also extend
the serialized format to add metadata needed for loading the keystore
with no assumptions about keystore type (so that we can change this in
the future) as well as whether the keystore has a password (so that we
can know whether prompting is necessary when we add support for keystore
passwords).
2016-12-22 19:28:34 -05:00
|
|
|
testCompile 'com.google.jimfs:jimfs:1.1'
|
|
|
|
testCompile 'com.google.guava:guava:18.0'
|
2015-11-05 01:28:57 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
if (isEclipse) {
|
|
|
|
// in eclipse the project is under a fake root, we need to change around the source sets
|
|
|
|
sourceSets {
|
2015-11-20 14:58:50 -05:00
|
|
|
if (project.path == ":core") {
|
2015-11-05 01:28:57 -05:00
|
|
|
main.java.srcDirs = ['java']
|
|
|
|
main.resources.srcDirs = ['resources']
|
|
|
|
} else {
|
|
|
|
test.java.srcDirs = ['java']
|
|
|
|
test.resources.srcDirs = ['resources']
|
|
|
|
}
|
2015-10-29 14:40:19 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-01-11 13:35:59 -05:00
|
|
|
compileJava.options.compilerArgs << "-Xlint:-cast,-deprecation,-rawtypes,-try,-unchecked"
|
|
|
|
compileTestJava.options.compilerArgs << "-Xlint:-cast,-deprecation,-rawtypes,-try,-unchecked"
|
2015-10-29 14:40:19 -04:00
|
|
|
|
|
|
|
forbiddenPatterns {
|
|
|
|
exclude '**/*.json'
|
|
|
|
exclude '**/*.jmx'
|
|
|
|
exclude '**/org/elasticsearch/cluster/routing/shard_routes.txt'
|
|
|
|
}
|
|
|
|
|
2016-05-25 16:31:04 -04:00
|
|
|
task generateModulesList {
|
|
|
|
List<String> modules = project(':modules').subprojects.collect { it.name }
|
|
|
|
File modulesFile = new File(buildDir, 'generated-resources/modules.txt')
|
2017-05-18 09:33:13 -04:00
|
|
|
processResources.from(modulesFile)
|
|
|
|
inputs.property('modules', modules)
|
2016-05-25 16:31:04 -04:00
|
|
|
outputs.file(modulesFile)
|
|
|
|
doLast {
|
|
|
|
modulesFile.parentFile.mkdirs()
|
|
|
|
modulesFile.setText(modules.join('\n'), 'UTF-8')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
task generatePluginsList {
|
|
|
|
List<String> plugins = project(':plugins').subprojects
|
|
|
|
.findAll { it.name.contains('example') == false }
|
|
|
|
.collect { it.name }
|
|
|
|
File pluginsFile = new File(buildDir, 'generated-resources/plugins.txt')
|
2017-05-18 09:33:13 -04:00
|
|
|
processResources.from(pluginsFile)
|
|
|
|
inputs.property('plugins', plugins)
|
2016-05-25 16:31:04 -04:00
|
|
|
outputs.file(pluginsFile)
|
|
|
|
doLast {
|
|
|
|
pluginsFile.parentFile.mkdirs()
|
|
|
|
pluginsFile.setText(plugins.join('\n'), 'UTF-8')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
processResources {
|
|
|
|
dependsOn generateModulesList, generatePluginsList
|
|
|
|
}
|
|
|
|
|
2015-12-16 16:38:16 -05:00
|
|
|
thirdPartyAudit.excludes = [
|
2015-12-28 22:38:55 -05:00
|
|
|
// classes are missing!
|
|
|
|
|
|
|
|
// from com.fasterxml.jackson.dataformat.yaml.YAMLMapper (jackson-dataformat-yaml)
|
2016-08-09 13:34:23 -04:00
|
|
|
'com.fasterxml.jackson.databind.ObjectMapper',
|
|
|
|
|
|
|
|
// from log4j
|
2016-10-07 14:05:30 -04:00
|
|
|
'com.beust.jcommander.IStringConverter',
|
|
|
|
'com.beust.jcommander.JCommander',
|
|
|
|
'com.conversantmedia.util.concurrent.DisruptorBlockingQueue',
|
|
|
|
'com.conversantmedia.util.concurrent.SpinPolicy',
|
2016-08-09 13:34:23 -04:00
|
|
|
'com.fasterxml.jackson.annotation.JsonInclude$Include',
|
|
|
|
'com.fasterxml.jackson.databind.DeserializationContext',
|
|
|
|
'com.fasterxml.jackson.databind.JsonMappingException',
|
|
|
|
'com.fasterxml.jackson.databind.JsonNode',
|
|
|
|
'com.fasterxml.jackson.databind.Module$SetupContext',
|
|
|
|
'com.fasterxml.jackson.databind.ObjectReader',
|
|
|
|
'com.fasterxml.jackson.databind.ObjectWriter',
|
|
|
|
'com.fasterxml.jackson.databind.SerializerProvider',
|
|
|
|
'com.fasterxml.jackson.databind.deser.std.StdDeserializer',
|
|
|
|
'com.fasterxml.jackson.databind.deser.std.StdScalarDeserializer',
|
|
|
|
'com.fasterxml.jackson.databind.module.SimpleModule',
|
|
|
|
'com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter',
|
|
|
|
'com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider',
|
|
|
|
'com.fasterxml.jackson.databind.ser.std.StdScalarSerializer',
|
|
|
|
'com.fasterxml.jackson.databind.ser.std.StdSerializer',
|
|
|
|
'com.fasterxml.jackson.dataformat.xml.JacksonXmlModule',
|
|
|
|
'com.fasterxml.jackson.dataformat.xml.XmlMapper',
|
|
|
|
'com.fasterxml.jackson.dataformat.xml.util.DefaultXmlPrettyPrinter',
|
2016-10-07 14:05:30 -04:00
|
|
|
'com.fasterxml.jackson.databind.node.JsonNodeFactory',
|
|
|
|
'com.fasterxml.jackson.databind.node.ObjectNode',
|
|
|
|
'org.fusesource.jansi.Ansi',
|
|
|
|
'org.fusesource.jansi.AnsiRenderer$Code',
|
2016-08-09 13:34:23 -04:00
|
|
|
'com.lmax.disruptor.BlockingWaitStrategy',
|
|
|
|
'com.lmax.disruptor.BusySpinWaitStrategy',
|
|
|
|
'com.lmax.disruptor.EventFactory',
|
|
|
|
'com.lmax.disruptor.EventTranslator',
|
|
|
|
'com.lmax.disruptor.EventTranslatorTwoArg',
|
|
|
|
'com.lmax.disruptor.EventTranslatorVararg',
|
|
|
|
'com.lmax.disruptor.ExceptionHandler',
|
|
|
|
'com.lmax.disruptor.LifecycleAware',
|
|
|
|
'com.lmax.disruptor.RingBuffer',
|
|
|
|
'com.lmax.disruptor.Sequence',
|
|
|
|
'com.lmax.disruptor.SequenceReportingEventHandler',
|
|
|
|
'com.lmax.disruptor.SleepingWaitStrategy',
|
|
|
|
'com.lmax.disruptor.TimeoutBlockingWaitStrategy',
|
|
|
|
'com.lmax.disruptor.WaitStrategy',
|
|
|
|
'com.lmax.disruptor.YieldingWaitStrategy',
|
|
|
|
'com.lmax.disruptor.dsl.Disruptor',
|
|
|
|
'com.lmax.disruptor.dsl.ProducerType',
|
|
|
|
'javax.jms.Connection',
|
|
|
|
'javax.jms.ConnectionFactory',
|
|
|
|
'javax.jms.Destination',
|
|
|
|
'javax.jms.Message',
|
|
|
|
'javax.jms.MessageConsumer',
|
|
|
|
'javax.jms.MessageListener',
|
|
|
|
'javax.jms.MessageProducer',
|
|
|
|
'javax.jms.ObjectMessage',
|
|
|
|
'javax.jms.Session',
|
|
|
|
'javax.mail.Authenticator',
|
|
|
|
'javax.mail.Message$RecipientType',
|
|
|
|
'javax.mail.PasswordAuthentication',
|
|
|
|
'javax.mail.Session',
|
|
|
|
'javax.mail.Transport',
|
|
|
|
'javax.mail.internet.InternetAddress',
|
|
|
|
'javax.mail.internet.InternetHeaders',
|
|
|
|
'javax.mail.internet.MimeBodyPart',
|
|
|
|
'javax.mail.internet.MimeMessage',
|
|
|
|
'javax.mail.internet.MimeMultipart',
|
|
|
|
'javax.mail.internet.MimeUtility',
|
|
|
|
'javax.mail.util.ByteArrayDataSource',
|
|
|
|
'javax.persistence.AttributeConverter',
|
|
|
|
'javax.persistence.EntityManager',
|
|
|
|
'javax.persistence.EntityManagerFactory',
|
|
|
|
'javax.persistence.EntityTransaction',
|
|
|
|
'javax.persistence.Persistence',
|
|
|
|
'javax.persistence.PersistenceException',
|
|
|
|
'org.apache.commons.compress.compressors.CompressorStreamFactory',
|
|
|
|
'org.apache.commons.compress.utils.IOUtils',
|
|
|
|
'org.apache.commons.csv.CSVFormat',
|
|
|
|
'org.apache.commons.csv.QuoteMode',
|
2017-04-09 07:19:16 -04:00
|
|
|
'org.apache.kafka.clients.producer.Callback',
|
2016-08-09 13:34:23 -04:00
|
|
|
'org.apache.kafka.clients.producer.KafkaProducer',
|
|
|
|
'org.apache.kafka.clients.producer.Producer',
|
|
|
|
'org.apache.kafka.clients.producer.ProducerRecord',
|
2017-04-09 07:19:16 -04:00
|
|
|
'org.apache.kafka.clients.producer.RecordMetadata',
|
2016-08-09 13:34:23 -04:00
|
|
|
'org.codehaus.stax2.XMLStreamWriter2',
|
2016-10-07 14:05:30 -04:00
|
|
|
'org.jctools.queues.MessagePassingQueue$Consumer',
|
|
|
|
'org.jctools.queues.MpscArrayQueue',
|
2016-08-09 13:34:23 -04:00
|
|
|
'org.osgi.framework.AdaptPermission',
|
|
|
|
'org.osgi.framework.AdminPermission',
|
|
|
|
'org.osgi.framework.Bundle',
|
|
|
|
'org.osgi.framework.BundleActivator',
|
|
|
|
'org.osgi.framework.BundleContext',
|
|
|
|
'org.osgi.framework.BundleEvent',
|
|
|
|
'org.osgi.framework.BundleReference',
|
|
|
|
'org.osgi.framework.FrameworkUtil',
|
|
|
|
'org.osgi.framework.SynchronousBundleListener',
|
|
|
|
'org.osgi.framework.wiring.BundleWire',
|
|
|
|
'org.osgi.framework.wiring.BundleWiring',
|
|
|
|
'org.zeromq.ZMQ$Context',
|
|
|
|
'org.zeromq.ZMQ$Socket',
|
|
|
|
'org.zeromq.ZMQ',
|
|
|
|
|
2016-03-07 04:12:23 -05:00
|
|
|
// from org.locationtech.spatial4j.io.GeoJSONReader (spatial4j)
|
2017-05-18 09:33:13 -04:00
|
|
|
'org.noggit.JSONParser',
|
2015-12-16 16:38:16 -05:00
|
|
|
]
|
|
|
|
|
2016-11-07 18:29:35 -05:00
|
|
|
dependencyLicenses {
|
|
|
|
mapping from: /lucene-.*/, to: 'lucene'
|
|
|
|
mapping from: /jackson-.*/, to: 'jackson'
|
|
|
|
}
|
2015-12-01 20:08:27 -05:00
|
|
|
|
2015-11-20 14:58:50 -05:00
|
|
|
if (isEclipse == false || project.path == ":core-tests") {
|
2015-11-05 01:28:57 -05:00
|
|
|
task integTest(type: RandomizedTestingTask,
|
|
|
|
group: JavaBasePlugin.VERIFICATION_GROUP,
|
|
|
|
description: 'Multi-node tests',
|
|
|
|
dependsOn: test.dependsOn) {
|
|
|
|
configure(BuildPlugin.commonTestConfig(project))
|
|
|
|
classpath = project.test.classpath
|
|
|
|
testClassesDir = project.test.testClassesDir
|
|
|
|
include '**/*IT.class'
|
|
|
|
}
|
|
|
|
check.dependsOn integTest
|
|
|
|
integTest.mustRunAfter test
|
|
|
|
}
|
2017-05-18 09:33:13 -04:00
|
|
|
|
|
|
|
task('verifyVersions') {
|
|
|
|
description 'Verifies that all released versions that are indexed compatible are listed in Version.java.'
|
|
|
|
group 'Verification'
|
|
|
|
enabled = false == gradle.startParameter.isOffline()
|
|
|
|
doLast {
|
|
|
|
// Read the list from maven central
|
|
|
|
Node xml
|
|
|
|
new URL('https://repo1.maven.org/maven2/org/elasticsearch/elasticsearch/maven-metadata.xml').openStream().withStream { s ->
|
|
|
|
xml = new XmlParser().parse(s)
|
|
|
|
}
|
|
|
|
Set<String> knownVersions = new TreeSet<>(xml.versioning.versions.version.collect { it.text() }.findAll { it ==~ /\d\.\d\.\d/ })
|
|
|
|
|
|
|
|
// Limit the known versions to those that should be wire compatible
|
|
|
|
String currentVersion = versions.elasticsearch.minus('-SNAPSHOT')
|
|
|
|
int prevMajor = Integer.parseInt(currentVersion.split('\\.')[0]) - 1
|
|
|
|
if (prevMajor == 4) {
|
|
|
|
// 4 didn't exist, it was 2.
|
|
|
|
prevMajor = 2;
|
|
|
|
}
|
|
|
|
knownVersions = knownVersions.findAll { Integer.parseInt(it.split('\\.')[0]) >= prevMajor }
|
|
|
|
|
|
|
|
/* Limit the listed versions to those that have been marked as released.
|
|
|
|
* Versions not marked as released don't get the same testing and we want
|
|
|
|
* to make sure that we flip all unreleased versions to released as soon
|
|
|
|
* as possible after release. */
|
|
|
|
Set<String> actualVersions = new TreeSet<>(
|
|
|
|
indexCompatVersions
|
|
|
|
.findAll { false == it.unreleased }
|
|
|
|
.collect { it.toString() })
|
|
|
|
|
|
|
|
// Finally, compare!
|
|
|
|
if (!knownVersions.equals(actualVersions)) {
|
|
|
|
throw new GradleException("out-of-date versions\nActual :" +
|
|
|
|
actualVersions + "\nExpected:" + knownVersions +
|
|
|
|
"; update Version.java")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
check.dependsOn(verifyVersions)
|