// Top-level build file where you can add configuration options common to all sub-projects/modules.
//apply from: rootProject.file("file/gradle/config.gradle")
//apply from: rootProject.file("file/gradle/config_libs.gradle")
//apply from: rootProject.file("file/gradle/config_files.gradle")

buildscript {

    // 防止无法获取 ext.deps
    apply from: rootProject.file("file/gradle/config.gradle")
    apply from: rootProject.file("file/gradle/config_libs.gradle")
    apply from: rootProject.file("file/gradle/config_files.gradle")

    repositories { // 该 repositories 用于 buildscript dependencies 插件、脚本依赖加载
        // AliRepo 阿里仓库服务 https://maven.aliyun.com/mvn/view
        maven { url "https://maven.aliyun.com/repository/central" }
        maven { url "https://maven.aliyun.com/repository/public" }
        maven { url "https://maven.aliyun.com/repository/google" }
        maven { url "https://maven.aliyun.com/repository/gradle-plugin" }
        maven { url "https://maven.aliyun.com/repository/apache-snapshots" }
        maven { url "https://maven.aliyun.com/repository/jcenter" }

        google()

        // jitpack maven
        maven { url "https://jitpack.io" }

        maven { url "https://plugins.gradle.org/m2" }

        maven { url "https://oss.sonatype.org/content/repositories/snapshots" }

        maven { url "https://repo1.maven.org/maven2/" }
    }

    dependencies {
        // https://mvnrepository.com/artifact/com.android.tools.build/gradle
        classpath 'com.android.tools.build:gradle:8.11.1'
        // kotlin https://mvnrepository.com/artifact/org.jetbrains.kotlin/kotlin-gradle-plugin
        classpath rootProject.ext.deps.build.kotlin_gradle_plugin
        // https://mvnrepository.com/artifact/org.jetbrains.dokka/dokka-gradle-plugin
        classpath rootProject.ext.deps.build.dokka_gradle_plugin
        // android maven https://plugins.gradle.org/plugin/com.github.dcendents.android-maven
        classpath rootProject.ext.deps.build.android_maven_gradle_plugin
    }
}

allprojects {
    repositories { // 该 repositories 用于 app、module dependencies 第三方库 implementation 等依赖加载
        // AliRepo 阿里仓库服务 https://maven.aliyun.com/mvn/view
        maven { url "https://maven.aliyun.com/repository/central" }
        maven { url "https://maven.aliyun.com/repository/public" }
        maven { url "https://maven.aliyun.com/repository/google" }
        maven { url "https://maven.aliyun.com/repository/gradle-plugin" }
        maven { url "https://maven.aliyun.com/repository/apache-snapshots" }
        maven { url "https://maven.aliyun.com/repository/jcenter" }

        google()

        // jitpack maven
        maven { url "https://jitpack.io" }

        maven { url "https://plugins.gradle.org/m2" }

        maven { url "https://oss.sonatype.org/content/repositories/snapshots" }

        maven { url "https://repo1.maven.org/maven2/" }
    }

//    gradle.projectsEvaluated {
//        tasks.withType(JavaCompile) {
//            options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
//        }
//    }
}

tasks.register('clean', Delete) {
    delete rootProject.buildDir
}

// 全局编码设置
tasks.withType(JavaCompile).configureEach {
    options.encoding = "UTF-8"
}

// 第三方库版本强制统一处理
apply from: rootProject.file(files.unified_library_config_gradle)
//// 生成依赖库 deps 文件信息任务【升级全部第三方库后才放开打印依赖信息】
//apply from: rootProject.file(files.task_generate_deps_file_gradle)