// Top-level build file where you can add configuration options common to all sub-projects/modules.

apply from: 'dependencies.gradle'

buildscript {
    // Gradle will not find vars defined in an external file when referring to them
    // in the buildscript block, unless you link it from the buildscript block, too.
    apply from: 'dependencies.gradle'

    repositories {
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.2'
        classpath 'me.tatarka:gradle-retrolambda:3.6.1'
        classpath 'me.tatarka.retrolambda.projectlombok:lombok.ast:0.2.3.a2'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$versions.kotlin"
        classpath 'io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.8.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }

    // Exclude the version that the android plugin depends on.
    configurations.classpath.exclude group: 'com.android.tools.external.lombok'
}

allprojects {
    repositories {
        jcenter()
    }

    // Workaround for preventing Gradle from stealing focus from other apps.
    // https://gist.github.com/artem-zinnatullin/4c250e04636e25797165
    tasks.withType(JavaForkOptions) {
        jvmArgs '-Djava.awt.headless=true'
    }
}

subprojects {
    project.plugins.whenPluginAdded { plugin ->
        if ('com.android.build.gradle.AppPlugin'.equals(plugin.class.name)
                || 'com.android.build.gradle.LibraryPlugin'.equals(plugin.class.name)) {

            // Treat all Android Lint warning in all sub-projects as errors.
            project.android.lintOptions.warningsAsErrors = true

            // Project should support Java 6.
            project.android.compileOptions.sourceCompatibility = JavaVersion.VERSION_1_6
            project.android.compileOptions.targetCompatibility = JavaVersion.VERSION_1_6

            project.android.testOptions.unitTests.all {
                testLogging {
                    events 'passed', 'skipped', 'failed', 'standardOut', 'standardError'
                    exceptionFormat 'full'
                }
            }
        }
    }
}

apply plugin: 'io.codearte.nexus-staging'

nexusStaging {
	packageGroup = 'com.artemzin'
}
