// apply the plugin with its class name rather than its Id to work around gradle limitation of
// not being able to find the plugin by Id despite the dependencies being added right above. Gradle
// is currently not capable of loading plugins by Id if the dependency is anywhere else than
// in the main project build.gradle. This file is "imported" into the project's build.gradle
// through a "apply from:".
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray'

version = "1.0.0"
def siteUrl = 'https://github.com/freedomofme/ScrollingImageView'  // 项目的主页
def gitUrl = 'https://github.com/freedomofme/ScrollingImageView.git'   // Git仓库的url
def issueURL = 'https://github.com/freedomofme/ScrollingImageView/issues'

group = "site.okhttp.codeyel"            // Maven Group ID for the artifact，一般填你唯一的包名
install {
    repositories.mavenInstaller {
        // This generates POM.xml with proper parameters
        pom {
            project {
                packaging 'aar'
                // Add your description here
                name 'ScrollingImageView scrolls as the recyclerView slides'     //项目的描述 你可以多写一点
                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 'coderyel'
                        name 'codeyel'
                        email 'xiegeixiong@gmail.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(android.getBootClasspath().join(File.pathSeparator))
}
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 = "ScrollingImageView"    //发布到JCenter上的项目名字
        websiteUrl = siteUrl
        vcsUrl = gitUrl
        issueTrackerUrl = issueURL
        licenses = ["Apache-2.0"]
        publish = true
    }
}
tasks.withType(Javadoc) {
    options.addStringOption('Xdoclint:none', '-quiet')
    options.addStringOption('encoding', 'UTF-8')
    options.addStringOption('charSet', 'UTF-8')
}