// SPDX-FileCopyrightText: 2021 Paul Schaub <vanitasvitae@fsfe.org>
//
// SPDX-License-Identifier: Apache-2.0
import org.apache.tools.ant.filters.*
plugins {
    id 'java-library'
}

group 'org.pgpainless'

repositories {
    mavenCentral()
    mavenLocal()
}

dependencies {
    testImplementation "org.junit.jupiter:junit-jupiter-api:$junitVersion"
    testImplementation "org.junit.jupiter:junit-jupiter-params:$junitVersion"
    testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junitVersion"

    // Jazzer for Fuzzing
    testImplementation "com.code-intelligence:jazzer-junit:0.24.0"

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

    // Depend on "shared" sop-java test suite (fixtures are turned into tests by inheritance inside test sources)
    testImplementation "org.pgpainless:sop-java-testfixtures:$sopJavaVersion"

    implementation(project(":pgpainless-core"))
    api "org.pgpainless:sop-java:$sopJavaVersion"

    implementation "com.google.code.findbugs:jsr305:3.0.2"
}

processResources {
    filter ReplaceTokens, tokens: [
            "project.version": project.version.toString()
    ]
}

test {
    useJUnitPlatform()
    environment("test.implementation", "sop.testsuite.pgpainless.PGPainlessSopInstanceFactory")
}

// https://docs.gradle.org/current/userguide/java_library_plugin.html#sec:java_library_modular_auto
tasks.named('jar') {
    manifest {
        attributes('Automatic-Module-Name': 'org.pgpainless.sop')
    }
}
