apply plugin: 'java-library'
apply plugin: 'biz.aQute.bnd.builder'

dependencies {
    implementation ( libs.elasticsearch ) {
        exclude group: 'com.google.guava'
        exclude group: 'com.fasterxml.jackson.dataformat', module: 'jackson-dataformat-cbor'
        exclude group: 'com.fasterxml.jackson.dataformat', module: 'jackson-dataformat-yaml'
        exclude group: 'org.yaml', module: 'snakeyaml'
        exclude group: 'com.fasterxml.jackson.dataformat', module: 'jackson-dataformat-smile'
    }
    implementation libs.jackson.dataformat.smile
    implementation libs.jackson.dataformat.cbor
    implementation libs.jackson.dataformat.yaml
}

def bundleSymbolicName = "${project.group}.${project.name.replace('-', '.')}"
def implementationVersion = project.version

jar {
    duplicatesStrategy = DuplicatesStrategy.EXCLUDE

    bundle {
        bnd(
        'Bundle-SymbolicName': bundleSymbolicName,
        '-nouses': 'true',
        '-dsannotations': '*',
        'Implementation-Version': implementationVersion,
         'Bundle-Name': 'Elasticsearch Library',
         'Export-Package':
             'org.elasticsearch.*;-split-package:=merge-first' + ',' +
             'org.apache.lucene.*;-split-package:=merge-first' + ',' +
             'org.joda.time.*;-split-package:=merge-first' + ',' +
             'com.spatial4j.*'+ ',' +
             'org.tartarus.*' + ',' +
             'org.jboss.netty.*' + ',' +
             'com.ning.compress.*'  + ',' +
             'com.carrotsearch.hppc.*' + ',' +
             'com.tdunning.math.stats.*',
         'Import-Package': '*;resolution:=optional',
         'Private-Package': 'config.*' + ',' +
             'META-INF.services.*;-split-package:=merge-first' + ',' +
             'com.fasterxml.jackson.dataformat.smile.*' + ',' +
             'com.fasterxml.jackson.dataformat.cbor.*' + ',' +
             'com.fasterxml.jackson.dataformat.yaml.*' + ',' +
             'org.yaml.snakeyaml.*' + ',' +
             'com.twitter.jsr166e.*'
    )
    }
}
