plugins {
    id("io.qameta.allure-adapter")
    id("io.qameta.allure-report")
}

// The folowing tests different syntax variations to verify if they compile

allure {
    version = "42.0"
    environment["TZ"] = "UTC"
    adapter {
        frameworks {
            junit5 {
                adapterVersion = "42.0"
                enabled = true
            }
            spock
            testng.adapterVersion = "43"
            testng.enabled = false
            // cucumberJvm(3) is not supported in Groovy DSL syntax
            cucumber3Jvm.supportsAutoconfigureListeners = true
            cucumber5Jvm {
                activateOn("com.example.custom.cucumber:cucumber-core")
            }
            cucumber6Jvm {
                activateOn("com.example.custom.cucumber:cucumber-core") {
                    compileOnly("com.acme:compile-dep")
                    runtimeOnly("com.acme:runtime-dep")
                }
            }
        }
        frameworks.junit5
        frameworks.junit5.enabled = false
    }
    adapter.frameworks.spock.enabled = true
    commandline {
        group = "com.example"
        module = "test"
        extension = "jar"
        downloadUrlPattern = "https://..."
    }
    commandline.group = "abcd"
    report {
        reportDir = layout.buildDirectory.dir("allure/reports")
        dependsOnTests = true
        dependsOnTests()
    }
    report.reportDir = file("$buildDir/allure/reports")
    report.dependsOnTests = true
}
allure.commandline.downloadUrlPattern = "localhost"
allure.report.dependsOnTests = true

tasks.register("testDsl") {
    doLast {
        println("groovy-dsl is ok")
    }
}
