/*
 * This file was generated by the Gradle 'init' task.
 *
 * This generated file contains a sample Gradle plugin project to get you started.
 * For more details take a look at the Writing Custom Plugins chapter in the Gradle
 * User Manual available at https://docs.gradle.org/7.3/userguide/custom_plugins.html
 * This project uses @Incubating APIs which are subject to change.
 */

plugins {
    // Apply the Java Gradle plugin development plugin to add support for developing Gradle plugins
    id 'java-gradle-plugin'
}

repositories {
    // Use Maven Central for resolving dependencies.
    mavenCentral()
}

testing {
    suites {
        // Configure the built-in test suite
        test {
            // Use JUnit Jupiter test framework
            useJUnitJupiter('5.7.2')
        }

        // Create a new test suite
        functionalTest(JvmTestSuite) {
            dependencies {
                // functionalTest test suite depends on the production code in tests
                implementation project
            }

            targets {
                all {
                    // This test suite should run after the built-in test suite has run its tests
                    testTask.configure { shouldRunAfter(test) } 
                }
            }
        }
    }
}

gradlePlugin {
    // Define the plugin
    plugins {
        greeting {
            id = 'org.example.gradle.plugin.greeting'
            implementationClass = 'org.example.gradle.plugin.GradlePluginPlugin'
        }
    }
}

gradlePlugin.testSourceSets(sourceSets.functionalTest)

tasks.named('check') {
    // Include functionalTest as part of the check lifecycle
    dependsOn(testing.suites.functionalTest)
}