buildscript {
    ext.kotlin_version = '1.3.41'

    repositories {
        jcenter()
    }

    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.netflix.nebula:nebula-release-plugin:11.0.0'
        classpath 'com.netflix.nebula:nebula-bintray-plugin:6.0.6'
        classpath('org.jfrog.buildinfo:build-info-extractor-gradle:4.9.8') {
            force = true
        }
    }
}

plugins {
    id 'com.github.ben-manes.versions' version '0.22.0'
}

allprojects {
    group = 'actor.proto'

    apply plugin: 'idea'
    apply plugin: 'nebula.release'
}

subprojects {
    apply plugin: 'kotlin'

    ext.coroutines_version = "1.2.2"
    ext.protobuf_version = "3.9.1"
    ext.grpc_version = "1.22.1"
    ext.slf4j_version = "1.7.26"
    ext.awaitility_version = "3.1.6"
    ext.junit_platform_version = "5.6.0"
    ext.kotlin_logging_version = "1.7.3"
    ext.jctools_version = "2.1.2"
    ext.javax_annotations_version = "1.3.2"

    repositories {
        jcenter()
    }

    dependencies {
        implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"

        testImplementation("org.junit.jupiter:junit-jupiter-api:${junit_platform_version}")
        testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:${junit_platform_version}")
    }

    compileKotlin {
        kotlinOptions {
            jvmTarget = "1.8"
            allWarningsAsErrors = false
        }
    }

    compileTestKotlin { kotlinOptions.jvmTarget = "1.8" }
}

configure(subprojects - project(':examples')) {
    apply from: "$rootDir/gradle/publishing.gradle"
    apply plugin: 'jacoco'

    jacocoTestReport {
        reports {
            xml.enabled = true
            html.enabled = true
        }
    }

    check.dependsOn jacocoTestReport
}

gradle.taskGraph.whenReady { graph ->
    tasks.artifactoryPublish.onlyIf {
        graph.hasTask(':snapshot')
    }
}

wrapper {
    gradleVersion = '6.3'
}
