

/*
 *
 *  * Copyright 2022 AndroidPoet (Ranbir Singh)
 *  *
 *  * Licensed under the Apache License, Version 2.0 (the "License");
 *  * you may not use this file except in compliance with the License.
 *  * You may obtain a copy of the License at
 *  *
 *  * http://www.apache.org/licenses/LICENSE-2.0
 *  *
 *  * Unless required by applicable law or agreed to in writing, software
 *  * distributed under the License is distributed on an "AS IS" BASIS,
 *  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  * See the License for the specific language governing permissions and
 *  * limitations under the License.
 *
 *
 */

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'org.jetbrains.dokka'
apply plugin: 'binary-compatibility-validator'
apply from: "$rootDir/dependencies.gradle"

android {
    compileSdkVersion versions.compileSdk
    defaultConfig {
        minSdkVersion versions.minSdk
        targetSdkVersion versions.compileSdk
        versionCode versions.versionCode
        versionName versions.versionName
    }

    resourcePrefix 'metaphor'

    buildFeatures {
        buildConfig false
        viewBinding true
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = "1.8"
    }

    lintOptions {
        abortOnError false
    }
}

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
    kotlinOptions.freeCompilerArgs += ["-Xexplicit-api=strict"]
}

apiValidation {

    nonPublicMarkers += [
            "kotlin.PublishedApi",
    ]
}

dependencies {
    implementation "androidx.appcompat:appcompat:$versions.androidxAppcompat"
    implementation "androidx.fragment:fragment-ktx:$versions.androidxFragment"
    implementation "androidx.core:core-ktx:$versions.ktx"
    implementation "com.google.android.material:material:$versions.googleMaterial"
    implementation "androidx.lifecycle:lifecycle-common-java8:2.4.1"
    implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.4.1"

}

dokkaHtml.configure {
    dokkaSourceSets {
        named("main") {
            noAndroidSdkLink.set(false)
        }
    }
}


allprojects {
    plugins.withId("com.vanniktech.maven.publish") {
        mavenPublish {
            sonatypeHost = "S01"
        }
    }
}

apply plugin: "com.vanniktech.maven.publish"
apply from: "$rootDir/spotless.gradle"
