apply plugin: "java"

assert file("../../gles-worker-dependencies/target/gles-worker-dependencies-1.0.jar").exists()

dependencies {
    implementation project(":core")
    implementation "com.badlogicgames.gdx:gdx-backend-lwjgl3:$gdxVersion"
    implementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
    implementation "net.sourceforge.argparse4j:argparse4j:0.7.0"
    implementation "org.zeroturnaround:zt-process-killer:1.4"
    implementation files("../../gles-worker-dependencies/target/gles-worker-dependencies-1.0.jar")
}

sourceSets.main.java.srcDirs = [ "src/" ]
project.ext.mainClassName = "com.graphicsfuzz.glesworker.desktop.DesktopLauncher"
project.ext.assetsDir = new File("../android/assets");

task run(dependsOn: classes, type: JavaExec) {
    main = project.mainClassName
    classpath = sourceSets.main.runtimeClasspath
    standardInput = System.in
    workingDir = project.assetsDir
    ignoreExitValue = true
}

task dist(type: Jar) {
    from sourceSets.main.output
    from {
        configurations.runtimeClasspath.findAll { it.name.endsWith('jar') }.collect { zipTree(it) }
    }
    from files(project.assetsDir)
    archiveName = "gles-worker-desktop.jar"
    manifest {
        attributes 'Main-Class': project.mainClassName
    }
}

dist.dependsOn classes
