// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    ext.kotlin_version = '1.9.24'
    ext.shadow_version = '1.0.5'
    repositories {
        google()
        jcenter()
        mavenCentral()
        maven {
            url "https://nexus.shanqu.cc/repository/lightgame-public/"
            credentials {
                username("lg_android")
                password("u9gZYH4MQEwLLQZK")
            }
        }
        maven { url "https://maven.google.com" }
        maven { url 'https://jitpack.io' }
    }

    dependencies {
        classpath "com.android.tools.build:gradle:7.1.3"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.sensorsdata.analytics.android:android-gradle-plugin2:3.5.3'
        classpath "com.lg.shadow.core:gradle-plugin:$shadow_version"
    }
}

plugins {
    id 'com.google.devtools.ksp' version '1.9.24-1.0.20' apply false
    id 'cn.therouter' version '1.2.2' apply false
}
apply from: 'dependencies.gradle'
apply from: 'vspace-bridge/config.gradle'

allprojects {
    repositories {
        maven {
            url "https://nexus.shanqu.cc/repository/lightgame-public/"
            credentials {
                username("lg_android")
                password("u9gZYH4MQEwLLQZK")
            }
        }
        google()
        jcenter()
        mavenCentral()
        maven { url 'https://maven.aliyun.com/repository/public' }
        maven { url 'https://maven.aliyun.com/repository/central'}
        maven { url 'https://maven.aliyun.com/nexus/content/repositories/releases/' }
        maven { url 'https://artifact.bytedance.com/repository/Volcengine/'}
        maven { url 'https://artifact.bytedance.com/repository/pangle' }
        maven {
            url 'http://maven.aliyun.com/nexus/content/repositories/releases/'
            name 'aliyun'
            allowInsecureProtocol true
        }
        // 配置HMS Core SDK的Maven仓地址。
        maven { url 'https://developer.huawei.com/repo/' }
        maven { url 'https://developer.hihonor.com/repo' }
        maven { url 'https://jitpack.io' }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
subprojects {
    subproject ->
        afterEvaluate {
            if (!project.name.startsWith("va-") && (subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) {
                if (!android.compileSdkVersion) {
                    android {
                        compileSdkVersion rootProject.ext.compileSdkVersion
                    }
                }
                android {
                    buildToolsVersion rootProject.ext.buildToolsVersion

                    defaultConfig {
                        minSdkVersion rootProject.ext.minSdkVersion

                        // for those defined in AndroidManifest.xml
                        manifestPlaceholders = [
                                manifestApplicationId: "${applicationId}",
                                tencentAppId         : "${TENCENT_APPID}",

                                JPUSH_PKGNAME: "${applicationId}",
                                JPUSH_APPKEY : "529559b0a2907f0bea50f982",
                                JPUSH_CHANNEL: "developer-default",

                                HONOR_APPID  : "104438304",

                                OPPO_APPKEY : "OP-5mY3zO3qOSkkSk08w0c4gkgOs",
                                OPPO_APPID : "OP-3364411",
                                OPPO_APPSECRET: "OP-9aE8F96D4aB669b054007A5b91725090",

                                VIVO_APPKEY : "00feb475d0ec11cea52fab5c813da45d",
                                VIVO_APPID : "100032364",
                        ]
                    }
                    lintOptions.abortOnError false

                    packagingOptions {
                        exclude 'META-INF/NOTICE'
                        exclude 'META-INF/LICENSE'
                        exclude 'META-INF/DEPENDENCIES'
                        exclude 'META-INF/services/javax.annotation.processing.Processor'
                    }

                }
            }
        }
}