/*
 *  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.grails.forge.rocker'
}

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

sourceSets {
    test {
        rocker {
            srcDir('src/test/groovy')
        }
    }
}

configurations.register('generateConfig')
configurations.configureEach {
    resolutionStrategy {
        // prevent fatJar result containing multiple versions of picocli
        force("info.picocli:picocli:$picocliVersion")
    }
}

dependencies {
    implementation gradleTestKit()
    generateConfig "info.picocli:picocli-codegen:$picocliVersion"

    implementation "io.micronaut:micronaut-inject-groovy:$micronautVersion"

    testImplementation project(':grails-forge-cli')
    testImplementation project(':grails-forge-core')
    testImplementation "ch.qos.logback:logback-classic:$logbackClassicVersion"
    testImplementation 'io.micronaut.picocli:micronaut-picocli'

    if (project.hasProperty('micronautVersion')) {
        testCompileOnly "io.micronaut:micronaut-inject-groovy:$micronautVersion"
    }

    testImplementation "org.codehaus.groovy:groovy:$groovyVersion"
    testImplementation "org.spockframework:spock-core:$spockVersion", {
        exclude group: 'org.codehaus.groovy', module: 'groovy-all'
    }

    testImplementation "cglib:cglib-nodep:$cglibVersion"
    testImplementation "org.objenesis:objenesis:$objenesisVersion"
    testRuntimeOnly "ch.qos.logback:logback-classic:$logbackClassicVersion"
    testImplementation "org.codehaus.groovy:groovy-test:$groovyVersion"
}

apply {
    from rootProject.layout.projectDirectory.file('gradle/java-config.gradle')
    from rootProject.layout.projectDirectory.file('gradle/test-config.gradle')
}