version '1.0-SNAPSHOT'

buildscript {
    ext.kotlin_version = '2.2.20'
    ext.dokka_version = '2.0.0'
    ext.bnd_version = '6.4.0'
    ext.license_version = '0.16.1'
    ext.vanniktech_version = '0.32.0'
    ext.coroutines_version = '1.10.2'

    repositories {
        mavenCentral()
        maven {
            url "https://plugins.gradle.org/m2/"
        }
    }
    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath "biz.aQute.bnd:biz.aQute.bnd.gradle:$bnd_version"
        classpath "com.vanniktech:gradle-maven-publish-plugin:$vanniktech_version"
        classpath "gradle.plugin.com.hierynomus.gradle.plugins:license-gradle-plugin:$license_version"
        classpath "org.jetbrains.dokka:dokka-gradle-plugin:$dokka_version"
    }
}

apply plugin: 'kotlin'
apply plugin: 'org.jetbrains.dokka'
apply plugin: 'jacoco'

group = "com.github.akarnokd"
ext.githubProjectName = 'kotlin-flow-extensions'

repositories {
    mavenCentral()
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
    testImplementation 'junit:junit:4.13.2'
    testImplementation "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version"
}

jacoco {
    toolVersion = "0.8.9"
}

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

apply plugin: 'biz.aQute.bnd.builder'

jar {
    bnd ('Bundle-Name': 'kotlin-flow-extensions',
            'Bundle-Vendor': 'akarnokd',
            'Bundle-Description': 'Extensions to the Kotlin Flow library.',
            'Import-Package': '!org.junit,!junit.framework,!org.mockito.*,*',
            'Bundle-DocURL': 'https://github.com/akarnokd/kotlin-flow-extensions')
}

apply plugin: "com.vanniktech.maven.publish"

test {
    maxHeapSize = "1g"
    testLogging  {
        events "started", "failed" // "skipped", "passed"
        exceptionFormat="full"
        //    showStandardStreams = true
    }
}

build.dependsOn jacocoTestReport

check.dependsOn jacocoTestReport

apply plugin: "com.github.hierynomus.license"

license {
    header rootProject.file('HEADER')
    mapping('kt', 'SLASHSTAR_STYLE')
    skipExistingHeaders true
    ignoreFailures true
    excludes(["**/*.md", "**/*.txt"])
}
