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

// see https://github.com/dependabot/dependabot-core/issues/1618
// This file allows dependabot to update the gradle dependencies

// This file provides the 'grails-bom' dependencies, while grails-gradle/dependencies.gradle provides the 'grails-gradle-bom' dependencies
// These files are split to facilitate separation of build vs application dependencies. These are the application dependencies.
ext {
    gradleBomDependencyVersions = [
            'ant.version'                   : '1.10.15',
            'asciidoctor-gradle-jvm.version': '4.0.5',
            'asciidoctorj.version'          : '3.0.0',
            'asset-pipeline-gradle.version' : '5.0.19',
            'byte-buddy.version'            : '1.17.7',
            'commons-text.version'          : '1.13.1',
            'directory-watcher.version'     : '0.19.1',
            'gradle-spock.version'          : '2.3-groovy-3.0',
            'grails-publish-plugin.version' : '0.0.2-SNAPSHOT',
            'grails-gdoc-engine.version'    : '1.0.1',
            'jansi.version'                 : '1.18',
            'javaparser-core.version'       : '3.27.0',
            'jline.version'                 : '2.14.6',
            'jna.version'                   : '5.17.0',
            'jquery.version'                : '3.7.1',
            'objenesis.version'             : '3.4',
            'gradle-spock.version'          : '2.3-groovy-3.0',
            'spring-boot.version'           : '3.5.6',
    ]

    // Note: the name of the dependency must be the prefix of the property name so properties in the pom are resolved correctly
    gradleBomPlatformDependencies = [
            'spring-boot-bom' : "org.springframework.boot:spring-boot-dependencies:${gradleBomDependencyVersions['spring-boot.version']}",
            'gradle-spock-bom': "org.spockframework:spock-bom:${gradleBomDependencyVersions['gradle-spock.version']}",
    ]

    // Note: the name of the dependency must be the prefix of the property name so properties in the pom are resolved correctly
    gradleBomDependencies = [
            'ant'                    : "org.apache.ant:ant:${gradleBomDependencyVersions['ant.version']}",
            'ant-junit'              : "org.apache.ant:ant-junit:${gradleBomDependencyVersions['ant.version']}",
            'asciidoctorj-gradle-jvm': "org.asciidoctor:asciidoctor-gradle-jvm:${gradleBomDependencyVersions['asciidoctor-gradle-jvm.version']}",
            'asciidoctorj'           : "org.asciidoctor:asciidoctorj:${gradleBomDependencyVersions['asciidoctorj.version']}",
            'asset-pipeline-gradle'  : "cloud.wondrify:asset-pipeline-gradle:${gradleBomDependencyVersions['asset-pipeline-gradle.version']}",
            'byte-buddy'             : "net.bytebuddy:byte-buddy:${gradleBomDependencyVersions['byte-buddy.version']}",
            'commons-text'           : "org.apache.commons:commons-text:${gradleBomDependencyVersions['commons-text.version']}",
            'directory-watcher'      : "io.methvin:directory-watcher:${gradleBomDependencyVersions['directory-watcher.version']}",
            'grails-publish-plugin'  : "org.apache.grails.gradle:grails-publish:${gradleBomDependencyVersions['grails-publish-plugin.version']}",
            'grails-gdoc-engine'     : "org.grails:grails-gdoc-engine:${gradleBomDependencyVersions['grails-gdoc-engine.version']}",
            'jansi'                  : "org.fusesource.jansi:jansi:${gradleBomDependencyVersions['jansi.version']}",
            'javaparser-core'        : "com.github.javaparser:javaparser-core:${gradleBomDependencyVersions['javaparser-core.version']}",
            'jline'                  : "jline:jline:${gradleBomDependencyVersions['jline.version']}",
            'jna'                    : "net.java.dev.jna:jna:${gradleBomDependencyVersions['jna.version']}",
            'objenesis'              : "org.objenesis:objenesis:${gradleBomDependencyVersions['objenesis.version']}",
            'spring-boot-cli'        : "org.springframework.boot:spring-boot-cli:${gradleBomDependencyVersions['spring-boot.version']}",
            'spring-boot-gradle'     : "org.springframework.boot:spring-boot-gradle-plugin:${gradleBomDependencyVersions['spring-boot.version']}",
    ]

    bomDependencyVersions = [
            'asset-pipeline-bom.version'  : '5.0.19',
            'bootstrap-icons.version'     : '1.13.1',
            'bootstrap.version'           : '5.3.7',
            'commons-codec.version'       : '1.18.0',
            'geb-spock.version'           : '8.0.0',
            'groovy.version'              : '4.0.28',
            'h2.version'                  : '2.3.232',
            'jackson.version'             : '2.19.1',
            'jquery.version'              : '3.7.1',
            'liquibase-hibernate5.version': '4.27.0',
            'mongodb.version'             : '5.5.1',
            'rxjava.version'              : '1.3.8',
            'rxjava2.version'             : '2.2.21',
            'rxjava3.version'             : '3.1.11',
            'selenium.version'            : '4.34.0',
            'spock.version'               : '2.3-groovy-4.0',
            'sitemesh.version'            : '2.6.0',
            'starter-sitemesh.version'    : '3.2.2',
    ]

    // Note: the name of the dependency must be the prefix of the property name so properties in the pom are resolved correctly
    bomPlatformDependencies = [
            'asset-pipeline-bom': "cloud.wondrify:asset-pipeline-bom:${bomDependencyVersions['asset-pipeline-bom.version']}",
            'spock-bom'         : "org.spockframework:spock-bom:${bomDependencyVersions['spock.version']}",
            'jackson-bom'       : "com.fasterxml.jackson:jackson-bom:${bomDependencyVersions['jackson.version']}",
            'groovy-bom'        : "org.apache.groovy:groovy-bom:${bomDependencyVersions['groovy.version']}",
            'selenium-bom'      : "org.seleniumhq.selenium:selenium-bom:${bomDependencyVersions['selenium.version']}",
    ]

    // Note: the name of the dependency must be the prefix of the property name so properties in the pom are resolved correctly
    bomDependencies = [
            'bootstrap'                : "org.webjars.npm:bootstrap:${bomDependencyVersions['bootstrap.version']}",
            'bootstrap-icons'          : "org.webjars.npm:bootstrap-icons:${bomDependencyVersions['bootstrap-icons.version']}",
            'commons-codec'            : "commons-codec:commons-codec:${bomDependencyVersions['commons-codec.version']}",
            'geb-spock'                : "org.apache.groovy.geb:geb-spock:${bomDependencyVersions['geb-spock.version']}",
            'h2'                       : "com.h2database:h2:${bomDependencyVersions['h2.version']}",
            'jquery'                   : "org.webjars.npm:jquery:${bomDependencyVersions['jquery.version']}",
            'liquibase-hibernate5'     : "org.liquibase:liquibase:${bomDependencyVersions['liquibase-hibernate5.version']}",
            'liquibase-hibernate5-cdi' : "org.liquibase:liquibase-cdi:${bomDependencyVersions['liquibase-hibernate5.version']}",
            'liquibase-hibernate5-core': "org.liquibase:liquibase-core:${bomDependencyVersions['liquibase-hibernate5.version']}",
            'liquibase-hibernate5-ext' : "org.liquibase.ext:liquibase5-hibernate:${bomDependencyVersions['liquibase-hibernate5.version']}",
            'mongodb-bson'             : "org.mongodb:bson:${bomDependencyVersions['mongodb.version']}",
            'mongodb-driver-core'      : "org.mongodb:mongodb-driver-core:${bomDependencyVersions['mongodb.version']}",
            'mongodb-driver-sync'      : "org.mongodb:mongodb-driver-sync:${bomDependencyVersions['mongodb.version']}",
            'mongodb-record-codec'     : "org.mongodb:bson-record-codec:${bomDependencyVersions['mongodb.version']}",
            'rxjava'                   : "io.reactivex:rxjava:${bomDependencyVersions['rxjava.version']}",
            'rxjava2'                  : "io.reactivex.rxjava2:rxjava:${bomDependencyVersions['rxjava2.version']}",
            'rxjava3'                  : "io.reactivex.rxjava3:rxjava:${bomDependencyVersions['rxjava3.version']}",
            'sitemesh'                 : "opensymphony:sitemesh:${bomDependencyVersions['sitemesh.version']}",
            'starter-sitemesh'         : "org.sitemesh:spring-boot-starter-sitemesh:${bomDependencyVersions['starter-sitemesh.version']}",
    ]

    // Because pom exclusions aren't properly supported by gradle, we can't inherit the grails-gradle-bom
    // this requires copying the platforms selectively to the grails-bom. Create a combined version for convenience.
    combinedPlatforms = ['spring-boot-bom': gradleBomPlatformDependencies['spring-boot-bom']] + bomPlatformDependencies
    combinedDependencies = gradleBomDependencies + bomDependencies
    combinedVersions = gradleBomDependencyVersions + bomDependencyVersions
}
