plugins {
    id "java"
    id "maven-publish"
}

group = 'org.dita-ot.pdf'

description = """DITA Open Toolkit PDF plug-in for FOP."""

repositories {
    mavenCentral()
    maven {
        url = "https://repository.jboss.org/nexus/content/repositories/thirdparty-releases/"
    }
}
dependencies {
    runtimeOnly group: 'org.apache.xmlgraphics', name: 'fop-core', version: '2.11'
    runtimeOnly group: 'org.apache.xmlgraphics', name: 'fop-events', version: '2.11'
    runtimeOnly group: 'org.apache.xmlgraphics', name: 'fop-util', version: '2.11'
    runtimeOnly group: 'org.apache.xmlgraphics', name: 'batik-all', version: '1.19'
    runtimeOnly group: 'xml-apis', name: 'xml-apis-ext', version: '1.3.04'
    runtimeOnly group: 'org.slf4j', name: 'jcl-over-slf4j', version: '2.0.17'
    runtimeOnly group: 'org.apache.xmlgraphics', name: 'fop-pdf-images', version: '2.11'
    runtimeOnly group: 'org.apache.pdfbox', name: 'pdfbox', version: '3.0.5'
}

tasks.named("test", Test)  {
    useJUnitPlatform()
}

tasks.register('copyInstall', Copy) {
    from(sourceSets.main.runtimeClasspath) {
        include 'batik-all-*.jar'
        include 'fop-core-*.jar'
        include 'fop-events-*.jar'
        include 'fop-util-*.jar'
        include 'fop-pdf-images-*.jar'
        include 'fontbox-*.jar'
        include 'jcl-over-slf4j-*.jar'
        include 'pdfbox-*.jar'
        include 'pdfbox-io-*.jar'
        exclude 'qdox-*.jar'
        include 'slf4j-api-*.jar'
        include 'xmlgraphics-commons-*.jar'
        include 'xml-apis-ext-*.jar'
    }
    destinationDir = file("lib")
}

tasks.register('copyDistTemp', Copy) {
    from(sourceSets.main.runtimeClasspath) {
        include 'batik-all-*.jar'
        include 'fop-core-*.jar'
        include 'fop-events-*.jar'
        include 'fop-util-*.jar'
        include 'fop-pdf-images-*.jar'
        include 'fontbox-*.jar'
        include 'jcl-over-slf4j-*.jar'
        include 'pdfbox-*.jar'
        include 'pdfbox-io.*.jar'
        exclude 'qdox-*.jar'
        include 'slf4j-api-*.jar'
        include 'xmlgraphics-commons-*.jar'
        include 'xml-apis-ext-*.jar'
        into "plugins/org.dita.pdf2.fop/lib"
    }
    destinationDir = file("${rootProject.buildDir}/tmp/dist")
}
