apply plugin: 'com.android.library'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'com.github.dcendents.android-maven'

group = 'com.ajts.androidmads.SQLite2Excel'
version = '1.0.4'

android {
    compileSdkVersion 26
    buildToolsVersion '26.0.3'

    defaultConfig {
        minSdkVersion 15
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile 'org.apache.poi:poi:3.16'
}

def siteUrl = 'https://github.com/androidmads/SQLite2XL'      // Homepage URL of the library
def gitUrl = 'https://github.com/androidmads/SQLite2XL.git'   // Git URL

Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())

bintray {
    user = properties.getProperty("bintray.user")
    key = properties.getProperty("bintray.apikey")
    configurations = ['archives']
    pkg {
        repo = 'maven'
        name = 'com.ajts.androidmads.SQLite2Excel'

        version {
            name = '1.0.4'
            desc = 'Library to Convert SQlite Data to Excel'
            released = new Date()
            vcsTag = '1.0.4'
        }

        licenses = ['Apache-2.0']
        vcsUrl = gitUrl
        websiteUrl = siteUrl
    }
}

install {
    repositories.mavenInstaller {
        // This generates POM.xml with proper parameters
        pom {
            project {
                packaging 'aar'

                // Add your description here
                name 'Library to Convert SQlite Data to Excel'
                url siteUrl

                // Set your license
                licenses {
                    license {
                        name 'The Apache Software License, Version 2.0'
                        url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
                    }
                }
                developers {
                    developer {
                        id properties.getProperty("library.id")
                        name properties.getProperty("library.name")
                        email properties.getProperty("library.mail")
                    }
                }
                scm {
                    connection gitUrl
                    developerConnection gitUrl
                    url siteUrl
                }
            }
        }
    }
}

task generateSourcesJar(type: Jar) {
    from android.sourceSets.main.java.srcDirs
    classifier 'sources'
}

task generateJavadocs(type: Javadoc) {
    source = android.sourceSets.main.java.srcDirs
    classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}

task generateJavadocsJar(type: Jar) {
    from generateJavadocs.destinationDir
    classifier 'javadoc'
}

artifacts {
    archives generateSourcesJar
    archives generateJavadocsJar
}