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

def GROUP_ID = 'com.didi.virtualapk'
def ARTIFACT_ID = 'core'


def siteUrl = 'https://github.com/didi/VirtualAPK' // 项目的主页
def gitUrl = 'https://github.com/didi/VirtualAPK' // Git仓库的url

group = GROUP_ID
archivesBaseName = 'core'

version = "0.9.8"


install {
    repositories.mavenInstaller {
        // This generates POM.xml with proper parameters
        pom {
            artifactId = ARTIFACT_ID

            project {
                packaging 'aar'
                // Add your description here
                name 'A powerful but lightweight plugin framework for Android' //项目描述
                url siteUrl
                // Set your license
                licenses {
                    license {
                        name 'Apache License 2.0'
                        url 'http://www.apache.org/licenses/LICENSE-2.0'
                    }
                }
                developers {
                    developer {
                        id 'singwhatiwanna'    //填写的一些基本信息
                        name 'DiDi'
                        email 'singwhatiwanna@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 = "${GROUP_ID}:${ARTIFACT_ID}"    //发布到JCenter上的项目名字
        websiteUrl = siteUrl
        vcsUrl = gitUrl
        licenses = ["Apache-2.0"]
        publish = true
    }

}