// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    ext{
        android_gradle_plugin_version = '4.1.2'
        // java.lang.NoSuchMethodError: No interface method startReplaceableGroup(ILjava/lang/String;)
        // V in class Landroidx/compose/runtime/Composer;
        // kotlin_version = "1.5.10"
        kotlin_version = "1.4.32"
        coroutines_version = '1.4.3'
        compose_version = '1.0.0-beta08'
        compose_activity_version = '1.3.0-beta01'
        compose_appcompat_version = '1.3.0'
        compose_constraintlayout_version = '1.0.0-alpha07'
        compose_navigation_version = '2.4.0-alpha02'
        compose_lifecycle_version = '1.0.0-alpha06'
        compose_accompanist_version = "0.11.1"
        compose_utils_chrisbanes_coil = "0.6.2"
        compose_utils_coil = "1.2.2"
        paging_compose_version = "1.0.0-alpha10"
    }
    repositories {
        google()
        jcenter()
        // maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/'}
    }
    dependencies {
        classpath "com.android.tools.build:gradle:$android_gradle_plugin_version"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

plugins {
    id 'com.diffplug.spotless' version '5.7.0'
}

allprojects {
    repositories {
        google()
        jcenter()
        // maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/'}
    }

    apply plugin: 'com.diffplug.spotless'
    spotless {
        kotlin {
            target '**/*.kt'
            targetExclude("$buildDir/**/*.kt")
            targetExclude('bin/**/*.kt')

            ktlint("0.40.0")
            // licenseHeaderFile rootProject.file('spotless/copyright.kt')
        }
    }
    tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
        kotlinOptions {
            jvmTarget = JavaVersion.VERSION_1_8.toString()
            freeCompilerArgs += ["-Xskip-prerelease-check", "-progressive" ]
            freeCompilerArgs += "-Xopt-in=kotlin.Experimental"
            freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn"
            freeCompilerArgs += "-Xopt-in=kotlinx.coroutines.ExperimentalCoroutinesApi"
            freeCompilerArgs += "-Xopt-in=kotlinx.coroutines.FlowPreview"
            useIR = true
            allWarningsAsErrors = false
        }
    }
}

//task clean(type: Delete) {
//    delete rootProject.buildDir
//}