import org.elasticsearch.gradle.util.GradleUtils

apply plugin: 'elasticsearch.internal-java-rest-test'
apply plugin: 'elasticsearch.internal-yaml-rest-test'
apply plugin: 'elasticsearch.internal-test-artifact'
apply plugin: org.elasticsearch.gradle.internal.precommit.CheckstylePrecommitPlugin
apply plugin: org.elasticsearch.gradle.internal.precommit.ForbiddenApisPrecommitPlugin
apply plugin: org.elasticsearch.gradle.internal.precommit.ForbiddenPatternsPrecommitPlugin
apply plugin: org.elasticsearch.gradle.internal.precommit.FilePermissionsPrecommitPlugin
apply plugin: org.elasticsearch.gradle.internal.precommit.LoggerUsagePrecommitPlugin
apply plugin: org.elasticsearch.gradle.internal.precommit.TestingConventionsPrecommitPlugin

dependencies {
  javaRestTestImplementation project(xpackModule('esql:qa:testFixtures'))
  javaRestTestImplementation project(xpackModule('esql:qa:server'))
  yamlRestTestImplementation project(xpackModule('esql:qa:server'))

  clusterPlugins project(':plugins:mapper-size')
  clusterPlugins project(':plugins:mapper-murmur3')
  clusterPlugins project(':x-pack:plugin:inference:qa:test-service-plugin')
}

GradleUtils.extendSourceSet(project, "javaRestTest", "yamlRestTest")

tasks.named('javaRestTest') {
  usesDefaultDistribution("to be triaged")
}

restResources {
  restApi {
    include '_common', 'bulk', 'get', 'indices', 'esql', 'xpack', 'enrich', 'cluster', 'capabilities', 'index'
  }
  restTests {
    includeXpack 'esql'
  }
}

tasks.named('yamlRestTest') {
  usesDefaultDistribution("to be triaged")
  maxParallelForks = 1
}
