apply plugin: 'maven'

Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())

def nexusReleases = properties.getProperty("nexus.releases")
def nexusSnapshots = properties.getProperty("nexus.snapshots")
def nexusUserName = properties.getProperty("nexus.username")
def nexusPassword = properties.getProperty("nexus.password")

version=LIB_VERSION
def nexusRepositoryUrl=nexusReleases

if (!LIB_IS_RELEASE.toBoolean()){
    version = "${version}-SNAPSHOT"
    nexusRepositoryUrl=nexusSnapshots
}

uploadArchives {
    repositories {
        mavenDeployer {
            repository(url: "$nexusRepositoryUrl") {
                authentication(userName: nexusUserName, password: nexusPassword)
            }

            pom.project {
                name LIB_ARTIFACT
                groupId LIB_GROUP
                artifactId LIB_ARTIFACT
                version version
                packaging 'aar'
                description LIB_DES
                licenses {
                    license {
                        name LICENCE_NAME
                        url LICENCE_URL
                        distribution LICENCE_DIST
                    }
                }
                developers {
                    developer {
                        id DEVELOPER_ID
                        name DEVELOPER_NAME
                        email DEVELOPER_EMAIL
                    }
                }
            }
        }
    }
}