plugins {
    id 'com.gradle.plugin-publish' version '0.10.1'
    id 'java-gradle-plugin'
}
compileJava.options.encoding = 'UTF-8'
compileTestJava.options.encoding = 'UTF-8'
if (JavaVersion.current().isJava9Compatible()) {
    compileJava.options.compilerArgs.addAll(['--release', '8'])
}

compileJava {
    sourceCompatibility = '1.8'
    targetCompatibility = '1.8'
}

repositories {
    mavenLocal()
    mavenCentral()
}

dependencies {
    api gradleApi()
    implementation "io.quarkus:quarkus-bootstrap-core:${version}"
    implementation "io.quarkus:quarkus-devtools-common:${version}"
    implementation "io.quarkus:quarkus-platform-descriptor-json:${version}"
    implementation "io.quarkus:quarkus-platform-descriptor-resolver-json:${version}"
    implementation "io.quarkus:quarkus-development-mode:${version}"
    implementation "io.quarkus:quarkus-creator:${version}"

    testImplementation 'org.assertj:assertj-core:3.14.0'
    testImplementation 'org.junit.jupiter:junit-jupiter-api:5.5.2'
    testImplementation 'org.junit.jupiter:junit-jupiter-params:5.5.2'
    testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.5.2'
}

test {
    testLogging {
        events "passed", "skipped", "failed"
    }
    useJUnitPlatform()
}

javadoc {
    options.addStringOption('encoding', 'UTF-8')
}

pluginBundle {
    website = 'https://quarkus.io/' 
    vcsUrl = 'https://github.com/quarkusio/quarkus' 
    tags = ['quarkus', 'quarkusio', 'graalvm'] 
}

gradlePlugin {
    plugins {
        quarkusPlugin {
            id = 'io.quarkus'
            implementationClass = 'io.quarkus.gradle.QuarkusPlugin'
            displayName = 'Quarkus Plugin'
            description = 'Builds a Quarkus application, and provides helpers to launch dev-mode, the Quarkus CLI, building of native images'
        }
    }
}

// Add a source set for the functional test suite
sourceSets {
    functionalTest {
    }
}

gradlePlugin.testSourceSets(sourceSets.functionalTest)
configurations.functionalTestImplementation.extendsFrom(configurations.testImplementation)
configurations.functionalTestRuntime.extendsFrom(configurations.testRuntimeOnly)

// Add a task to run the functional tests
task functionalTest(type: Test) {
    description = "Runs functional tests"
    group = "verification"
    useJUnitPlatform()
    testClassesDirs = sourceSets.functionalTest.output.classesDirs
    classpath = sourceSets.functionalTest.runtimeClasspath
}

check {
    // Run the functional tests as part of `check`
    dependsOn(tasks.functionalTest)
}