import io.getstream.sketchbook.Configuration
import io.getstream.sketchbook.Dependencies
import io.getstream.sketchbook.Versions

plugins {
    id 'com.android.library'
    id 'org.jetbrains.kotlin.android'
    id 'org.jetbrains.dokka'
    id 'binary-compatibility-validator'
}

ext {
    PUBLISH_GROUP_ID = Configuration.artifactGroup
    PUBLISH_ARTIFACT_ID = 'sketchbook'
    PUBLISH_VERSION = rootVersionName
}

apply from: "${rootDir}/scripts/publish-module.gradle"

android {
    compileSdkVersion Configuration.compileSdk
    defaultConfig {
        minSdkVersion Configuration.minSdk
        targetSdkVersion Configuration.targetSdk
    }

    buildFeatures {
        compose true
        buildConfig false
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    composeOptions {
        kotlinCompilerExtensionVersion Versions.COMPOSE_COMPILER
    }

    kotlinOptions {
        jvmTarget = '11'
    }

    lintOptions {
        abortOnError false
    }
}

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
    kotlinOptions.freeCompilerArgs += [
            "-Xexplicit-api=strict",
            "-Xopt-in=androidx.compose.ui.ExperimentalComposeUiApi"
    ]
}

dependencies {
    implementation Dependencies.androidxCoreKtx
    implementation Dependencies.composeUI
    implementation Dependencies.composeRuntime
    implementation Dependencies.composeMaterial
    implementation Dependencies.composeFoundation
    implementation Dependencies.composeTooling
    implementation Dependencies.colorPicker
}

apply from: "$rootDir/spotless.gradle"