plugins {
    id "com.auth0.gradle.oss-library.android" version "0.18.0"
}

logger.lifecycle("Using version ${version} for ${name}")

def signingKey = findProperty('signingKey')
def signingKeyPwd = findProperty('signingPassword')

oss {
    name 'Lock.Android'
    repository 'Lock.Android'
    organization 'auth0'
    description 'The easiest way of securing your Android mobile apps with Auth0 & Lock'
    skipAssertSigningConfiguration true

    developers {
        auth0 {
            displayName = 'Auth0'
            email = 'oss@auth0.com'
        }
        lbalmaceda {
            displayName = 'Luciano Balmaceda'
            email = 'luciano.balmaceda@auth0.com'
        }
    }
}

signing {
    useInMemoryPgpKeys(signingKey, signingKeyPwd)
}

android {
    compileSdkVersion 31

    defaultConfig {
        minSdkVersion 21
        targetSdkVersion 31
        versionCode 1
        versionName project.version
        consumerProguardFiles '../proguard/proguard-gson.pro', '../proguard/proguard-otto.pro', '../proguard/proguard-lock-2.pro'
        // Required since Android Gradle Plugin 4.1 - https://issuetracker.google.com/issues/154275579
        buildConfigField "String", "VERSION_NAME", "\"$versionName\""
    }

    lintOptions {
        disable 'ContentDescription', 'SyntheticAccessor'
        abortOnError true
    }

    testOptions {
        unitTests {
            includeAndroidResources = true
            // https://github.com/robolectric/robolectric/issues/5115
            all {
                systemProperty("javax.net.ssl.trustStoreType", "JKS")
                maxHeapSize = "1024m"
            }
        }
    }

    compileOptions {
        sourceCompatibility 1.8
        targetCompatibility 1.8
    }
}

dependencies {
    implementation 'androidx.appcompat:appcompat:1.3.1'
    implementation 'androidx.recyclerview:recyclerview:1.2.1'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'com.google.android.material:material:1.4.0'
    implementation 'com.google.code.gson:gson:2.8.9'
    implementation 'com.squareup:otto:1.3.8'
    api 'com.auth0.android:auth0:2.10.2'
    testImplementation 'junit:junit:4.13.2'
    testImplementation 'org.hamcrest:hamcrest-library:2.2'
    testImplementation 'org.robolectric:robolectric:4.4'
    testImplementation 'org.mockito:mockito-core:3.7.7'
    testImplementation 'com.squareup.okhttp3:okhttp:4.12.0'
    testImplementation 'com.squareup.okhttp3:mockwebserver:4.12.0'
    testImplementation 'com.squareup.okhttp3:okhttp-tls:4.12.0'
    testImplementation 'com.jayway.awaitility:awaitility:1.7.0'
    testImplementation 'androidx.test.espresso:espresso-intents:3.4.0'
}
