buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.3.0'
        classpath 'com.github.dcendents:android-maven-plugin:1.2'
        classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

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


version = "0.1.1"

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.0"
    resourcePrefix "PathEffectTextView"

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

def siteUrl = "https://github.com/dkmeteor/PathEffectTextView"
def gitUrl = "https://github.com/dkmeteor/PathEffectTextView.git"

//填写唯一包名
group = "com.dk.view.patheffect"

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

                //添加项目描述
                name 'Add path effect on text'
                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 'dkmeteor'
                        name 'Dean'
                        email '93440331@qq.com'
                    }
                }

                scm {
                    connection gitUrl
                    developerConnection gitUrl
                    url siteUrl
                }
            }
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
}

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相关信息
bintray {
    //读取Bintray帐号和密码。
    //一般的为了保密和安全性，在项目的local.properties文件中添加两行句话即可：
    //bintray.user=username
    //bintray.apikey=apikey
    user = properties.getProperty("bintray.user")
    key = properties.getProperty("bintray.apikey")

    configurations = ['archives']

    pkg {
        repo = "maven"//上传的中央仓库名称
        name = "PathEffectTextView"//上传的项目的名字
        websiteUrl = siteUrl
        vcsUrl = gitUrl
        licenses = ["Apache-2.0"]
        publish = true  //是否发布
    }
}