buildscript {
    repositories {
        mavenCentral()
        maven {
            url "https://plugins.gradle.org/m2/"
        }
        maven {
            url "https://oss.sonatype.org/content/repositories/snapshots/"
        }
    }
    dependencies {
        classpath "biz.aQute.bnd:biz.aQute.bnd.gradle:6.4.0"
        classpath 'com.vanniktech:gradle-maven-publish-plugin:0.19.0'
        classpath "gradle.plugin.com.hierynomus.gradle.plugins:license-gradle-plugin:0.16.1"
    }
}

apply plugin: 'java'

apply plugin: 'jacoco'
jacoco {
    toolVersion = "0.8.5"
}

build.dependsOn jacocoTestReport

check.dependsOn jacocoTestReport

javadoc {
    failOnError = false
    
    options.links(
        "http://docs.oracle.com/javase/7/docs/api/",
        "http://reactivex.io/RxJava/2.x/javadoc", 
        "http://reactivex.io/RxJava/3.x/javadoc"
    )
}

group = "com.github.akarnokd"

sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8

repositories {
    mavenCentral()
    maven {
        url "https://oss.sonatype.org/content/repositories/snapshots/"
    }
}

dependencies {
    implementation "io.reactivex.rxjava2:rxjava:2.2.21"
    implementation "io.reactivex.rxjava3:rxjava:3.1.6"
    testImplementation 'junit:junit:4.13.2'
}


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

jar {
    bnd ('Bundle-Name': 'rxjava3-bridge',
            'Bundle-Vendor': 'akarnokd',
            'Bundle-Description': 'Bridge library between RxJava 2 and RxJava 3',
            'Import-Package': '!org.junit,!junit.framework,!org.mockito.*,*',
            'Bundle-DocURL': 'https://github.com/akarnokd/RxJavaBridge',
            'Export-Package': 'hu.akarnokd.rxjava3.bridge',
            "Bundle-SymbolicName": "hu.akarnokd.rxjava3.bridge",
        )
}

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

test {
    maxHeapSize = "1g"
    testLogging  {
        events "started", "failed", "standard_error" // "skipped", "passed"
        exceptionFormat="full"
        //    showStandardStreams = true
    }
    jacoco.includes = ["**akarnokd**"]
}

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

jacocoTestReport.dependsOn test

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

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