// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:7.0.4'
    }
}

allprojects {
    buildscript {
        repositories {
            mavenCentral()
        }
    }
    repositories {
        google()
        mavenCentral()
    }

    // Enabling checkstyle for all sub projects
    project == rootProject || project.afterEvaluate {
        project.apply plugin: 'checkstyle'

        project.extensions.getByName('checkstyle').with {
            toolVersion = '8.32'
            configFile file("${rootDir}/checkstyle.xml")
        }

        task checkstyle(type: Checkstyle) {
            source 'src'
            include '**/*.java', '**/*.xml'
            classpath = files()
        }

        project.tasks.getByName('check').dependsOn 'checkstyle'

        project.extensions.getByName('android').with {
            lintOptions {
                ignore 'GoogleAppIndexingWarning', 'ContentDescription',
                        'RtlHardcoded', 'IconMissingDensityFolder'
            }
        }
    }

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