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

esplugin {
  name = 'searchable-snapshots'
  description = 'A plugin for the searchable snapshots functionality'
  classname = 'org.elasticsearch.xpack.searchablesnapshots.SearchableSnapshots'
  extendedPlugins = ['x-pack-core', 'blob-cache']
}
base {
  archivesName = 'x-pack-searchable-snapshots'
}

dependencies {
  compileOnly project(path: xpackModule('core'))
  compileOnly project(path: xpackModule('blob-cache'))
  compileOnly project(path: ':libs:native')
  testImplementation(testArtifact(project(xpackModule('blob-cache'))))
  internalClusterTestImplementation(testArtifact(project(xpackModule('core'))))
  internalClusterTestImplementation(project(path: xpackModule('shutdown')))
  internalClusterTestImplementation(project(path: xpackModule('snapshot-based-recoveries')))
  internalClusterTestImplementation(project(path: ':modules:reindex'))
}

addQaCheckDependencies(project)

tasks.named("internalClusterTest").configure {
  // Reduce the buffer size per cache-fetch thread to keep direct memory usage under control.
  systemProperty 'es.searchable.snapshot.shared_cache.write_buffer.size', '256k'
}
