apply from: rootProject.file('publishing.gradle')
apply plugin: 'com.android.library'
apply plugin: 'devicefarm'

android {
    compileSdkVersion 29

    defaultConfig {
        minSdkVersion 14 // FB, Google, UI, UserPools all need 14, Hosted UI needs 16
        targetSdkVersion 29
        testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
    }

    compileOptions {
        sourceCompatibility 1.8
        targetCompatibility 1.8
    }
}

devicefarm {
    // Required. The Project must already exist. You can create a project in the AWS console.
    projectName 'mobile-client'

    // Required. You must specify either accessKey and secretKey OR roleArn. roleArn takes precedence.
    authentication {
        accessKey "$System.env.DEVICEFARM_ACCESS_KEY"
        secretKey "$System.env.DEVICEFARM_SECRET_KEY"
    }
}

dependencies {
    /*
     * These should ideally depend on the project version,
     * but need to convert everything to Android libraries
     */
    api(project(':aws-android-sdk-auth-core')) {
        exclude group: 'com.google.android', module: 'android'
    }
    api(project(':aws-android-sdk-cognitoidentityprovider')) {
        exclude group: 'com.google.android', module: 'android'
    }
    implementation 'androidx.core:core:1.3.1'

    // Optional dependencies
    compileOnly project(':aws-android-sdk-auth-ui')
    compileOnly project(':aws-android-sdk-auth-facebook')
    compileOnly project(':aws-android-sdk-auth-google')
    compileOnly project(':aws-android-sdk-auth-userpools')
    compileOnly project(':aws-android-sdk-cognitoauth')
    compileOnly 'androidx.browser:browser:1.3.0'

    testImplementation 'junit:junit:4.13.2'
    testImplementation 'org.mockito:mockito-core:3.2.4'
    testImplementation 'org.robolectric:robolectric:4.4'
    testImplementation 'androidx.test:core:1.3.0'
    testImplementation project(':aws-android-sdk-cognitoauth')

    androidTestImplementation 'androidx.appcompat:appcompat:1.2.0'
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test:rules:1.3.0'
    androidTestImplementation 'androidx.test:runner:1.3.0'

    androidTestImplementation (project(':aws-android-sdk-auth-facebook')) {
        exclude group: 'com.google.android', module: 'android'
    }
    androidTestImplementation (project(':aws-android-sdk-auth-google')) {
        exclude group: 'com.google.android', module: 'android'
    }
    androidTestImplementation (project(':aws-android-sdk-auth-userpools')) {
        exclude group: 'com.google.android', module: 'android'
    }
    androidTestImplementation (project(':aws-android-sdk-cognitoauth')) {
        exclude group: 'com.google.android', module: 'android'
    }
    androidTestImplementation(project(':aws-android-sdk-auth-userpools')) {
        exclude group: 'com.google.android', module: 'android'
    }
    androidTestImplementation project(':aws-android-sdk-testutils')
}

