apply plugin: 'com.android.library'
apply from: rootProject.file('gradle/gradle-mvn-push.gradle')

android {
    compileSdkVersion rootProject.ext.compileSdkVersion

    testBuildType "profiling"

    defaultConfig {
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode Integer.parseInt(VERSION_CODE)
        versionName VERSION_NAME

        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

        externalNativeBuild {
            cmake {
                abiFilters 'armeabi-v7a', "arm64-v8a", "x86",  "x86_64"
                arguments '-DANDROID_STL=c++_shared'
            }
        }
    }
    externalNativeBuild {
        cmake {
            path "src/main/cpp/CMakeLists.txt"
        }
    }
    buildTypes {
        release {
            minifyEnabled true
            jniDebuggable false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            consumerProguardFiles 'proguard-customer.pro'
        }
        debug {
            jniDebuggable true
            debuggable true
        }
        profiling {
            initWith debug
            externalNativeBuild {
                cmake {
                    arguments "-DCMAKE_BUILD_TYPE=Release"//, '-DCMAKE_VERBOSE_MAKEFILE=1'
                }
            }
        }
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }

    resourcePrefix "wocr_"
}

dependencies {
    androidTestImplementation "com.android.support.test.espresso:espresso-core:$rootProject.ext.espressoVersion"
    implementation "com.android.support:appcompat-v7:$rootProject.ext.supportLibVersion"
    implementation "com.facebook.device.yearclass:yearclass:$rootProject.ext.yearclassVersion"

    testImplementation "junit:junit:$rootProject.ext.junitVersion"
}

afterEvaluate { project ->
    android.libraryVariants.all { variant ->
        tasks.androidJavadocs.doFirst {
            include '**/cards/pay/paycardsrecognizer/sdk/*.java'
            options.encoding = "utf-8"
            options.charSet = "utf-8"
            options.showFromPublic()
            failOnError false
        }
    }
}