import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform

plugins {
    id("java-platform")
}

javaPlatform {
    allowDependencies()
}

// Based on https://stackoverflow.com/questions/11235614/how-to-detect-the-current-os-from-gradle
val os = DefaultNativePlatform.getCurrentOperatingSystem()
val arch = DefaultNativePlatform.getCurrentArchitecture()

// Keep version in sync build-support/src/main/java/JournalListMvGenerator.java and build-support/src/main/java/LtwaListMvGenerator.java
val javafxDefault = "26.0.2"
// The JavaFX version can be overridden via the gradle property `javafxVersion`.
val javafx = providers.gradleProperty("javafxVersion").getOrElse(javafxDefault)

val lucene = "10.5.1"

val pdfbox = "3.0.8"

// Pinned instead of the dev.jbang plugin default "latest": a PATH miss would otherwise fetch
// https://www.jbang.dev/releases/latest/download/version.txt (10 s timeout, no retries).
val jbang = "0.141.0"
extra["jbangVersion"] = jbang

dependencies {
    api(platform("ai.djl:bom:0.36.0"))
    api(platform("dev.langchain4j:langchain4j-bom:1.18.1"))
    api(enforcedPlatform("io.zonky.test.postgres:embedded-postgres-binaries-bom:18.4.0"))
    api(platform("org.junit:junit-bom:6.1.3"))
    api(platform("org.glassfish.grizzly:grizzly-bom:5.0.2"))
    api(platform("org.glassfish.jersey:jersey-bom:4.0.2"))
    api(platform("tools.jackson:jackson-bom:3.2.1"))
}

