apply plugin: 'com.android.library'

android {
    compileSdkVersion 23
    buildToolsVersion "25.0.2"

    defaultConfig {
        minSdkVersion 9
        targetSdkVersion 23
        versionName project.VERSION_NAME
        versionCode Integer.parseInt(project.VERSION_CODE)
    }
}

dependencies {
    compile 'com.jakewharton:disklrucache:2.0.2'
    compile 'com.google.code.gson:gson:2.7'
    provided 'io.reactivex:rxandroid:1.2.1'
    provided 'io.reactivex:rxjava:1.1.6'
}

task makeJar(type: Copy, dependsOn: build) {
    from('build/intermediates/bundles/release/')
    into('build/libs/')
    include('classes.jar')
    rename('classes.jar', 'reservoir-' + project.VERSION_NAME + '-sources.jar')
}

task makeJavadocs(type: Javadoc) {
    source = android.sourceSets.main.java.srcDirs
    classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}
afterEvaluate {
    makeJavadocs.classpath += project.android.libraryVariants.toList().first().javaCompile.classpath
}

task makeJavadocsJar(type: Jar, dependsOn: makeJavadocs) {
    classifier = 'javadoc'
    from makeJavadocs.destinationDir
}

