/*
 * 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.
 */

/*
 * 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-java-rest-test'

esplugin {
  name = 'vector-tile'
  description = 'A plugin for mapbox vector tile features'
  classname ='org.elasticsearch.xpack.vectortile.VectorTilePlugin'
  extendedPlugins = ['spatial']
}

dependencies {
  compileOnly project(path: xpackModule('core'))
  compileOnly project(path: xpackModule('spatial'))
  testImplementation(testArtifact(project(xpackModule('core'))))
  compileOnly "org.locationtech.jts:jts-core:${versions.jts}"
  api "com.wdtinc:mapbox-vector-tile:3.1.0"
  api "com.google.protobuf:protobuf-java:${versions.protobuf}"
  runtimeOnly("org.slf4j:slf4j-api:${versions.slf4j}")
  runtimeOnly "org.slf4j:slf4j-nop:${versions.slf4j}"
  //  runtimeOnly("org.apache.logging.log4j:log4j-slf4j-impl:${versions.log4j}") https://github.com/elastic/elasticsearch/issues/93714
  javaRestTestImplementation("com.wdtinc:mapbox-vector-tile:3.1.0")
  javaRestTestImplementation("com.google.protobuf:protobuf-java:${versions.protobuf}")

  clusterModules project(':modules:analysis-common')
  clusterModules project(':modules:legacy-geo')
  clusterModules project(':modules:lang-painless')
  clusterModules project(':test:external-modules:test-error-query')
}

tasks.named("thirdPartyAudit").configure {
  ignoreViolations(
    // uses internal java api: sun.misc.Unsafe
    'com.google.protobuf.UnsafeUtil',
    'com.google.protobuf.MessageSchema',
    'com.google.protobuf.UnsafeUtil$1',
    'com.google.protobuf.UnsafeUtil$Android32MemoryAccessor',
    'com.google.protobuf.UnsafeUtil$Android64MemoryAccessor',
    'com.google.protobuf.UnsafeUtil$JvmMemoryAccessor',
    'com.google.protobuf.UnsafeUtil$MemoryAccessor'
  )

}

