apply plugin: 'com.android.library'

def PUBLISH_VERSION = '1.5.3'

android {
    compileSdkVersion 28
    buildToolsVersion BUILD_TOOLS_VERSION
    resourcePrefix 'com_uriio_'

    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 28
        versionName PUBLISH_VERSION
    }

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

            task('generateReleaseJavadoc', type: Javadoc) {
                title "Android Beacons $PUBLISH_VERSION documentation"
                description 'Library documentation generator task'
                failOnError true
                source sourceSets.main.java.srcDirs
                classpath += files("$projectDir/build/generated/source/buildConfig/release")
                options {
                    bootClasspath android.bootClasspath[0]
                    links 'https://docs.oracle.com/javase/8/docs/api', 'https://developer.android.com/reference'
                    linksOffline 'https://developer.android.com/reference/', "${android.sdkDirectory}/docs/reference"
                }
            }

            afterEvaluate {
                libraryVariants.all { variant ->
                    if ('release' == variant.name) {
                        generateReleaseJavadoc.classpath += files(variant.javaCompiler.classpath)
                    }
                }
            }
        }
    }
}

dependencies {
    implementation 'com.android.support:support-core-utils:28.0.0'

    // https://github.com/WhisperSystems/curve25519-java
    implementation 'org.whispersystems:curve25519-android:0.5.0'

    testImplementation 'junit:junit:4.12'
}

if (project.hasProperty('ossrhUsername')) apply from: 'deploy.gradle'
