buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
        mavenCentral()
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.18.0'
        classpath 'com.jakewharton.hugo:hugo-plugin:1.2.1'
    }
}

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'com.jakewharton.hugo'
apply plugin: 'com.github.triplet.play'

repositories {
    maven { url 'https://maven.fabric.io/public' }
    maven { url "https://jitpack.io" }
}

// For pushing APKs directly to Google Play. Won't work without the .p12 key.
play {
    serviceAccountEmail = '992499570703-v2bp8sl246qm0tblmfv4s45v6njhdfr2@developer.gserviceaccount.com'
    pk12File = file('../privatekeys/play-developer-key.p12')
    track = 'beta'
}

android {
    signingConfigs {
        debug {
            keyAlias 'phonograph-debug'
            keyPassword 'debugkey'
            storeFile file('../phonograph.keystore')
            storePassword 'kabouzeid'
        }
        release {
            keyAlias 'phonograph'
            storeFile file('../phonograph.keystore')
            storePassword 'kabouzeid'

            // "keystore.properties" file containing the release keys password is needed in order to sign the apk for release
            File propFile = project.rootProject.file('privatekeys/keystore.properties')
            if (propFile.exists()) {
                Properties properties = new Properties()
                properties.load(propFile.newDataInputStream())

                keyPassword properties.getProperty('keyPassword')
            } else {
                println 'keystore.properties not found'
                keyPassword null
            }
        }
    }
    compileSdkVersion 23
    buildToolsVersion '23.0.1'
    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 23

        renderscriptTargetApi 23
        renderscriptSupportModeEnabled true

        applicationId "com.kabouzeid.gramophone"
        versionCode 78
        versionName "0.9.46 beta 5"
    }
    buildTypes {
        release {
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.release
        }
        debug {
            signingConfig signingConfigs.debug
        }
    }
    lintOptions {
        disable 'MissingTranslation'
        disable 'InvalidPackage'
        abortOnError false
        // remove as soon as it has been fixed
        disable 'PrivateResource'
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile('com.crashlytics.sdk.android:crashlytics:2.5.1@aar') {
        transitive = true;
    }
    compile 'com.android.support:support-v4:23.0.1'
    compile 'com.android.support:support-v13:23.0.1'
    compile 'com.android.support:appcompat-v7:23.0.1'
    compile 'com.android.support:recyclerview-v7:23.0.1'
    compile 'com.android.support:gridlayout-v7:23.0.1'
    compile 'com.android.support:cardview-v7:23.0.1'
    compile 'com.android.support:palette-v7:23.0.1'
    compile 'com.android.support:design:23.0.1'
    compile 'com.android.support:support-annotations:23.0.1'

    compile 'com.github.ksoichiro:android-observablescrollview:1.5.2'
    compile 'asia.ivity.android:drag-sort-listview:1.0'
    compile 'com.github.semoncat.seekarc:library:0.1'
    compile 'com.sothree.slidinguppanel:library:3.1.1'

    compile 'com.squareup.retrofit:retrofit:1.9.0'
    compile 'com.squareup.okhttp:okhttp:2.4.0'

    compile 'com.github.kabouzeid:Android-Universal-Image-Loader:8ffb5d4afa'

    compile 'com.afollestad:material-dialogs:0.8.0.0'
    compile 'com.afollestad:material-cab:0.1.5'

    compile 'com.jakewharton:butterknife:7.0.1'

    compile 'com.anjlab.android.iab.v3:library:1.0.26'

    debugCompile 'com.squareup.leakcanary:leakcanary-android:1.3.1'
    releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3.1'
}
