buildscript {
    final majorVersion = 2
    final minorVersion = 0
    final patchVersion = 0

    final latestSdk = 28

    ext.config = [
            // Major -> Millions, Minor -> Thousands, Patch -> Hundreds. E.g 1.3.72 == 1,003,072
            versionCode: 1000000 * majorVersion + 1000 * minorVersion + patchVersion,
            versionName: "$majorVersion.$minorVersion.$patchVersion",

            minSdk     : 19,
            compileSdk : latestSdk,
            targetSdk  : latestSdk
    ]

    final versions = [
            kotlin          : '1.3.10',
            support         : '1.0.0',
            material        : '1.0.0',
            constraintlayout: '2.0.0-alpha2',
            junit           : '4.12',
            atsl            : '1.1.0', // Android Testing Support Library
            espresso        : '3.1.0'
    ]

    ext.deps = [
            kotlinGradlePlugin: "org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}",
            kotlinStdLib      : "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${versions.kotlin}",
            appcompat         : "androidx.appcompat:appcompat:${versions.support}",
            material          : "com.google.android.material:material:${versions.material}",
            annotation        : "androidx.annotation:annotation:${versions.support}",
            ktx               : "androidx.core:core-ktx:${versions.support}",
            constraintlayout  : "androidx.constraintlayout:constraintlayout:${versions.constraintlayout}",
            junit             : "junit:junit:${versions.junit}",
            atsl              : "androidx.test:runner:${versions.atsl}",
            espresso          : "androidx.test.espresso:espresso-core:${versions.espresso}"
    ]

    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.0-beta03'
        classpath deps.kotlinGradlePlugin

        classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
        classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

subprojects {
    // temporary solution to fix "javadoc: error - Illegal package name"
    tasks.withType(Javadoc).all {
        enabled = false
    }
}

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