apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'org.jetbrains.dokka'
apply plugin: 'com.google.protobuf'

android {
    compileSdkVersion rootProject.ext.android.compileSdkVersion

    defaultConfig {
        minSdkVersion rootProject.ext.android.minSdkVersion
        targetSdkVersion rootProject.ext.android.targetSdkVersion
        versionCode 1
        versionName "${MOGO_SOCKET_VERSION}"
        consumerProguardFiles "consumer-rules.pro"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    protobuf {
        protoc {
            artifact = rootProject.ext.dependencies.protoc
        }
        generateProtoTasks {
            all().each { task ->
                task.builtins {
                    java {}
                }
            }
        }
    }
}

dependencies {
    implementation rootProject.ext.dependencies.rxandroid
    implementation rootProject.ext.dependencies.protobuf_java
    implementation rootProject.ext.dependencies.protobuf_java_util
    if (Boolean.valueOf(RELEASE)) {
        implementation "com.mogo.cloud:location:${MOGO_LOCATION_VERSION}"
        implementation "com.mogo.cloud:network:${MOGO_NETWORK_VERSION}"
        implementation "com.mogo.cloud:socket:${MOGO_SOCKET_VERSION}"
    } else {
        implementation project(":foudations:mogo-location")
        implementation project(":foudations:mogo-network")
        implementation project(":foudations:mogo-socket")
    }
}

dokka {
    outputFormat = 'javadoc'
    outputDirectory = "$rootDir/ApiDoc/foudations/v2x"

    configuration {
        // Do not output deprecated members
        skipDeprecated = true
        // Emit warnings about not documented members.
        reportUndocumented = true
        // Do not create index pages for empty packages
        skipEmptyPackages = true
        noJdkLink = true
        noStdlibLink = true
        noAndroidSdkLink = true
    }
}

apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()