plugins {
    id 'java-library'
}

java {
    sourceCompatibility = 21
    targetCompatibility = 21
}

repositories {
    mavenCentral()
}

dependencies {
    implementation project(':app:cli-ac')
    implementation project(':lib:ac-api')
    compileOnly "org.apache.ant:ant:$antVersion"

    testImplementation platform("org.junit:junit-bom:$junitVersion")
    testImplementation 'org.junit.jupiter:junit-jupiter'
    testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
    testImplementation "org.apache.ant:ant:$antVersion"
}

test {
    useJUnitPlatform()
}

jar {
    archiveBaseName = 'AppleCommander'
    archiveAppendix = 'ant'
    duplicatesStrategy = DuplicatesStrategy.INCLUDE

    dependsOn configurations.runtimeClasspath
    from {
        configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
    }
}

// Automagically run the Ant tests as part of the build process.
// See: https://docs.gradle.org/current/userguide/ant.html
ant.importBuild('src/test/resources/build-testacant.xml') { antTargetName ->
    'anttest-' + antTargetName
}
tasks.named('test') {
    finalizedBy('anttest-all')
}
