/*
 * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
 * or more contributor license agreements. Licensed under the Elastic License
 * 2.0; you may not use this file except in compliance with the Elastic License
 * 2.0.
 */

apply plugin: 'elasticsearch.internal-es-plugin'
apply plugin: 'elasticsearch.internal-cluster-test'
apply plugin: 'elasticsearch.internal-test-artifact'

esplugin {
  name = 'spatial'
  description = 'A plugin for Basic Spatial features'
  classname ='org.elasticsearch.xpack.spatial.SpatialPlugin'
  extendedPlugins = ['x-pack-core', 'legacy-geo', 'lang-painless']
}

dependencies {
  compileOnly project(path: ':modules:legacy-geo')
  compileOnly project(':modules:lang-painless:spi')
  compileOnly project(path: xpackModule('core'))
  api "org.apache.lucene:lucene-spatial3d:${versions.lucene}"
  api project(":libs:h3")
  testImplementation(testArtifact(project(xpackModule('core'))))
  testImplementation project(path: ':modules:percolator')
  testImplementation project(path: xpackModule('vector-tile'))
  testImplementation project(path: ':modules:aggregations')
}

testClusters.configureEach {
  setting 'xpack.license.self_generated.type', 'trial'
  testDistribution = 'DEFAULT'
  setting 'xpack.security.enabled', 'false'
}

if (buildParams.snapshotBuild == false) {
  tasks.named("test").configure {
    systemProperty 'es.index_mode_feature_flag_registered', 'true'
  }
}

tasks.named("dependencyLicenses").configure {
  mapping from: /lucene-.*/, to: 'lucene'
}
