apply plugin: 'groovy'
apply plugin: 'com.bmuschko.nexus'
apply plugin: 'com.jfrog.bintray'

targetCompatibility = JavaVersion.VERSION_1_7
sourceCompatibility = JavaVersion.VERSION_1_7

dependencies {
    compile gradleApi()
    compile localGroovy()
    compile 'com.android.tools.build:gradle:1.3.1'
    compile 'org.aspectj:aspectjtools:1.8.8'
    compile 'org.aspectj:aspectjrt:1.8.8'
}

group = GROUP
version = VERSION_NAME

modifyPom {
    project {
        name "Dagger2Metrics Plugin"
        description POM_DESCRIPTION
        url POM_URL
        artifactId "dagger2metrics-plugin"
        groupId GROUP

        scm {
            url POM_SCM_URL
            connection POM_SCM_CONNECTION
            developerConnection POM_SCM_DEV_CONNECTION
        }

        licenses {
            license {
                name POM_LICENCE_NAME
                url POM_LICENCE_URL
                distribution POM_LICENCE_DIST
            }
        }

        developers {
            developer {
                id POM_DEVELOPER_ID
                name POM_DEVELOPER_NAME
                email POM_DEVELOPER_EMAIL
            }
        }
    }
}

extraArchive {
    sources = true
    tests = true
    javadoc = true
}

// Bintray
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 = 'dagger2metrics-plugin'
        desc = POM_DESCRIPTION
        websiteUrl = POM_URL
        vcsUrl = GIT_URL
        licenses = ["Apache-2.0"]
        publish = true
        publicDownloadNumbers = true
        version {
            desc = POM_DESCRIPTION
            gpg {
                sign = true
                passphrase = properties.getProperty("bintray.gpg.password")
            }
        }
    }
}