/*
 * This file was generated by the Gradle 'init' task.
 *
 * This generated file contains a sample Kotlin application project to get you started.
 * For more details take a look at the 'Building Java & JVM projects' chapter in the Gradle
 * User Manual available at https://docs.gradle.org/7.4.2/userguide/building_java_projects.html
 */


plugins {
    // Apply the org.jetbrains.kotlin.jvm Plugin to add support for Kotlin.
    id 'org.jetbrains.kotlin.jvm' version '2.0.0-Beta4'

    // Apply the application plugin to add support for building a CLI application in Java.
    id 'application'
    id 'com.github.johnrengelman.shadow' version '7.1.2'
}


repositories {
    // Use Maven Central for resolving dependencies.
    mavenCentral()
}

dependencies {
    // Align versions of all Kotlin components
    implementation platform('org.jetbrains.kotlin:kotlin-bom')

    // Use the Kotlin JDK 8 standard library.
    implementation 'org.jetbrains.kotlin:kotlin-stdlib'

    // This dependency is used by the application.
    implementation 'com.google.guava:guava:33.0.0-jre'

    // Use the Kotlin test library.
    testImplementation 'org.jetbrains.kotlin:kotlin-test'

    // Use the Kotlin JUnit integration.
    testImplementation 'org.jetbrains.kotlin:kotlin-test-junit'
    testImplementation "org.jetbrains.kotlin:kotlin-test:2.0.0-Beta4"
}


application {
    // Define the main class for the application.
    mainClass = 'de.ids_mannheim.korapxml2conllu.AppKt'
}

jar {
    // Will include every single one of your dependencies, project or not
    // def lowerCasedName = baseName.toLowerCase()
    // def normalizedName = lowerCasedName.substring(0,1).toUpperCase() + lowerCasedName.substring(1)

    manifest.attributes(
            'Class-Path': configurations.compileClasspath.collect { it.getName() }.join(' '),
            'Main-Class': "de.ids_mannheim.korapxml2conllu.AppKt"
    )

}


configurations {
    runtimeLib.extendsFrom implementation
}
