//
// Copyright (c) ZeroC, Inc. All rights reserved.
//

ext.testDir = "${projectDir}/src/main/java/test"
apply from: "slice.gradle"

sourceSets {
    main {
        java {
            exclude '**/lambda'
            exclude 'plugins'
        }
    }
}

dependencies {
    implementation localDependency('ice-compat')
    runtimeOnly localDependency('icediscovery-compat')
    runtimeOnly localDependency('icelocatordiscovery-compat')
    implementation localDependency('icebox-compat')
    implementation localDependency('glacier2-compat')
    implementation localDependency('icestorm-compat')
    implementation localDependency('icegrid-compat')
    implementation project(':testPlugins')
}

if(!gradle.startParameter.isOffline()) {
    dependencies {
        runtime "org.apache.commons:commons-compress:1.14"
    }
}

jar {
    archiveName = "test.jar"
    destinationDir = new File("$rootProject.projectDir/lib/")
    manifest {
        attributes("Class-Path": configurations.runtimeClasspath.resolve().collect { it.toURI() }.join(' '))
    }
}

clean {
    delete("$rootProject.projectDir/lib/test.jar")
    ['src/main/java/test/IceGrid/simple/db'].each {
        delete fileTree(dir: it)
    }
    delete("src/main/java/test/Slice/generation/classes")
}
