/*
 *  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.
 */

sourceCompatibility = "1.11"
targetCompatibility = "1.11"

// TODO: Use bom
//configurations.configureEach {
//    exclude group: 'org.apache.grails.data', module: 'grails-data-simple'
//    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
//        if (details.requested.group == 'org.apache.grails.data'
//                && details.requested.name.startsWith('grails-datastore')
//                && !details.requested.name.contains('neo4j')) {
//
//            details.useVersion(datastoreVersion)
//        } else if (details.requested.group == 'org.apache.groovy' && details.requested.name.startsWith('groovy')) {
//            details.useVersion(groovyVersion)
//        } else if (details.requested.group == 'org.springframework') {
//            details.useVersion(springVersion)
//        }
//    }
//}

dependencies {
    compileOnly "org.apache.grails:grails-core"
    compileOnly "org.apache.grails.bootstrap:grails-bootstrap"
    compileOnly "org.spockframework:spock-core:$spockVersion", {
        exclude group: "junit", module: "junit-dep"
        exclude group: 'org.codehaus.groovy', module: 'groovy-all'
        exclude group: 'org.hamcrest', module: 'hamcrest-core'
    }

    runtimeOnly "org.apache.grails.data:grails-datastore-web:$datastoreVersion"

    api "org.apache.grails.data:grails-datamapping-support:$datastoreVersion", {
        exclude group:'org.springframework', module:'spring-context'
        exclude group:'org.springframework', module:'spring-core'
        exclude group:'org.springframework', module:'spring-beans'
        exclude group:'org.springframework', module:'spring-tx'
        exclude group:'org.apache.grails.bootstrap', module:'grails-bootstrap'
        exclude group:'org.codehaus.groovy', module:'groovy-all'
        exclude group:'org.apache.grails', module:'grails-core'
        exclude group:'javax.transaction', module:'jta'
    }
    api project(":grails-datastore-gorm-neo4j"), {
        exclude group:'org.springframework', module:'spring-context'
        exclude group:'org.springframework', module:'spring-core'
        exclude group:'org.springframework', module:'spring-beans'
        exclude group:'org.springframework', module:'spring-tx'
        exclude group:'org.apache.grails.bootstrap', module:'grails-bootstrap'
        exclude group:'org.codehaus.groovy', module:'groovy-all'
        exclude group:'org.apache.grails', module:'grails-core'
        exclude group:'javax.transaction', module:'jta'
    }

    testImplementation "org.apache.grails:grails-core"
    testImplementation "org.apache.grails.bootstrap:grails-bootstrap"
    testImplementation "org.neo4j.test:neo4j-harness:$neo4jVersion"

}

springBoot {
    mainClass  = "grails.plugins.neo4j.Application"
}