apply from: "config.gradle"

buildscript {

    ext {
        kotlin_version = '1.6.10'
        support_version = '26.1.0'
        minSdkVersion = 23
        targetSdkVersion = 28
        compileSdkVersion = 28
        buildToolsVersion = '28.0.3'
        arouter_api = '1.4.1'
        arouter_compiler = '1.2.2'
        ydlrouter_version = '1.2.3'
        constrait_support_version = '1.0.2'

        componentVersion = "0.3.0.49.3-SNAPSHOT"
    }
    repositories {
        mavenCentral()
        google()
        mavenLocal()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:7.2.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}
allprojects { p ->
    if (p.path.startsWith(":ydl-")) {
        p.version = componentVersion
    }
    if (p.path.startsWith(":m-")) {
        p.version = componentVersion
    }
    if (p.path.startsWith(":api:")) {
        p.version = componentVersion
    }
    repositories {
        maven {
            url 'http://nexus.yidianling.com/repository/android/'
            allowInsecureProtocol true
            credentials {
                username "admin"
                password "fjoi#1+#@"
            }
        }
        mavenCentral()
        google()
        maven {
            url 'http://maven.aliyun.com/nexus/content/groups/public/'
            allowInsecureProtocol true
        }
        maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
        mavenLocal()
    }
}

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

subprojects {
    project.configurations.all {
        //防止support版本冲突，统一设置第三方support版本
        resolutionStrategy.eachDependency { details ->
            if (details.requested.group == 'com.android.support'
                    && !details.requested.name.contains('multidex')) {
                details.useVersion "$support_version"
            }
        }
    }
}