dependencies.constraints {
    // With -PuseLibericaJdkFull=true, no org.openjfx:* dependency is requested (see
    // org.jabref.gradle.base.dependency-rules.gradle.kts), so these JavaFX version pins stay inert.
    api("org.openjfx:javafx-base:$javafx")
    api("org.openjfx:javafx-controls:$javafx")
    api("org.openjfx:javafx-fxml:$javafx")
    api("org.openjfx:javafx-graphics:$javafx")
    api("org.openjfx:javafx-swing:$javafx")
    api("org.openjfx:jfx-incubator-input:$javafx")
    api("org.openjfx:jfx-incubator-richtext:$javafx")

    api("cc.jilt:jilt:1.9.1")

    api("com.dlsc.gemsfx:gemsfx:4.4.0")
    api("com.dlsc.unitfx:unitfx:1.0.10")
    api("com.dlsc.pdfviewfx:pdfviewfx:3.4.2")
    api("com.ibm.icu:icu4j:72.0.1!!")
    api("com.fasterxml:aalto-xml:1.4.0")
    api("org.eclipse.lsp4j:org.eclipse.lsp4j:1.0.0")
    api("org.eclipse.lsp4j:org.eclipse.lsp4j.websocket.jakarta:1.0.0")
    api("com.github.ben-manes.caffeine:caffeine:3.2.4")
    api("com.github.javakeyring:java-keyring:1.0.4")
    api("com.github.javaparser:javaparser-core:3.28.2")
    api("com.github.javaparser:javaparser-symbol-solver-core:3.28.2")
    api("com.github.sialcasa.mvvmFX:mvvmfx-validation:f195849ca9") //jitpack
    api("com.google.errorprone:error_prone_core:2.50.0")
    api("com.google.guava:guava:33.6.0-jre")
    api("com.googlecode.plist:dd-plist:1.30")
    api("com.h2database:h2-mvstore:2.4.240")
    api("com.knuddels:jtokkit:1.1.0")
    api("com.konghq:unirest-java-core:4.10.1")
    api("com.konghq:unirest-modules-gson:4.10.1")
    api("com.squareup.okhttp3:mockwebserver3:5.4.0")
    api("com.squareup.okhttp3:okhttp:5.4.0")
    api("com.squareup.okio:okio-jvm:3.18.1")
    api("com.squareup.retrofit2:retrofit:3.0.0")
    api("com.tngtech.archunit:archunit:1.5.0")
    api("com.tngtech.archunit:archunit-junit5-api:1.5.0")
    api("com.tngtech.archunit:archunit-junit5-engine:1.5.0")
    api("com.uber.nullaway:nullaway:0.13.8")
    api("com.vladsch.flexmark:flexmark-html2md-converter:0.64.8")
    api("com.vladsch.flexmark:flexmark:0.64.8")
    api("commons-io:commons-io:2.22.0")
    api("commons-logging:commons-logging:1.4.0")
    api("de.rototor.snuggletex:snuggletex-core:1.3.0")
    api("de.rototor.snuggletex:snuggletex-jeuclid:1.3.0")
    api("de.saxsys:mvvmfx:1.8.0")
    api("de.undercouch:citeproc-java:3.5.1")
    api("info.debatty:java-string-similarity:2.0.0")
    api("info.picocli:picocli-codegen:4.7.7")
    api("info.picocli:picocli:4.7.7")
    api("io.github.adr:e-adr:2.0.0")
    api("io.github.darvil82:terminal-text-formatter:2.3.0c")
    api("io.github.classgraph:classgraph:4.8.191")
    api("io.github.java-diff-utils:java-diff-utils:4.17")
    api("io.github.kusoroadeolu:veneer:1.3.2")
    api("io.github.stefanbratanov:jvm-openai:0.11.0")
    api("io.github.thibaultmeyer:cuid:2.0.5")
    api("io.zonky.test.postgres:embedded-postgres-binaries-darwin-arm64v8")
    api("io.zonky.test.postgres:embedded-postgres-binaries-linux-arm64v8")
    api("io.zonky.test:embedded-postgres:2.2.2")
    api("jakarta.annotation:jakarta.annotation-api:3.0.0")
    api("jakarta.inject:jakarta.inject-api:2.0.1")
    api("jakarta.validation:jakarta.validation-api:3.1.1")
    api("jakarta.ws.rs:jakarta.ws.rs-api:4.0.0")
    api("net.bytebuddy:byte-buddy:1.18.11")
    api("net.harawata:appdirs:1.5.0")
    api("net.java.dev.jna:jna-jpms:5.19.1")
    api("net.java.dev.jna:jna-platform:5.19.1")
    api("net.ltgt.errorprone:net.ltgt.errorprone.gradle.plugin:4.3.0")
    api("net.ltgt.nullaway:nullaway:2.3.0")
    api("org.antlr:antlr4-runtime:4.13.2")
    api("org.antlr:antlr4:4.13.2")
    api("org.apache.commons:commons-csv:1.14.1")
    api("org.apache.commons:commons-lang3:3.20.0")
    api("org.apache.commons:commons-text:1.15.0")
    api("org.apache.httpcomponents.core5:httpcore5:5.4.3")
    api("org.apache.httpcomponents.client5:httpclient5:5.6.4")
    api("org.apache.logging.log4j:log4j-to-slf4j:2.26.1")
    api("org.apache.lucene:lucene-analysis-common:$lucene")
    api("org.apache.lucene:lucene-core:$lucene")
    api("org.apache.lucene:lucene-highlighter:$lucene")
    api("org.apache.lucene:lucene-queries:$lucene")
    api("org.apache.lucene:lucene-queryparser:$lucene")
    api("org.apache.pdfbox:fontbox:$pdfbox")
    api("org.apache.pdfbox:pdfbox:$pdfbox")
    api("org.apache.pdfbox:xmpbox:$pdfbox")
    api("org.apache.velocity:velocity-engine-core:2.4.1")
    api("org.bouncycastle:bcprov-jdk18on:1.85.2")
    api("org.controlsfx:controlsfx:11.2.4")
    api("org.eclipse.jgit:org.eclipse.jgit:7.7.1.202607240634-r")
    api("org.fxmisc.flowless:flowless:0.7.4")
    api("org.fxmisc.richtext:richtextfx:0.11.7")
    api("org.glassfish.hk2:hk2-api:4.0.1")
    api("org.glassfish.hk2:hk2-locator:4.0.1")
    api("org.glassfish.hk2:hk2-utils:4.0.1")
    api("org.glassfish.jaxb:jaxb-runtime:4.0.9")
    api("org.hamcrest:hamcrest:3.0")
    api("org.hibernate.validator:hibernate-validator:9.1.3.Final")
    api("org.hisp.dhis:json-tree:1.9.4")
    api("org.jabref:afterburner.fx:2.0.0")
    api("org.jabref:easybind:2.3.0")
    api("org.jabref:html-to-node:0.2.0")
    api("org.jabref:latex-conv:0.1.0")
    api("org.jabref:mslinks:1.2")
    api("org.jetbrains:annotations:26.1.0")
    api("org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.4.10")
    api("org.jooq:jool:0.9.15")
    api("org.jsoup:jsoup:1.23.1")
    api("org.jspecify:jspecify:1.0.1")
    api("org.kordamp.ikonli:ikonli-javafx:12.4.0")
    api("org.kordamp.ikonli:ikonli-material-pack:12.4.0")
    api("org.kordamp.ikonli:ikonli-materialdesign2-pack:12.4.0")
    api("org.libreoffice:libreoffice:26.2.2")
    api("org.libreoffice:unoloader:26.2.2")
    api("org.mockito:mockito-core:5.23.0")
    api("org.ow2.asm:asm:9.10.1")
    api("org.postgresql:postgresql:42.7.13")
    api("org.slf4j:jul-to-slf4j:2.0.18")
    api("org.slf4j:slf4j-api:2.0.18")
    api("org.testfx:testfx-core:4.0.18")
    api("org.testfx:testfx-junit5:4.0.18")
    api("org.tinylog:slf4j-tinylog:2.7.0")
    api("org.tinylog:tinylog-api:2.7.0")
    api("org.tinylog:tinylog-impl:2.7.0")
    api("org.xmlunit:xmlunit-core:2.13.0")
    api("org.xmlunit:xmlunit-matchers:2.13.0")
    api("org.yaml:snakeyaml:2.6")
    api("tech.units:indriya:2.2.4")
    api("tools.maran:svgnode:2.0.0")
}
