plugins {
    id 'java-module' // buildSrc/src/main/groovy/java-module.gradle
    id 'application'
    id 'com.github.johnrengelman.shadow'
    id 'java-test-fixtures'
}

defaultTasks 'shadowJar'

mainClassName = "com.emc.ecs.sync.EcsSyncCli"

dependencies {
    internal platform(project(":platform")) // all library versions should be specified in the platform project
    implementation project(':ecs-sync-core')
    implementation project(':ecs-sync-jaxrs')
    implementation "org.slf4j:slf4j-api"
    implementation 'org.apache.logging.log4j:log4j-core'
    implementation "commons-cli:commons-cli"
    implementation "com.sun.jersey:jersey-server"
    // jaxb was removed from Java 11 - jaxb dependencies are provided with Java 8
    implementation "javax.xml.bind:jaxb-api"

    rootProject.ext.storageIncludes.each {
        runtimeOnly project(":storage-plugins:${it}")
        runtimeOnly project(":storage-plugins:${it}-model")
    }
    rootProject.ext.filterIncludes.each {
        runtimeOnly project(":filter-plugins:${it}")
        runtimeOnly project(":filter-plugins:${it}-model")
    }
    runtimeOnly 'org.apache.logging.log4j:log4j-slf4j-impl'
    runtimeOnly 'org.slf4j:log4j-over-slf4j' // for dependencies using log4j 1.2
    runtimeOnly 'org.slf4j:jcl-over-slf4j' // for dependencies using commons-logging

    testFixturesImplementation project(':ecs-sync-model')

    testImplementation 'org.junit.jupiter:junit-jupiter-api'
    testImplementation testFixtures(project(':ecs-sync-core'))
    testImplementation 'com.sun.jersey:jersey-client'
    testImplementation 'org.apache.commons:commons-csv'

    testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
    testRuntimeOnly 'org.apache.logging.log4j:log4j-slf4j-impl'
}

test {
    useJUnitPlatform()
}

shadowJar {
    archiveBaseName.set(rootProject.name)
    archiveClassifier.set('')
    mergeServiceFiles()
    append('META-INF/spring.handlers')
    append('META-INF/spring.schemas')
    manifest {
        attributes(
                'Implementation-Version': project.version,
                'Multi-Release': true
        )
    }
    from { rootProject.customPluginListFile }
}
