apply plugin: 'signing'

java {
    withJavadocJar()
    withSourcesJar()
}

publishing {
    publications {
        maven(MavenPublication) {
            pom {
                name = 'VTM'
                description = 'OpenGL vector map library - running on Android, iOS, Desktop and browser.'
                url = 'https://github.com/mapsforge/vtm'
                licenses {
                    license {
                        name = 'GNU Lesser GPL'
                        url = 'https://www.gnu.org/licenses/lgpl.html'
                    }
                }
                developers {
                    developer {
                        id = 'hannes.janetzek'
                        name = 'Hannes Janetzek'
                        email = 'hannes.janetzek@gmail.com'
                    }
                    developer {
                        id = 'devemux86'
                        name = 'Emux'
                        email = 'devemux86@gmail.com'
                    }
                }
                scm {
                    connection = 'scm:git:https://github.com/mapsforge/vtm'
                    developerConnection = 'scm:git:https://github.com/mapsforge/vtm'
                    url = 'https://github.com/mapsforge/vtm'
                }
            }
        }
    }
    repositories {
        maven {
            def releasesRepoUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2/'
            def snapshotsRepoUrl = 'https://oss.sonatype.org/content/repositories/snapshots/'
            url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
            credentials {
                username = SONATYPE_USERNAME
                password = SONATYPE_PASSWORD
            }
        }
    }
}

signing {
    required { !version.endsWith('SNAPSHOT') }
    sign publishing.publications.maven
}

javadoc {
    if (JavaVersion.current().isJava9Compatible()) {
        options.addBooleanOption('html5', true)
    }
}