/*
 * 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", the "GNU Affero General Public License v3.0 only", and the "Server Side
 * Public License v 1"; you may not use this file except in compliance with, at
 * your election, the "Elastic License 2.0", the "GNU Affero General Public
 * License v3.0 only", or the "Server Side Public License, v 1".
 */

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

esplugin {
  description = 'Placeholder plugin for geospatial features in ES'
  classname = 'org.elasticsearch.legacygeo.LegacyGeoPlugin'
}

dependencies {
  api "org.apache.lucene:lucene-spatial-extras:${versions.lucene}"
  api "org.locationtech.spatial4j:spatial4j:${versions.spatial4j}"
  api "org.locationtech.jts:jts-core:${versions.jts}"
  implementation "org.apache.lucene:lucene-spatial3d:${versions.lucene}"
  implementation "com.fasterxml.jackson.core:jackson-core:${versions.jackson}"
  implementation "io.sgr:s2-geometry-library-java:1.0.1"
  testImplementation project(":test:framework")
}

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

tasks.named("thirdPartyAudit").configure {
  ignoreMissingClasses(

    // from org.locationtech.spatial4j.io.GeoJSONReader (spatial4j)
    'org.noggit.JSONParser',

    // from org.locationtech.spatial4j.io.jackson.ShapeAsGeoJSONSerialize
    'com.fasterxml.jackson.databind.JsonSerializer',
    'com.fasterxml.jackson.databind.JsonDeserializer',
    'com.fasterxml.jackson.databind.node.ArrayNode',
    'com.fasterxml.jackson.databind.DeserializationContext',
    'com.fasterxml.jackson.databind.JsonNode',
    'com.fasterxml.jackson.databind.SerializerProvider',
    'com.fasterxml.jackson.databind.module.SimpleModule',
    'com.fasterxml.jackson.databind.node.ObjectNode',

    // from com.google.common.geometry.S2PolygonBuilder
    'com.google.common.base.Objects',
    'com.google.common.base.Preconditions',
    'com.google.common.collect.ForwardingMultimap',
    'com.google.common.collect.HashMultimap',
    'com.google.common.collect.HashMultiset',
    'com.google.common.collect.Lists',
    'com.google.common.collect.Maps',
    'com.google.common.collect.Multimap',
    'com.google.common.collect.Multiset',
    'com.google.common.collect.Sets',
    'com.google.common.collect.TreeMultimap',
  )
}

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

