plugins {
    id 'java'
    id 'application'
    id 'org.beryx.runtime' version '1.12.7'
}

sourceCompatibility = '8'

repositories {
    mavenCentral()
}

dependencies {
    implementation 'commons-io:commons-io:2.7'
    implementation 'com.github.wendykierp:JTransforms:3.1'
    implementation 'com.google.code.gson:gson:2.8.6'
    implementation 'org.slf4j:slf4j-api:1.7.25'
    implementation 'org.slf4j:slf4j-simple:1.7.25'
    implementation 'pl.edu.icm:JLargeArrays:1.6'
}

application {
    mainClassName = "io.github.dsheirer.jmbe.creator.Creator"
}

jar {
    manifest {
        attributes 'Implementation-Title': "${project.archivesBaseName}",
                   'Implementation-Version': archiveVersion
    }
    from rootProject.file('LICENSE')
}

/**
 * Beryx Runtime plugin - download OS specific JDK and creates a compact OS-specific creator image.
 */
runtime {
    targetPlatform("linux-arm32-v" + version) {
        jdkHome = jdkDownload("https://download.bell-sw.com/java/11.0.14.1+1/bellsoft-jdk11.0.14.1+1-linux-arm32-vfp-hflt.tar.gz")
    }

    targetPlatform("linux-aarch64-v" + version) {
        jdkHome = jdkDownload("https://download.bell-sw.com/java/11.0.14.1+1/bellsoft-jdk11.0.14.1+1-linux-aarch64.tar.gz")
    }

    targetPlatform("linux-x86_32-v" + version) {
        jdkHome = jdkDownload("https://download.bell-sw.com/java/11.0.14.1+1/bellsoft-jdk11.0.14.1+1-linux-i586.tar.gz")
    }

    targetPlatform("linux-x86_64-v" + version) {
        jdkHome = jdkDownload("https://download.bell-sw.com/java/11.0.14.1+1/bellsoft-jdk11.0.14.1+1-linux-amd64.tar.gz")
    }

    targetPlatform("osx-x86_64-v" + version) {
        jdkHome = jdkDownload("https://download.bell-sw.com/java/11.0.14.1+1/bellsoft-jdk11.0.14.1+1-macos-amd64.tar.gz")
    }

    targetPlatform("osx-aarch64-v" + version) {
        jdkHome = jdkDownload("https://download.bell-sw.com/java/11.0.14.1+1/bellsoft-jdk11.0.14.1+1-macos-aarch64.tar.gz")
    }

    targetPlatform("windows-aarch64-v" + version) {
        jdkHome = jdkDownload("https://download.bell-sw.com/java/11.0.14.1+1/bellsoft-jdk11.0.14.1+1-windows-aarch64.zip")
    }

    targetPlatform("windows-x86_64-v" + version) {
        jdkHome = jdkDownload("https://download.bell-sw.com/java/11.0.14.1+1/bellsoft-jdk11.0.14.1+1-windows-amd64.zip")
    }

    targetPlatform("windows-x86_32-v" + version) {
        jdkHome = jdkDownload("https://download.bell-sw.com/java/11.0.14.1+1/bellsoft-jdk11.0.14.1+1-windows-i586.zip")
    }

    modules = ['jdk.crypto.ec','java.desktop','jdk.compiler','java.base','jdk.zipfs']
    additive = true
    options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages']
    imageZip = file("$buildDir/image/jmbe-creator.zip")
}

