2021-04-09 15:28:18 -04:00
|
|
|
/*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*
|
|
|
|
* The OpenSearch Contributors require contributions made to
|
|
|
|
* this file be licensed under the Apache-2.0 license or a
|
|
|
|
* compatible open source license.
|
|
|
|
*
|
|
|
|
* Modifications Copyright OpenSearch Contributors. See
|
|
|
|
* GitHub history for details.
|
|
|
|
*/
|
2019-11-01 14:33:11 -04:00
|
|
|
|
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.
|
|
|
|
*/
|
|
|
|
|
2021-04-09 15:28:18 -04:00
|
|
|
import org.opensearch.gradle.info.BuildParams
|
|
|
|
|
2021-03-17 16:36:22 -04:00
|
|
|
apply plugin: 'opensearch.build'
|
2015-10-29 14:40:19 -04:00
|
|
|
apply plugin: 'nebula.optional-base'
|
2021-03-17 16:36:22 -04:00
|
|
|
apply plugin: 'opensearch.publish'
|
|
|
|
apply plugin: 'opensearch.internal-cluster-test'
|
2016-05-05 20:53:01 -04:00
|
|
|
|
|
|
|
publishing {
|
|
|
|
publications {
|
|
|
|
nebula {
|
2021-03-17 16:36:22 -04:00
|
|
|
artifactId 'opensearch'
|
2016-05-05 20:53:01 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-10-29 14:40:19 -04:00
|
|
|
|
2021-03-17 16:36:22 -04:00
|
|
|
archivesBaseName = 'opensearch'
|
2015-10-29 14:40:19 -04:00
|
|
|
|
2020-03-31 07:48:46 -04:00
|
|
|
// we want to keep the JDKs in our IDEs set to JDK 8 until minimum JDK is bumped to 11 so we do not include this source set in our IDEs
|
2020-03-19 14:43:33 -04:00
|
|
|
if (!isEclipse) {
|
2018-01-16 15:10:29 -05:00
|
|
|
sourceSets {
|
2020-03-31 07:48:46 -04:00
|
|
|
java11 {
|
2018-01-16 15:10:29 -05:00
|
|
|
java {
|
2020-03-31 07:48:46 -04:00
|
|
|
srcDirs = ['src/main/java11']
|
2018-01-16 15:10:29 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-11-14 06:01:23 -05:00
|
|
|
|
2018-04-03 13:22:12 -04:00
|
|
|
configurations {
|
2020-07-07 11:10:31 -04:00
|
|
|
java11Implementation.extendsFrom(api)
|
2018-04-03 13:22:12 -04:00
|
|
|
}
|
2019-11-14 06:01:23 -05:00
|
|
|
|
2018-04-03 13:22:12 -04:00
|
|
|
dependencies {
|
2020-07-07 11:10:31 -04:00
|
|
|
java11Implementation sourceSets.main.output
|
2018-04-03 13:22:12 -04:00
|
|
|
}
|
2018-01-16 15:10:29 -05:00
|
|
|
|
2020-03-31 07:48:46 -04:00
|
|
|
compileJava11Java {
|
2022-03-08 14:48:51 -05:00
|
|
|
sourceCompatibility = JavaVersion.VERSION_11
|
|
|
|
targetCompatibility = JavaVersion.VERSION_11
|
2018-01-16 15:10:29 -05:00
|
|
|
}
|
2018-08-31 02:31:55 -04:00
|
|
|
|
2020-04-15 16:23:55 -04:00
|
|
|
tasks.named('forbiddenApisJava11').configure {
|
2019-05-30 13:29:42 -04:00
|
|
|
doFirst {
|
2020-03-31 07:48:46 -04:00
|
|
|
if (BuildParams.runtimeJavaVersion < JavaVersion.VERSION_11) {
|
2022-03-08 14:48:51 -05:00
|
|
|
targetCompatibility = JavaVersion.VERSION_11
|
2019-05-30 13:29:42 -04:00
|
|
|
}
|
2018-08-31 02:31:55 -04:00
|
|
|
}
|
2018-04-03 13:22:12 -04:00
|
|
|
}
|
2018-01-16 15:10:29 -05:00
|
|
|
|
|
|
|
jar {
|
2018-04-03 13:22:12 -04:00
|
|
|
metaInf {
|
2020-03-31 07:48:46 -04:00
|
|
|
into 'versions/11'
|
|
|
|
from sourceSets.java11.output
|
2018-01-16 15:10:29 -05:00
|
|
|
}
|
|
|
|
manifest.attributes('Multi-Release': 'true')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-10-29 14:40:19 -04:00
|
|
|
dependencies {
|
|
|
|
|
2021-03-17 16:36:22 -04:00
|
|
|
api project(':libs:opensearch-core')
|
|
|
|
api project(':libs:opensearch-secure-sm')
|
|
|
|
api project(':libs:opensearch-x-content')
|
|
|
|
api project(":libs:opensearch-geo")
|
2019-10-03 03:50:46 -04:00
|
|
|
|
2021-03-17 16:36:22 -04:00
|
|
|
compileOnly project(':libs:opensearch-plugin-classloader')
|
|
|
|
testRuntimeOnly project(':libs:opensearch-plugin-classloader')
|
2018-01-03 14:12:43 -05:00
|
|
|
|
2015-10-29 14:40:19 -04:00
|
|
|
// lucene
|
2020-06-30 09:57:41 -04:00
|
|
|
api "org.apache.lucene:lucene-core:${versions.lucene}"
|
|
|
|
api "org.apache.lucene:lucene-analyzers-common:${versions.lucene}"
|
|
|
|
api "org.apache.lucene:lucene-backward-codecs:${versions.lucene}"
|
|
|
|
api "org.apache.lucene:lucene-grouping:${versions.lucene}"
|
|
|
|
api "org.apache.lucene:lucene-highlighter:${versions.lucene}"
|
|
|
|
api "org.apache.lucene:lucene-join:${versions.lucene}"
|
|
|
|
api "org.apache.lucene:lucene-memory:${versions.lucene}"
|
|
|
|
api "org.apache.lucene:lucene-misc:${versions.lucene}"
|
|
|
|
api "org.apache.lucene:lucene-queries:${versions.lucene}"
|
|
|
|
api "org.apache.lucene:lucene-queryparser:${versions.lucene}"
|
|
|
|
api "org.apache.lucene:lucene-sandbox:${versions.lucene}"
|
|
|
|
api "org.apache.lucene:lucene-spatial-extras:${versions.lucene}"
|
|
|
|
api "org.apache.lucene:lucene-spatial3d:${versions.lucene}"
|
|
|
|
api "org.apache.lucene:lucene-suggest:${versions.lucene}"
|
2015-10-29 14:40:19 -04:00
|
|
|
|
|
|
|
// utilities
|
2021-03-17 16:36:22 -04:00
|
|
|
api project(":libs:opensearch-cli")
|
2020-06-30 09:57:41 -04:00
|
|
|
api 'com.carrotsearch:hppc:0.8.1'
|
2015-10-29 14:40:19 -04:00
|
|
|
|
|
|
|
// time handling, remove with java 8 time
|
2020-06-30 09:57:41 -04:00
|
|
|
api "joda-time:joda-time:${versions.joda}"
|
2015-10-29 14:40:19 -04:00
|
|
|
|
|
|
|
// percentiles aggregation
|
2020-06-30 09:57:41 -04:00
|
|
|
api 'com.tdunning:t-digest:3.2'
|
2015-10-29 14:40:19 -04:00
|
|
|
// precentil ranks aggregation
|
2020-06-30 09:57:41 -04:00
|
|
|
api 'org.hdrhistogram:HdrHistogram:2.1.9'
|
2015-10-29 14:40:19 -04:00
|
|
|
|
|
|
|
// lucene spatial
|
2020-06-30 09:57:41 -04:00
|
|
|
api "org.locationtech.spatial4j:spatial4j:${versions.spatial4j}", optional
|
|
|
|
api "org.locationtech.jts:jts-core:${versions.jts}", optional
|
2015-10-29 14:40:19 -04:00
|
|
|
|
|
|
|
// logging
|
2020-06-30 09:57:41 -04:00
|
|
|
api "org.apache.logging.log4j:log4j-api:${versions.log4j}"
|
|
|
|
api "org.apache.logging.log4j:log4j-core:${versions.log4j}", optional
|
2015-10-29 14:40:19 -04:00
|
|
|
|
2021-08-03 13:52:53 -04:00
|
|
|
// jna
|
|
|
|
api "net.java.dev.jna:jna:${versions.jna}"
|
2020-07-14 17:50:41 -04:00
|
|
|
|
2020-06-14 16:30:44 -04:00
|
|
|
testImplementation(project(":test:framework")) {
|
2019-10-03 03:50:46 -04:00
|
|
|
// tests use the locally compiled version of server
|
2021-03-17 16:36:22 -04:00
|
|
|
exclude group: 'org.opensearch', module: 'server'
|
2015-11-05 01:28:57 -05:00
|
|
|
}
|
2020-06-14 16:30:44 -04:00
|
|
|
internalClusterTestImplementation(project(":test:framework")) {
|
2021-03-17 16:36:22 -04:00
|
|
|
exclude group: 'org.opensearch', module: 'server'
|
2020-05-06 20:20:52 -04:00
|
|
|
}
|
2015-11-05 01:28:57 -05:00
|
|
|
}
|
|
|
|
|
2020-07-31 07:09:04 -04:00
|
|
|
tasks.withType(JavaCompile).configureEach {
|
2021-07-06 12:55:23 -04:00
|
|
|
options.compilerArgs -= '-Xlint:cast'
|
|
|
|
options.compilerArgs -= '-Xlint:rawtypes'
|
|
|
|
options.compilerArgs -= '-Xlint:unchecked'
|
2020-07-31 07:09:04 -04:00
|
|
|
}
|
2015-10-29 14:40:19 -04:00
|
|
|
|
2021-04-20 10:02:45 -04:00
|
|
|
tasks.named("internalClusterTest").configure {
|
|
|
|
// TODO: these run faster with C2 only because they run for so, so long
|
|
|
|
jvmArgs -= '-XX:TieredStopAtLevel=1'
|
|
|
|
}
|
|
|
|
|
2019-11-11 09:33:04 -05:00
|
|
|
// Until this project is always being formatted with spotless, we need to
|
|
|
|
// guard against `spotless()` not existing.
|
|
|
|
try {
|
|
|
|
spotless {
|
|
|
|
java {
|
|
|
|
// Contains large data tables that do not format well.
|
2021-03-17 02:07:44 -04:00
|
|
|
targetExclude 'src/main/java/org/opensearch/search/aggregations/metrics/HyperLogLogPlusPlus.java'
|
2019-11-11 09:33:04 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception e) {
|
|
|
|
if (e.getMessage().contains("Could not find method spotless") == false) {
|
|
|
|
throw e;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-31 07:09:04 -04:00
|
|
|
tasks.named("forbiddenPatterns").configure {
|
|
|
|
exclude '**/*.json'
|
|
|
|
exclude '**/*.jmx'
|
|
|
|
exclude '**/*.dic'
|
|
|
|
exclude '**/*.binary'
|
|
|
|
exclude '**/*.st'
|
2015-10-29 14:40:19 -04:00
|
|
|
}
|
|
|
|
|
2020-07-31 07:09:04 -04:00
|
|
|
tasks.named("testingConventions").configure {
|
|
|
|
naming.clear()
|
|
|
|
naming {
|
|
|
|
Tests {
|
|
|
|
baseClass "org.apache.lucene.util.LuceneTestCase"
|
|
|
|
}
|
|
|
|
IT {
|
2021-03-19 13:54:21 -04:00
|
|
|
baseClass "org.opensearch.test.OpenSearchIntegTestCase"
|
|
|
|
baseClass "org.opensearch.test.OpenSearchSingleNodeTestCase"
|
2020-07-31 07:09:04 -04:00
|
|
|
}
|
2019-01-08 06:39:03 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-31 07:09:04 -04:00
|
|
|
def generateModulesList = tasks.register("generateModulesList") {
|
|
|
|
List<String> modules = project(':modules').subprojects.collect { it.name }
|
|
|
|
File modulesFile = new File(buildDir, 'generated-resources/modules.txt')
|
|
|
|
processResources.from(modulesFile)
|
|
|
|
inputs.property('modules', modules)
|
|
|
|
outputs.file(modulesFile)
|
|
|
|
doLast {
|
|
|
|
modulesFile.parentFile.mkdirs()
|
|
|
|
modulesFile.setText(modules.join('\n'), 'UTF-8')
|
|
|
|
}
|
2016-05-25 16:31:04 -04:00
|
|
|
}
|
|
|
|
|
2020-07-31 07:09:04 -04:00
|
|
|
def generatePluginsList = tasks.register("generatePluginsList") {
|
|
|
|
Set<String> plugins = new TreeSet<>(project(':plugins').childProjects.keySet())
|
|
|
|
plugins.remove('example')
|
|
|
|
|
|
|
|
File pluginsFile = new File(buildDir, 'generated-resources/plugins.txt')
|
|
|
|
processResources.from(pluginsFile)
|
|
|
|
inputs.property('plugins', plugins)
|
|
|
|
outputs.file(pluginsFile)
|
|
|
|
doLast {
|
|
|
|
pluginsFile.parentFile.mkdirs()
|
|
|
|
pluginsFile.setText(plugins.join('\n'), 'UTF-8')
|
|
|
|
}
|
2016-05-25 16:31:04 -04:00
|
|
|
}
|
|
|
|
|
2020-07-31 07:09:04 -04:00
|
|
|
tasks.named("processResources").configure {
|
|
|
|
dependsOn generateModulesList, generatePluginsList
|
2016-05-25 16:31:04 -04:00
|
|
|
}
|
|
|
|
|
2020-07-31 07:09:04 -04:00
|
|
|
tasks.named("thirdPartyAudit").configure {
|
|
|
|
ignoreMissingClasses(
|
|
|
|
// from com.fasterxml.jackson.dataformat.yaml.YAMLMapper (jackson-dataformat-yaml)
|
|
|
|
'com.fasterxml.jackson.databind.ObjectMapper',
|
|
|
|
|
|
|
|
// from log4j
|
|
|
|
'com.conversantmedia.util.concurrent.SpinPolicy',
|
|
|
|
'com.fasterxml.jackson.annotation.JsonInclude$Include',
|
|
|
|
'com.fasterxml.jackson.databind.DeserializationContext',
|
|
|
|
'com.fasterxml.jackson.databind.DeserializationFeature',
|
|
|
|
'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',
|
|
|
|
'com.fasterxml.jackson.databind.node.ObjectNode',
|
|
|
|
'org.fusesource.jansi.Ansi',
|
|
|
|
'org.fusesource.jansi.AnsiRenderer$Code',
|
|
|
|
'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.WaitStrategy',
|
|
|
|
'com.lmax.disruptor.dsl.Disruptor',
|
|
|
|
'com.lmax.disruptor.dsl.ProducerType',
|
|
|
|
'javax.jms.Connection',
|
|
|
|
'javax.jms.ConnectionFactory',
|
|
|
|
'javax.jms.Destination',
|
|
|
|
'javax.jms.JMSException',
|
|
|
|
'javax.jms.MapMessage',
|
|
|
|
'javax.jms.Message',
|
|
|
|
'javax.jms.MessageConsumer',
|
|
|
|
'javax.jms.MessageProducer',
|
|
|
|
'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.MimeMessage',
|
|
|
|
'javax.mail.internet.MimeMultipart',
|
|
|
|
'javax.mail.internet.MimeUtility',
|
|
|
|
'org.apache.commons.compress.compressors.CompressorStreamFactory',
|
|
|
|
'org.apache.commons.compress.utils.IOUtils',
|
|
|
|
'org.apache.commons.csv.CSVFormat',
|
|
|
|
'org.apache.commons.csv.QuoteMode',
|
|
|
|
'org.apache.kafka.clients.producer.Producer',
|
|
|
|
'org.apache.kafka.clients.producer.RecordMetadata',
|
|
|
|
'org.codehaus.stax2.XMLStreamWriter2',
|
|
|
|
'org.jctools.queues.MpscArrayQueue',
|
|
|
|
'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.ServiceRegistration',
|
|
|
|
'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',
|
|
|
|
|
|
|
|
// from org.locationtech.spatial4j.io.GeoJSONReader (spatial4j)
|
|
|
|
'org.noggit.JSONParser',
|
|
|
|
|
|
|
|
// from lucene-spatial
|
|
|
|
'com.fasterxml.jackson.databind.JsonSerializer',
|
|
|
|
'com.fasterxml.jackson.databind.JsonDeserializer',
|
|
|
|
'com.fasterxml.jackson.databind.node.ArrayNode',
|
|
|
|
'com.google.common.geometry.S2Cell',
|
|
|
|
'com.google.common.geometry.S2CellId',
|
|
|
|
'com.google.common.geometry.S2Projections',
|
|
|
|
'com.google.common.geometry.S2Point',
|
|
|
|
'com.google.common.geometry.S2$Metric',
|
|
|
|
'com.google.common.geometry.S2LatLng'
|
|
|
|
)
|
|
|
|
|
|
|
|
if (BuildParams.runtimeJavaVersion > JavaVersion.VERSION_1_8) {
|
|
|
|
ignoreMissingClasses 'javax.xml.bind.DatatypeConverter'
|
|
|
|
}
|
2017-07-27 10:14:04 -04:00
|
|
|
}
|
|
|
|
|
2020-06-18 02:15:50 -04:00
|
|
|
tasks.named("dependencyLicenses").configure {
|
2020-07-31 07:09:04 -04:00
|
|
|
mapping from: /lucene-.*/, to: 'lucene'
|
|
|
|
dependencies = project.configurations.runtimeClasspath.fileCollection {
|
2021-03-17 16:36:22 -04:00
|
|
|
it.group.startsWith('org.opensearch') == false ||
|
|
|
|
// keep the following org.opensearch jars in
|
2020-07-31 07:09:04 -04:00
|
|
|
(it.name == 'jna' ||
|
|
|
|
it.name == 'securesm')
|
|
|
|
}
|
2020-06-04 13:34:24 -04:00
|
|
|
}
|
2019-04-09 14:52:50 -04:00
|
|
|
|
2020-07-31 07:09:04 -04:00
|
|
|
tasks.named("licenseHeaders").configure {
|
|
|
|
// Ignore our vendored version of Google Guice
|
2021-03-17 16:36:22 -04:00
|
|
|
excludes << 'org/opensearch/common/inject/**/*'
|
2020-08-25 12:18:59 -04:00
|
|
|
// Ignore temporary copies of impending 8.7 Lucene classes
|
|
|
|
excludes << 'org/apache/lucene/search/RegExp87*'
|
|
|
|
excludes << 'org/apache/lucene/search/RegexpQuery87*'
|
2021-03-17 16:36:22 -04:00
|
|
|
excludes << 'org/opensearch/client/documentation/placeholder.txt'
|
2020-08-25 12:18:59 -04:00
|
|
|
}
|
2021-10-13 17:25:48 -04:00
|
|
|
|
|
|
|
tasks.test {
|
|
|
|
if (BuildParams.runtimeJavaVersion > JavaVersion.VERSION_1_8) {
|
|
|
|
jvmArgs += ["--add-opens", "java.base/java.nio.file=ALL-UNNAMED"]
|
|
|
|
}
|
|
|
|
}
|