apply plugin: 'com.android.library'
apply plugin: 'maven'
apply plugin: 'signing'

archivesBaseName = 'marqueeview'
group = 'asia.ivity.android'

dependencies {
/*    compile 'com.google.android.gms:play-services:3.1.36+'*/
}

android {
	compileSdkVersion 19
	buildToolsVersion "21.1.2"
}

// TODO: Add a task that prints the test results.
task instrumentTest(dependsOn: connectedCheck)

signing {
    sign configurations.archives
}

if(hasProperty("sonatypeUsername") && hasProperty("sonatypePassword")) {
    uploadArchives {
        repositories {
            mavenDeployer {
                beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }

                repository(url: 'https://oss.sonatype.org/service/local/staging/deploy/maven2') {
                    authentication(userName: sonatypeUsername, password: sonatypePassword)
                }
                snapshotRepository(url: 'https://oss.sonatype.org/content/repositories/snapshots/') {
                    authentication(userName: sonatypeUsername, password: sonatypePassword)
                }

                modifyPom(addFilter('aar') { artifact, file ->
                    artifact.name == 'marqueeview'
                })
            }
        }
    }
}

def modifyPom(pom) {
    pom.project {
        name 'MarqueeView'
        description 'Extensive library for customized marquee effect.'
        url 'https://github.com/ened/Android-MarqueeView'

        scm {
            url 'https://github.com/ened/Android-MarqueeView.git'
            connection 'git@github.com:ened/Android-MarqueeView.git'
            developerConnection 'git@github.com:ened/Android-MarqueeView.git'
        }

        licenses {
            license {
                name 'BSD License'
                url 'http://opensource.org/licenses/bsd-license.php'
                distribution 'repo'
            }
        }

        organization {
            name 'Ivity Asia'
            url 'http://www.ivity.asia'
        }

        developers {
            developer {
                id 'ened'
                name 'Sebastian Roth'
                url 'http://www.sebroth.com'
            }
        }
    }
}
