// Project properties
version = "5.1.2"
group='com.appnexus.opensdk'

// Android build
apply plugin: 'com.android.library'

android {
    compileSdkVersion 27
    defaultConfig {
        versionCode 54 // An integer value that represents the version of the code, relative to other versions. Increase for each release.
        versionName version
        consumerProguardFiles 'proguard-project.txt'
        minSdkVersion 9
        targetSdkVersion 27
    }

    sourceSets {
        main.manifest.srcFile 'AndroidManifest.xml'
        main.java.srcDir 'src'
        main.res.srcDir 'res'
        main.assets.srcDir 'assets'
        main.resources.srcDir 'src'
        test.java.srcDir 'test'
    }

    lintOptions {
        abortOnError false
    }
    testOptions {
        unitTests {
            includeAndroidResources = true
        }
    }
}

dependencies {
    api fileTree(include: '*.jar', dir: 'libs')
    testImplementation 'junit:junit:4.12'
    testImplementation 'org.assertj:assertj-core:1.7.0'
    testImplementation 'org.robolectric:robolectric:3.5.1'
    testImplementation 'com.squareup.okhttp:mockwebserver:2.5.0'
    testImplementation 'com.android.support:support-annotations:27.1.1'
    testImplementation 'org.robolectric:shadows-httpclient:3.5.1'
    testImplementation 'com.android.support:design:27.1.1'
}

repositories {
    jcenter()
    mavenCentral()
    maven{
        url "https://maven.google.com"
    }
}

ext {
    pom_name = "AppNexus Android SDK"
    pom_description = "AppNexus's Android Advertising Libraries"
    pom_url = "https://wiki.appnexus.com/display/sdk/Mobile+SDKs?src=search#MobileSDKs-Android"

    pom_scm_connection = "scm:git:git@github.com:appnexus/mobile-sdk-android.git"
    pom_scm_developerConnection = "scm:git:git@github.com:appnexus/mobile-sdk-android.git"
    pom_scm_url = "git@github.com:appnexus/mobile-sdk-android.git"

    pom_license_name = "The Apache License, Version 2.0"
    pom_license_url = "http://www.apache.org/licenses/LICENSE-2.0.txt"

    pom_developer_name = "AppNexus Mobile Team"
    pom_developer_email = "sdk@appnexus.com"
    pom_developer_organization = "AppNexus, Inc."
    pom_developer_organizationUrl = "http://www.appnexus.com"

    pom_groupId = "com.appnexus.opensdk"
    pom_artifactId = "appnexus-sdk"
    pom_packaging = "aar"

    pom_distribution_snapshotRepo_id = "ossrh"
    pom_distribution_snapshotRepo_url = "https://oss.sonatype.org/content/repositories/snapshots"
    pom_distribution_repo_id = "ossrh"
    pom_distribution_repo_url = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"

    username =project.hasProperty('nexusUsername') ? project.getProperties().get('nexusUsername') : "Replace your username here"
    password = project.hasProperty('nexusPassword') ? project.getProperties().get('nexusPassword') : "Replace your password here"
}



apply plugin: 'maven'
apply plugin: 'signing'

signing {
    sign configurations.archives
}


uploadArchives {
    configuration = configurations.archives
    repositories {
        mavenDeployer {
            beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
            repository(url: project.pom_distribution_repo_url) {
                authentication(userName: project.username, password: project.password)
            }
            snapshotRepository(url: project.pom_distribution_snapshotRepo_url) {
                authentication(userName: project.username, password: project.password)
            }
            pom.project {
                name project.pom_name
                packaging project.pom_packaging
                groupId project.pom_groupId
                artifactId project.pom_artifactId
                version project.version
                description project.pom_description
                url project.pom_url
                scm {
                    connection project.pom_scm_connection
                    developerConnection project.pom_scm_developerConnection
                    url project.pom_scm_url
                }
                licenses {
                    license {
                        name project.pom_license_name
                        url project.pom_license_url
                    }
                }
                developers {
                    developer {
                        name project.pom_developer_name
                        email project.pom_developer_email
                        organizationUrl project.pom_developer_organizationUrl
                    }
                }
            }
        }
    }
}




