apply plugin: 'com.android.library'
apply plugin: 'maven-publish'

apply from: rootProject.file('gradle-mvn-push.gradle')

android {
    compileSdkVersion 28

    defaultConfig {
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    lintOptions {
        disable 'GradleDependency', 'HandlerLeak'
    }
}

dependencies {

    implementation fileTree(dir: 'libs', include: ['*.jar'])

    implementation 'com.google.code.findbugs:jsr305:3.0.2' // api
    implementation 'com.squareup.okhttp3:okhttp:4.3.1' // impl

    implementation "com.amazonaws:aws-android-sdk-core:$aws_version" // api
    compileOnly "com.amazonaws:aws-android-sdk-cognitoidentityprovider:$aws_version"
    compileOnly "com.amazonaws:aws-android-sdk-s3:$aws_version"

    compileOnly 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.2.2'
    compileOnly 'org.eclipse.paho:org.eclipse.paho.android.service:1.1.1'

    compileOnly project(':aws-android-sdk-appsync-runtime')

    testImplementation 'junit:junit:4.13'
    testImplementation ('org.robolectric:robolectric:4.3.1') {
        // https://github.com/robolectric/robolectric/issues/5245
        exclude group: 'com.google.auto.service', module: 'auto-service'
    }
    testImplementation 'org.mockito:mockito-core:3.2.4'
    testImplementation "com.amazonaws:aws-android-sdk-cognitoidentityprovider:$aws_version"
    testImplementation project(':aws-android-sdk-appsync-runtime')
    testImplementation("com.squareup.okhttp3:mockwebserver:4.3.1")
    implementation ("com.amazonaws:aws-android-sdk-mobile-client:$aws_version@aar") { transitive = true }
    implementation ("com.amazonaws:aws-android-sdk-auth-userpools:$aws_version@aar") { transitive = true }

    implementation 'androidx.lifecycle:lifecycle-runtime:2.0.0'
}

project.afterEvaluate {
    publishing {
        publications {
            library(MavenPublication) {
                groupId 'com.amazonaws'
                artifactId 'aws-android-sdk-appsync'
                version VERSION_NAME + "-SNAPSHOT"
                artifact(bundleReleaseAar)
            }
        }
    }
}

