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

group 'xyz.duncanruns.julti'
version '1.6.1'

sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8

repositories {
    mavenLocal()
    mavenCentral()
    maven { url "https://www.jetbrains.com/intellij-repository/releases" }
}

compileJava {
    options.compilerArgs << '-parameters'
}

dependencies {
    implementation 'net.java.dev.jna:jna:5.14.0'
    implementation 'net.java.dev.jna:jna-platform:5.14.0'

    implementation 'org.apache.commons:commons-lang3:3.15.0'
    implementation 'org.apache.commons:commons-text:1.11.0'
    implementation 'org.apache.httpcomponents:httpclient:4.5.14'
    implementation 'commons-io:commons-io:2.17.0'

    implementation 'org.apache.logging.log4j:log4j-api:2.23.1'
    implementation 'org.apache.logging.log4j:log4j-core:2.23.1'

    implementation 'com.google.code.gson:gson:2.10'
    implementation 'com.google.guava:guava:33.2.1-jre'

    implementation 'com.github.tuupertunut:powershell-lib-java:2.0.0'

    implementation 'com.formdev:flatlaf:3.5.1'

    implementation 'org.kohsuke:github-api:1.326'

    implementation 'org.json:json:20231013'

    implementation 'com.jetbrains.intellij.java:java-gui-forms-rt:203.7148.30'

    implementation 'org.luaj:luaj-jse:3.0.1'
}

jar {

    duplicatesStrategy(DuplicatesStrategy.EXCLUDE)

    manifest {
        // Thanks to answers from this: https://stackoverflow.com/questions/33020069/how-to-get-version-attribute-from-a-gradle-build-to-be-included-in-runtime-swing
        attributes 'Main-Class': 'xyz.duncanruns.julti.JultiAppLaunch',
                'Multi-Release': true,
                'Implementation-Version': version
    }

    from {
        configurations.compileClasspath.collect { it.isDirectory() ? it : zipTree(it) }
    }
}

publishing {
    publications {
        maven(MavenPublication) {
            from components.java
        }
    }
}