buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.12.2'
        classpath files('libs/gradle-witness.jar')
    }
}

apply plugin: 'com.android.application'
apply plugin: 'witness'

repositories {
    mavenCentral()
    maven {
        url "https://raw.github.com/whispersystems/maven/master/gcm-client/releases/"
    }
    maven {
        url "https://raw.github.com/whispersystems/maven/master/gson/releases/"
    }
    maven {
        url "https://raw.github.com/whispersystems/maven/master/smil/releases/"
    }
}

dependencies {
    compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'
    compile 'com.android.support:support-v4:20.0.0'
    compile 'se.emilsjolander:stickylistheaders:2.2.0'
    compile 'com.google.android.gms:play-services:5.0.89'
    compile 'com.astuetz:pagerslidingtabstrip:1.0.1'
    compile 'org.w3c:smil:1.0.0'

    androidTestCompile 'com.squareup:fest-android:1.0.8'

    compile project(':library')
}

dependencyVerification {
    verify = [
        'com.actionbarsherlock:actionbarsherlock:5ab04d74101f70024b222e3ff9c87bee151ec43331b4a2134b6cc08cf8565819',
        'com.android.support:support-v4:81f2b1c2c94efd5a4ec7fcd97b6cdcd00e87a933905c5c86103c7319eb024572',
        'se.emilsjolander:stickylistheaders:89146b46c96fea0e40200474a2625cda10fe94891e4128f53cdb42375091b9b6',
        'com.google.android.gms:play-services:38f326e525830f1d70f60f594ceafcbdf5b312287ddbecd338fd1ed7958a4b1e',
        'com.astuetz:pagerslidingtabstrip:f1641396732c7132a7abb837e482e5ee2b0ebb8d10813fc52bbaec2c15c184c2',
        'org.w3c:smil:085dc40f2bb249651578bfa07499fd08b16ad0886dbe2c4078586a408da62f9b',
        'com.google.protobuf:protobuf-java:ad9769a22989e688a46af4d3accc348cc501ced22118033230542bc916e33f0b',
        'com.madgag:sc-light-jdk15on:931f39d351429fb96c2f749e7ecb1a256a8ebbf5edca7995c9cc085b94d1841d',
        'com.googlecode.libphonenumber:libphonenumber:eba17eae81dd622ea89a00a3a8c025b2f25d342e0d9644c5b62e16f15687c3ab',
        'org.whispersystems:gson:08f4f7498455d1539c9233e5aac18e9b1805815ef29221572996508eb512fe51',
    ]
}

android {
    compileSdkVersion 19
    buildToolsVersion '19.1.0'

    defaultConfig {
        minSdkVersion 9
        targetSdkVersion 19
    }

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

    signingConfigs {
        release
    }
    buildTypes {
        release {
            signingConfig signingConfigs.release
        }
    }

     lintOptions {
        abortOnError false
    }
}

def Properties props = new Properties()
def propFile = new File('signing.properties')

if (propFile.canRead()){
    props.load(new FileInputStream(propFile))

    if (props !=null &&
        props.containsKey('STORE_FILE')     &&
        props.containsKey('STORE_PASSWORD') &&
        props.containsKey('KEY_ALIAS')      &&
        props.containsKey('KEY_PASSWORD'))
    {
        android.signingConfigs.release.storeFile = file(props['STORE_FILE'])
        android.signingConfigs.release.storePassword = props['STORE_PASSWORD']
        android.signingConfigs.release.keyAlias = props['KEY_ALIAS']
        android.signingConfigs.release.keyPassword = props['KEY_PASSWORD']
    } else {
        println 'signing.properties found but some entries are missing'
        android.buildTypes.release.signingConfig = null
    }
}else {
    println 'signing.properties not found'
    android.buildTypes.release.signingConfig = null
}