/*
 * Configuration of deployment to Maven repositories.
 */

def noJavaDoc = name.endsWith('tests') || name.contains('testlanguage')
publishing {
    publications {
        LocalMavenRepo(MavenPublication) {
            from components.java
            artifact sourcesJar
            if (!noJavaDoc) {
                artifact javadocJar
            }
            pom {
                url = 'https://www.eclipse.org/Xtext/'
                licenses {
                    license {
                        name = 'Eclipse Public License, Version 2.0'
                        url = 'http://www.eclipse.org/legal/epl-2.0'
                    }
                }
                scm {
                    connection = "scm:git:https://github.com/eclipse/${rootProject.name}.git"
                    developerConnection = "scm:git:https://github.com/eclipse/${rootProject.name}.git"
                    url = "git@github.com:eclipse/${rootProject.name}.git"
                }
                // We need to wait until the project's own build file has been executed
                // so we can use the title and description settings for setting up Maven publishing.
                afterEvaluate {
                    if (project.hasProperty('title')) {
                        name = project.title
                        description = project.description
                    }
                }
            }
            apply from: "${rootDir}/gradle/developers.gradle", to: pom
        }

    }
    repositories {
        maven {
            url = "$rootProject.buildDir/maven-repository"
        }
    }
}
