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

def siteUrl = PROJ_WEBSITEURL
def gitUrl = PROJ_VCSURL

group = PROJ_GROUP
version = PROJ_VERSION

install {
    repositories.mavenInstaller {
        pom {
            project {
                packaging 'aar'
                name PROJ_DESCRIPTION
                url siteUrl

                licenses {
                    license {
                        name 'The Apache Software License, Version 2.0'
                        url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
                    }
                }

                developers {
                    developer {
                        id DEVELOPER_ID
                        name DEVELOPER_NAME
                        email DEVELOPER_EMAIL
                    }
                }

                scm {
                    connection gitUrl
                    developerConnection gitUrl
                    url siteUrl
                }
            }

        }
    }
}

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

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

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



artifacts {
//    archives androidJavadocsJar
    archives androidSourcesJar
}

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

bintray {
    user = properties.getProperty("bintray_user")
    key = properties.getProperty("bintray_apikey")

    System.out.println(user + "")
    System.out.println(key + "")

    configurations = ['archives']
    pkg {
        version {
            name = PROJ_VERSION
            desc = PROJ_DESCRIPTION
        }
        repo = 'android'
        name = PROJ_ARTI
        licenses = ['Apache-2.0']
        vcsUrl = gitUrl
        publish = true
    }
}