// Copyright 2017-2020 Fitbit, Inc
// SPDX-License-Identifier: Apache-2.0

plugins {
    id 'com.android.library'
    id 'kotlin-android'
    id 'org.jetbrains.dokka-android'
    id 'com.jfrog.artifactory'
    id 'maven-publish'
}

def packageName = 'com.fitbit.goldengate.connectionmanager'

task sourceJar(type: Jar) {
    from android.sourceSets.main.java.srcDirs
    classifier "sources"
}

apply from: '../gg_lib_android_build.gradle'

dependencies {
    implementation project(':RxFitbitGatt')
    implementation project(':GoldenGateBindings')
    implementation project(':linkcontroller')

    implementation "com.github.fitbit:bitgatt:$BITGATT_COMMIT_VERSION"
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation"org.jetbrains.kotlin:kotlin-stdlib:$KOTLIN_VERSION"
    implementation "androidx.appcompat:appcompat:$ANDROIDX_APPCOMPAT_VERSION"
    testImplementation "junit:junit:$JUNIT_VERSION"
    implementation "io.reactivex.rxjava2:rxjava:$RXJAVA_VERSION"
    implementation "io.reactivex.rxjava2:rxandroid:$RXANDROID_VERSION"
    implementation "com.jakewharton.timber:timber:$TIMBER_VERSION"
    testImplementation "org.mockito:mockito-core:$MOCKITO_VERSION"
    testImplementation "org.mockito.kotlin:mockito-kotlin:$MOCKITO_KOTLIN_VERSION"
    testImplementation "org.jetbrains.kotlin:kotlin-test:$KOTLIN_VERSION"
    testImplementation "org.robolectric:robolectric:$ROBOLECTRIC_VERSION"
}

dokka {
    outputFormat = 'html'
    outputDirectory = "$buildDir/javadoc"
    reportUndocumented = true

    packageOptions {
        prefix = "com.fitbit.goldengate.bindings"
        suppress = true
    }
}

apply from: '../jacoco.gradle'

publishing {
    publications {
        aar(MavenPublication) {
            groupId packageName
            version = libraryVersionName
            artifactId project.getName()

            artifact sourceJar
            artifact ("$buildDir/outputs/aar/GoldenGateConnectionManager-${publishVariant}.aar")
        }
    }
}

setupPublishDependency(artifactoryPublish)
