buildscript {
    repositories {
        maven { url "https://repo.grails.org/grails/core" }
    }
    dependencies {
        classpath "org.grails:grails-gradle-plugin:$grailsVersion"
        classpath "org.grails.plugins:hibernate5:7.0.0"
        classpath "gradle.plugin.com.github.erdi.webdriver-binaries:webdriver-binaries-gradle-plugin:2.0"
        classpath "com.bertramlabs.plugins:asset-pipeline-gradle:3.0.10"
    }
}

version "0.1"
group "webui"

apply plugin:"eclipse"
apply plugin:"idea"
apply plugin:"war"
apply plugin:"org.grails.grails-web"
apply plugin:"com.github.erdi.webdriver-binaries"
apply plugin:"org.grails.grails-gsp"
apply plugin:"com.bertramlabs.asset-pipeline"

repositories {
    maven { url "https://repo.grails.org/grails/core" }
}

configurations {
    developmentOnly
    runtimeClasspath {
        extendsFrom developmentOnly
    }
    warArtifact
}

dependencies {
    compile project(":core")
    developmentOnly("org.springframework.boot:spring-boot-devtools")
    compile "org.springframework.boot:spring-boot-starter-logging"
    compile "org.springframework.boot:spring-boot-autoconfigure"
    compile "org.grails:grails-core"
    compile "org.springframework.boot:spring-boot-starter-actuator"
    provided "org.springframework.boot:spring-boot-starter-tomcat"
    compile "org.grails:grails-web-boot"
    compile "org.grails:grails-logging"
    compile "org.grails:grails-plugin-rest"
    compile "org.grails:grails-plugin-databinding"
    compile "org.grails:grails-plugin-i18n"
    compile "org.grails:grails-plugin-services"
    compile "org.grails:grails-plugin-url-mappings"
    compile "org.grails:grails-plugin-interceptors"
    compile "org.grails.plugins:cache"
    compile "org.grails.plugins:async"
    compile "org.grails.plugins:scaffolding"
    compile "org.grails.plugins:events"
    compile "org.grails.plugins:hibernate5"
    compile "org.hibernate:hibernate-core:5.4.0.Final"
    compile "org.grails.plugins:gsp"
    compileOnly "io.micronaut:micronaut-inject-groovy"
    console "org.grails:grails-console"
    profile "org.grails.profiles:web"
    runtime "org.glassfish.web:el-impl:2.1.2-b03"
    runtime "com.h2database:h2"
    runtime "org.apache.tomcat:tomcat-jdbc"
    runtime "javax.xml.bind:jaxb-api:2.3.0"
    runtime "com.bertramlabs.plugins:asset-pipeline-grails:3.0.10"
    testCompile "org.grails:grails-gorm-testing-support"
    testCompile "org.mockito:mockito-core"
    testCompile "org.grails:grails-web-testing-support"
    testCompile "org.grails.plugins:geb"
    testCompile "org.seleniumhq.selenium:selenium-remote-driver:3.14.0"
    testCompile "org.seleniumhq.selenium:selenium-api:3.14.0"
    testCompile "org.seleniumhq.selenium:selenium-support:3.14.0"
    testRuntime "org.seleniumhq.selenium:selenium-chrome-driver:3.14.0"
    testRuntime "org.seleniumhq.selenium:selenium-firefox-driver:3.14.0"
}

bootRun {
    jvmArgs(
        '-Dspring.output.ansi.enabled=always', 
        '-noverify', 
        '-XX:TieredStopAtLevel=1',
        '-Xmx1024m')
    sourceResources sourceSets.main
    String springProfilesActive = 'spring.profiles.active'
    systemProperty springProfilesActive, System.getProperty(springProfilesActive)
}

webdriverBinaries {
    chromedriver '2.45.0'
    geckodriver '0.24.0'
}

tasks.withType(Test) {
    systemProperty "geb.env", System.getProperty('geb.env')
    systemProperty "geb.build.reportsDir", reporting.file("geb/integrationTest")
    systemProperty "webdriver.chrome.driver", System.getProperty('webdriver.chrome.driver')
    systemProperty "webdriver.gecko.driver", System.getProperty('webdriver.gecko.driver')
}


assets {
    minifyJs = true
    minifyCss = true
}

artifacts {
    warArtifact war
}
