// 根节点添加
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray'
// 根节点添加
version = "0.6"

def gitUrl = 'https://github.com/hnlbxb2004/ZxingSupport.git' // project git
def siteUrl = 'https://github.com/hnlbxb2004/ZxingSupport' // project git
group = "com.github.hnlbxb2004"


// 根节点添加
install {
    repositories.mavenInstaller {
        // This generates POM.xml with proper parameters
        pom {
            project {
                packaging 'aar'
                name 'Zxing support For Android'
                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 'hnlbxb2004'
                        name 'xubing'
                        email 'hnlbxb2004@163.com'
                    }
                }
                scm {
                    connection gitUrl
                    developerConnection gitUrl
                    url siteUrl
                }
            }
        }
    }
}

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


task javadoc(type: Javadoc) {
    source = android.sourceSets.main.java.srcDirs
    classpath += project.files(configurations.compile.files,android.getBootClasspath().join(File.pathSeparator))
    failOnError false
}

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


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

artifacts {
    archives javadocJar
    archives sourcesJar
}

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 = "zxing-support"                // project name in jcenter
        websiteUrl = siteUrl
        vcsUrl = gitUrl
        licenses = ["Apache-2.0"]
        publish = true
    }
}