buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.1.2'
    }
}

apply plugin: 'com.android.application'

repositories {
    mavenCentral()
    maven { 
        url "https://repository-achartengine.forge.cloudbees.com/snapshot/"
    }
}

dependencies {
    compile "com.android.support:design:22.2.1"
    compile "org.achartengine:achartengine:1.1.0"
    compile "ch.acra:acra:4.6.1"
    compile 'com.google.android.gms:play-services:4.0.30'
    compile 'org.apache.commons:commons-lang3:3.1'

    compile ('com.google.api-client:google-api-client:1.19.0') {
        exclude group: 'org.apache.httpcomponents'
        exclude group: 'xpp3'
        exclude group: 'junit'
        exclude group: 'com.google.android'
    }
    compile 'com.google.api-client:google-api-client-android:1.19.0'
    compile 'com.google.api-client:google-api-client-gson:1.19.0'
    compile 'com.google.apis:google-api-services-adsense:v1.4-rev29-1.19.0'
    compile 'com.google.code.gson:gson:2.1'
    compile 'net.sf.opencsv:opencsv:2.3'
    compile 'com.google.code.findbugs:jsr305:1.3.9'
}

android {

	compileSdkVersion 22
	buildToolsVersion "23.0.3"

    // lintOptions {
    //     checkReleaseBuilds false
    //     abortOnError false
    // }


    signingConfigs {
        if (rootProject.file('andlytics-release-key.keystore').exists()) {
            release {
                storeFile file ("andlytics-release-key.keystore")
            }
        }
    }

    buildTypes {
        release {
            if (rootProject.file('andlytics-release-key.keystore').exists()) {
                signingConfig signingConfigs.release
            }
        }
        releaseUnsigned.initWith(buildTypes.release)
        releaseUnsigned {
            signingConfig null
        }
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_6
        targetCompatibility JavaVersion.VERSION_1_6
    }

	sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            resources.srcDirs = ['src']
            aidl.srcDirs = ['src']
            renderscript.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
        }

        // Move the build types to build-types/<type>
        // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
        // This moves them out of them default location under src/<type>/... which would
        // conflict with src/ being used by the main source set.
        // Adding new build types or product flavors should be accompanied
        // by a similar customization.
        debug.setRoot('build-types/debug')
        release.setRoot('build-types/release')
    }
}

// get signing config from gradle.properties file if it exists
// See Andlytics Dropbox folder for example
if (project.hasProperty('storePassword')
        && project.hasProperty('keyAlias')
        && project.hasProperty('keyPassword')) {
    android.signingConfigs.release.storePassword = storePassword
    android.signingConfigs.release.keyAlias = keyAlias
    android.signingConfigs.release.keyPassword = keyPassword
}
