apply plugin: 'com.android.application'

// For custom app signing config, set BookCatalogue.signing in local.properties to the
// path f a gradle file with the Android signing config. eg.
//
//    BookCatalogue.signing=O\:/Documents/BookCatalogue Dev/KeyStore/bcSigningConfig.gradle
//
def SigningProperty = "BookCatalogue.signing"
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
def BcSigning = properties.getProperty(SigningProperty)

if(BcSigning != null && (new File(BcSigning)).exists()) {
    apply from: BcSigning
}

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

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

dependencies {
    implementation 'com.android.support:support-v4:28.0.0'
    implementation 'com.android.support:appcompat-v7:28.0.0'
//    implementation "com.android.support:support-core-utils:28.0.3"
//    implementation "com.android.support:android.support.v7.app.ActionBar:28.0.0"
    // Compile all libraries from 'libs' folder
    implementation fileTree(include: '*.jar', dir: 'libs')
}

android {
//    signingConfigs {
//        Default {
//            storeFile file('O:\\Documents\\BookCatalogue Dev\\KeyStore\\bc_key_evan')
//            storePassword 'foobar'
//            keyAlias = 'bookcatalogue'
//            keyPassword 'foobar'
//        }
//    }
//
//    buildTypes {
//        release {
//            signingConfig signingConfigs.Default
//        }
//        debug {
//            signingConfig signingConfigs.Default
//        }
//    }
    compileSdkVersion 28
    buildToolsVersion '28.0.3'
    lintOptions {
        disable 'MissingTranslation'
    }

    dexOptions{
        javaMaxHeapSize "2g"
    }

    // !!! Commented to use values from the manifest
//    defaultConfig {
//        minSdkVersion 7
//        targetSdkVersion 16
//        versionCode 169
//    }
    packagingOptions {
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/LICENSE.txt'
    }
    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            resources.srcDirs = ['src']
            aidl.srcDirs = ['src']
            renderscript.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
        }
    }
    defaultConfig {
        minSdkVersion 21
        targetSdkVersion 28
    }

    flavorDimensions "distributor"
    productFlavors {
        distPlay {
            // Assigns this product flavor to the "distributor" flavor dimension.
            // This property is optional if you are using only one dimension.
            dimension "distributor"
//            applicationIdSuffix ".demo"
            versionNameSuffix "-distplay"
            buildConfigField 'boolean', 'IS_DONATE_ALLOWED', 'false'
        }
        distOther {
            dimension "distributor"
//            applicationIdSuffix ".full"
            versionNameSuffix "-distoth"
            buildConfigField 'boolean', 'IS_DONATE_ALLOWED', 'true'
        }
    }
    compileOptions {
        sourceCompatibility = 1.8
        targetCompatibility = 1.8
    }
}
