plugins {
    id 'java'
    id 'application'
}

repositories {
    mavenCentral()
}

dependencies {
    implementation fileTree(dir: 'libraries', include: ['*.jar'])
    testImplementation 'junit:junit:4.12'
}

application {
    mainClass = 'nortantis.swing.MainWindow'
}

java {
    sourceCompatibility = JavaVersion.VERSION_17
    targetCompatibility = JavaVersion.VERSION_17
}

tasks.withType(JavaCompile) {
    options.encoding = 'UTF-8'
    options.compilerArgs << '-Xlint:deprecation' << '-Xlint:unchecked'
}

jar {
    duplicatesStrategy = DuplicatesStrategy.EXCLUDE
    manifest {
        attributes 'Main-Class': 'nortantis.swing.MainWindow'
    }
    from {
        configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
    } {
        exclude 'META-INF/*.SF', 'META-INF/*.DSA', 'META-INF/*.RSA'
    }
    from(sourceSets.main.output) {
        include '**/*.class'
    }
}

test {
	jvmArgs = ['-Dfile.encoding=UTF-8', '-Xmx3g']
}

sourceSets {
    main {
        java {
            srcDirs = ['src']
            include '**/*.java'
        }
        resources {
            srcDirs = ['assets']
            include '**/*'
        }
    }
    test {
        java {
            srcDirs = ['test']
            include '**/*.java'
        }
    }
}
