// SPDX-FileCopyrightText: 2021 Paul Schaub <vanitasvitae@fsfe.org>
//
// SPDX-License-Identifier: Apache-2.0

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
    }
}

plugins {
    id 'application'
    id 'org.jetbrains.kotlin.jvm' version "$kotlinVersion"
    id "com.github.johnrengelman.shadow" version "6.1.0"
}

group 'org.pgpainless'

repositories {
    mavenCentral()
}

dependencies {
    // Kotlin
    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"

    // JUnit
    testImplementation "org.jetbrains.kotlin:kotlin-test-junit5:$kotlinVersion"

    // CLI
    implementation "info.picocli:picocli:4.6.3"
    annotationProcessor "info.picocli:picocli-codegen:4.6.3"

    // Logging
    testImplementation "ch.qos.logback:logback-classic:$logbackVersion"

    // Web of Trust
    implementation(project(":pgpainless-wot"))

    // Web Key Directory
    implementation("org.pgpainless:wkd-java:0.1.1")
}

mainClassName = 'org.pgpainless.wot.cli.WotCLI'

application {
    mainClass = mainClassName
}

jar {
    duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
    manifest {
        attributes 'Main-Class': "$mainClassName"
    }

    from {
        configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
    } {
        exclude "META-INF/*.SF"
        exclude "META-INF/*.DSA"
        exclude "META-INF/*.RSA"
    }
}

test {
    useJUnitPlatform()
}
