apply plugin: 'android-library'
apply plugin: 'maven'
apply plugin: 'signing'

group = 'com.davemorrissey.labs'
archivesBaseName = 'subsampling-scale-image-view'
version = '3.3.0'

signing {
    required { has("release") && gradle.taskGraph.hasTask("uploadArchives") }
    sign configurations.archives
}

uploadArchives {
    configuration = configurations.archives
    repositories.mavenDeployer {
        beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }

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

        pom.project {
            name 'SubsamplingScaleImageView'
            packaging 'aar'
            description 'Custom image views for Android with pinch to zoom, panning, rotation and animation support, with easy extension so you can add your own overlays and touch event detection.'
            url 'https://github.com/davemorrissey/subsampling-scale-image-view'

            scm {
                url 'scm:git@github.com:davemorrissey/subsampling-scale-image-view.git'
                connection 'scm:git@github.com:davemorrissey/subsampling-scale-image-view.git'
                developerConnection 'scm:git@github.com:davemorrissey/subsampling-scale-image-view.git'
            }

            licenses {
                license {
                    name 'The Apache Software License, Version 2.0'
                    url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
                    distribution 'repo'
                }
            }

            developers {
                developer {
                    id 'davemorrissey'
                    name 'Dave Morrissey'
                }
            }
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')
    compile 'com.android.support:support-annotations:20.0.0'
}

android {
    compileSdkVersion 19
    buildToolsVersion "19.1.0"

    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            resources.srcDirs = ['src']
            aidl.srcDirs = ['src']
            renderscript.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
        }

        // Move the tests to tests/java, tests/res, etc...
        instrumentTest.setRoot('tests')

        // Move the build types to build-types/<type>
        // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
        // This moves them out of them default location under src/<type>/... which would
        // conflict with src/ being used by the main source set.
        // Adding new build types or product flavors should be accompanied
        // by a similar customization.
        debug.setRoot('build-types/debug')
        release.setRoot('build-types/release')
    }
}