buildscript {
    repositories {
        mavenLocal()
        jcenter()
    }
    configurations.all {
        resolutionStrategy.cacheDynamicVersionsFor 0, 'seconds'
        resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
    }
    dependencies {
        classpath "com.taobao.android:atlasplugin:2.3.1.beta55"
        classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
        classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.6'
    }
}

apply plugin: 'com.android.library'
apply plugin: 'com.taobao.atlas'
apply plugin: 'maven-publish'


group = 'com.taobao.android'
version = '1.0.0'

tasks.withType(JavaCompile) {
    sourceCompatibility = 1.7
    targetCompatibility = 1.7
}

android {
    compileSdkVersion 24
    buildToolsVersion "25.0.2"
    lintOptions {
        checkReleaseBuilds false
        abortOnError false
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }

    defaultConfig {
        versionName version
    }
}

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

atlas.bundleConfig.awbBundle = true

def siteUrl = 'https://github.com/alibaba/atlas'
// 项目的主页
def gitUrl = 'https://github.com/alibaba/atlas'
// Git仓库的url
install {
    repositories.mavenInstaller {
        // This generates POM.xml with proper parameters
        pom {
            project {
                packaging 'awb'
                // Add your description here
                name 'firstbundle' //项目描述
                // 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 'alibabaatlas' //填写的一些基本信息
                        name project.name
                        email 'alibabaatlasframework@gmail.com'
                    }
                }
                scm {
                    connection gitUrl
                    developerConnection gitUrl
                    url siteUrl
                }
            }
        }
    }
}

Properties properties = new Properties()
def file = project.rootProject.file('local.properties')
if (file.exists()) {
    properties.load(file.newDataInputStream())
}
bintray {
    user = properties.getProperty("bintray.user")
    key = properties.getProperty("bintray.apikey")
//    configurations = ['archives']
    publications = ['maven']
    pkg {
        repo = "maven"
        name = project.name	//发布到JCenter上的项目名字
        websiteUrl = "atlas.alibaba.net"
        vcsUrl = gitUrl
        licenses = ["Apache-2.0"]
        publish = true
    }
}

task sourcesJar(type: Jar) {
    from('src/main/java') {
        include '**'
    }
    classifier = 'sources'
}

publishing {
    publications {
        maven(MavenPublication) {
            artifact "${project.buildDir}/outputs/awb/${project.name}-release.awb"
            artifact sourcesJar
        }
    }
}
