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

android {
    compileSdkVersion 25
    buildToolsVersion '27.0.3'

    defaultConfig {
        minSdkVersion 15
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        javaCompileOptions {
            annotationProcessorOptions {
                includeCompileClasspath true
            }
        }

        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:25.1.1'
    compile 'com.taobao.android:weex_sdk:0.16.0'
    compile 'com.squareup.picasso:picasso:2.5.2'
    provided 'org.weex.plugin:processor:1.0.2'
    testCompile 'junit:junit:4.12'
    compile 'cn.yipianfengye.android:zxing-library:2.2'
    compile('com.mylhyl:zxingscanner:2.1.0') {
        exclude group: 'com.google.zxing', module: 'core'
    }
}

def siteUrl = 'https://github.com/scholar-ink/weex-device'      // 项目的主页
def gitUrl = 'https://github.com/scholar-ink/weex-device.git'   // Git仓库的url
version = "0.0.1"       //这个是版本号，必须填写
group = "org.weex.plugin"                                        // 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 'device extend for weex'   //项目描述
                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 'zhouink'         //填写bintray或者github的用户名
                        name 'zhouchao'     //姓名
                        email 'zhouc1120@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") //账号和apiKey
    key = properties.getProperty("bintray.apikey")
    configurations = ['archives']
    pkg {
        repo = "maven" //仓库名，注意不是项目名
        name = "device"  //发布到JCenter上的项目名字
        websiteUrl = siteUrl
        vcsUrl = gitUrl
        licenses = ["Apache-2.0"]
        publish = true
    }
}
