/*
 *  Licensed to the Apache Software Foundation (ASF) under one
 *  or more contributor license agreements.  See the NOTICE file
 *  distributed with this work for additional information
 *  regarding copyright ownership.  The ASF licenses this file
 *  to you under the Apache License, Version 2.0 (the
 *  "License"); you may not use this file except in compliance
 *  with the License.  You may obtain a copy of the License at
 *
 *    https://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing,
 *  software distributed under the License is distributed on an
 *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 *  KIND, either express or implied.  See the License for the
 *  specific language governing permissions and limitations
 *  under the License.
 */

group "examples"
configurations.configureEach {
    exclude group: 'org.apache.grails', module: 'grails-data-simple'
}

dependencies {
    implementation platform(project(':grails-bom'))

    implementation "javax.servlet:javax.servlet-api:$servletApiVersion"
    implementation 'org.apache.grails:grails-dependencies-starter-web'
    implementation 'com.h2database:h2'

    implementation project(':grails-plugin')
    implementation "org.apache.grails:grails-data-hibernate5:$hibernateDatastoreVersion"
    implementation "org.hibernate:hibernate-ehcache:$hibernateEhcacheVersion"

    testAndDevelopmentOnly platform(project(':grails-bom'))
    testAndDevelopmentOnly 'org.webjars.npm:jquery'

    runtimeOnly "cloud.wondrify:asset-pipeline-grails:$assetPipelineVersion"
    runtimeOnly "org.apache.grails:grails-scaffolding:$scaffoldingVersion"
    runtimeOnly "org.apache.grails:grails-fields:$fieldsVersion"
    runtimeOnly "org.apache.tomcat:tomcat-jdbc:9.0.36"

    testImplementation project(':grails-testing-support-datamapping')
    testImplementation ("org.apache.grails:grails-testing-support-web:$testingSupportVersion") {
        exclude group: "org.spockframework", module: "spock-core"
    }

    testImplementation("org.apache.grails:grails-geb") {
        exclude group: 'org.gebish', module: 'geb-spock'
        exclude group: 'org.codehaus.groovy', module: 'groovy-all'
    }
    testImplementation "org.gebish:geb-spock:$gebVersion"

    testRuntimeOnly "org.seleniumhq.selenium:selenium-chrome-driver:$seleniumVersion"
    testRuntimeOnly "org.seleniumhq.selenium:selenium-firefox-driver:$seleniumVersion"
    testRuntimeOnly "org.seleniumhq.selenium:selenium-safari-driver:$seleniumSafariDriverVersion"

    testImplementation "org.seleniumhq.selenium:selenium-remote-driver:$seleniumVersion"
    testImplementation "org.seleniumhq.selenium:selenium-api:$seleniumVersion"
    testImplementation "org.seleniumhq.selenium:selenium-support:$seleniumVersion"

    testRuntimeOnly "org.neo4j.test:neo4j-harness:$neo4jVersion"
}
tasks.withType(Test) {
    systemProperty "geb.env", System.getProperty('geb.env')
    systemProperty "geb.build.reportsDir", reporting.file("geb/integrationTest")
    if (!System.getenv().containsKey('CI')) {
        systemProperty 'webdriver.chrome.driver', System.getProperty('webdriver.chrome.driver')
        systemProperty 'webdriver.gecko.driver', System.getProperty('webdriver.gecko.driver')
    } else {
        systemProperty 'webdriver.chrome.driver', "${System.getenv('CHROMEWEBDRIVER')}/chromedriver"
        systemProperty 'webdriver.gecko.driver', "${System.getenv('GECKOWEBDRIVER')}/geckodriver"
    }
}

webdriverBinaries {
    if (!System.getenv().containsKey('CI')) {
        chromedriver "$chromeDriverVersion"
        geckodriver "$geckodriverVersion"
    }
}

apply {
    from rootProject.layout.projectDirectory.file('gradle/test-webjar-asset-config.gradle')
}