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

plugins {
    id 'groovy'
    id 'java-library'
    id 'org.apache.grails.buildsrc.publish'
    id 'org.apache.grails.buildsrc.sbom'
}

version = projectVersion
group = 'org.apache.grails.data'

ext {
    gormApiDocs = true
    pomTitle = 'Grails GORM'
    pomDescription = 'GORM - Grails Data Access Framework'
    pomDevelopers =  [
            'graemerocher': 'Graeme Rocher',
            'jeffscottbrown': 'Jeff Brown',
            'burtbeckwith': 'Burt Beckwith',
            'puneetbehl': 'Puneet Behl',
    ]
}

dependencies {
    // TODO: Clarify and clean up dependencies
    implementation platform(project(':grails-bom'))

    api 'org.slf4j:slf4j-api'

    api 'org.apache.groovy:groovy'
    api project(':grails-datamapping-core')
    api 'org.springframework:spring-orm'
    api "org.hibernate:hibernate-core-jakarta:$hibernate5Version", {
        exclude group:'commons-logging', module:'commons-logging'
        exclude group:'com.h2database', module:'h2'
        exclude group:'commons-collections', module:'commons-collections'
        exclude group:'org.slf4j', module:'jcl-over-slf4j'
        exclude group:'org.slf4j', module:'slf4j-api'
        exclude group:'org.slf4j', module:'slf4j-log4j12'
        exclude group:'xml-apis', module:'xml-apis'
    }
    api 'org.hibernate.validator:hibernate-validator', {
        exclude group:'commons-logging', module:'commons-logging'
        exclude group:'commons-collections', module:'commons-collections'
        exclude group:'org.slf4j', module:'slf4j-api'
    }

    testImplementation 'com.h2database:h2'
    testImplementation 'org.junit.platform:junit-platform-suite', {
        // api: SelectClasses, Suite
    }
    testImplementation 'org.apache.groovy:groovy-test-junit5'
    testImplementation 'org.apache.groovy:groovy-sql'
    testImplementation 'org.apache.groovy:groovy-json'
    testImplementation 'org.apache.tomcat:tomcat-jdbc'
    testImplementation 'org.spockframework:spock-core'
    testImplementation "org.yakworks:hibernate-groovy-proxy:$yakworksHibernateGroovyProxyVersion", {
        // groovy proxy fixes bytebuddy to be a bit smarter when it comes to groovy metaClass
        exclude group: 'org.codehaus.groovy', module: 'groovy'
    }

    testRuntimeOnly "org.hibernate:hibernate-ehcache:$hibernate5Version", {
        // exclude javax variant of hibernate-core 5.6
        exclude group: 'org.hibernate', module: 'hibernate-core'
    }
    testRuntimeOnly "org.jboss.spec.javax.transaction:jboss-transaction-api_1.3_spec:$jbossTransactionApiVersion", {
        // required for hibernate-ehcache to work with javax variant of hibernate-core excluded
    }
    testRuntimeOnly 'org.slf4j:slf4j-simple'
    testRuntimeOnly 'org.slf4j:jcl-over-slf4j'
    testRuntimeOnly 'org.springframework:spring-aop'
}

apply {
    from rootProject.layout.projectDirectory.file('gradle/java-config.gradle')
    from rootProject.layout.projectDirectory.file('gradle/code-style-config.gradle')
    from rootProject.layout.projectDirectory.file('gradle/hibernate5-test-config.gradle')
    from rootProject.layout.projectDirectory.file('gradle/grails-data-tck-config.gradle')
    from rootProject.layout.projectDirectory.file('gradle/docs-config.gradle')
}
