/*
 *  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 {
    pomTitle = 'Grails GORM'
    pomDescription = 'GORM - Grails Data Access Framework'
    pomDevelopers = [
            'graemerocher': 'Graeme Rocher',
            'jeffscottbrown': 'Jeff Brown',
            'burtbeckwith': 'Burt Beckwith',
            'jameskleeh': 'James Kleeh',
            'puneetbehl': 'Puneet Behl',
            'jamesfredley': 'James Fredley'
    ]
}

dependencies {

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

    api project(':grails-common')

    api 'jakarta.persistence:jakarta.persistence-api', {
        // api: FlushModeType, AccessType, CascadeType, EnumType, FetchType, LockModeType, JoinType
        // impl: Entity, Transient
    }
    api "org.javassist:javassist:$javassistVersion", {
        // api: MethodHandler
    }
    api 'org.springframework:spring-context', {
        // api: ApplicationContext, ApplicationEvent, ApplicationEventPublisher, ConfigurableApplicationContext, MessageSource, TransactionDefinition, Validator
        // impl: DataBinder
    }
    api 'org.springframework:spring-core', {
        // api: ConcurrentReferenceHashMap (used in deprecated class), ConversionService, Converter, ConverterRegistry, PropertyResolver
        // impl: Assert, ClassUtils, ConversionException, ConversionFailedException, MapPropertySource, NamedThreadLocal, PathMatchingResourcePatternResolver, Resource (api?), StringUtils
    }
    api 'org.springframework:spring-tx', {
        // api: DataAccessResourceFailureException, OptimisticLockingFailureException, TransactionDefinition
        // impl: DefaultTransactionDefinition, InvalidDataAccessResourceUsageException, NoTransactionException, TransactionSynchronizationManager
    }

    implementation 'com.github.ben-manes.caffeine:caffeine', {
        // impl: Caffeine, RemovalListener
    }
    implementation 'jakarta.annotation:jakarta.annotation-api', {
        // impl: PreDestroy
    }
    implementation 'org.apache.groovy:groovy', {
        // impl: Builder
        // comp: CompileStatic
    }
    implementation 'org.springframework:spring-beans', {
        // impl: Autowired, BeanUtils, BeanWrapper, BeanWrapperImpl, MutablePropertyValues
    }

    compileOnly 'org.slf4j:slf4j-api', {
        // provided: Logger, LoggerFactory
    }


    testImplementation project(':grails-datamapping-core'), {
        // we only need the @grails.gorm.annotation.Entity annotation to test GORM syntax mapping
        transitive = false
    }
    testImplementation 'org.junit.jupiter:junit-jupiter-api', {
        // There are some tests that use JUnit 5
    }
    testImplementation 'org.spockframework:spock-core'

    testRuntimeOnly 'org.apache.groovy:groovy-test-junit5'
    testRuntimeOnly 'org.slf4j:slf4j-nop' // Get rid of warning about missing slf4j implementation during tests
}

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/test-config.gradle')
    from rootProject.layout.projectDirectory.file('gradle/docs-config.gradle')
}

