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

import org.elasticsearch.gradle.internal.precommit.CheckForbiddenApisTask

apply plugin: 'elasticsearch.build'

dependencies {
  implementation project(':libs:x-content')
  implementation project(':server')

  testImplementation(project(":test:framework")) {
    exclude group: 'org.elasticsearch', module: 'swisshash'
  }
}

// A static reference to the Vector API would cause an unsuppressible warning
// in downstream builds, so we add the required module read edge dynamically.
tasks.named('compileJava').configure {
  options.compilerArgs << '--add-modules=jdk.incubator.vector'
  options.compilerArgs << '--add-reads=org.elasticsearch.swisshash=jdk.incubator.vector'
  options.compilerArgs -= '-Werror'
}

tasks.named('javadoc').configure {
  options.addStringOption("-add-modules", "jdk.incubator.vector")
  options.addStringOption("-add-reads", "org.elasticsearch.swisshash=jdk.incubator.vector")
}

tasks.withType(CheckForbiddenApisTask).configureEach {
  ignoreMissingClasses = true
}
