diff --git a/Jenkinsfile b/Jenkinsfile index c2930c3c2..1c4718724 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -4,6 +4,6 @@ node { checkout scm stage 'Build' - sh "./gradlew build" + sh "./gradlew build uploadArchives" archive '**/build/**/*.jar' } \ No newline at end of file diff --git a/build.gradle b/build.gradle index 7b5ed9861..6157163ea 100644 --- a/build.gradle +++ b/build.gradle @@ -12,6 +12,7 @@ subprojects { apply from: "${rootDir}/gradle/versions.gradle" apply from: "${rootDir}/gradle/eclipse-project-layout.gradle" apply from: "${rootDir}/gradle/java-compiler-settings.gradle" + apply from: "${rootDir}/gradle/maven-deployment.gradle" group = 'org.eclipse.xtext' } diff --git a/gradle/developers.gradle b/gradle/developers.gradle new file mode 100644 index 000000000..4ca4b86bd --- /dev/null +++ b/gradle/developers.gradle @@ -0,0 +1,76 @@ +uploadArchives.repositories.mavenDeployer.pom.project { + developers { + developer { + name 'Sven Efftinge' + email 'sven.efftinge@typefox.io' + organization 'TypeFox' + organizationUrl 'http://typefox.io' + } + developer { + name 'Sebastian Benz' + } + developer { + name 'Lorenzo Bettini' + } + developer { + name 'Michael Clay' + } + developer { + name 'Christian Dietrich' + email 'christian.dietrich@itemis.de' + organization 'itemis' + organizationUrl 'http://www.itemis.com' + } + developer { + name 'Moritz Eysholdt' + email 'moritz.eysholdt@typefox.io' + organization 'TypeFox' + organizationUrl 'http://typefox.io' + } + developer { + name 'Dennis Hübner' + email 'dennis.huebner@typefox.io' + organization 'TypeFox' + organizationUrl 'http://typefox.io' + } + developer { + name 'Jan Köhnlein' + email 'jan.koehnlein@typefox.io' + organization 'TypeFox' + organizationUrl 'http://typefox.io' + } + developer { + name 'Anton Kosyakov' + email 'anton.kosyakov@typefox.io' + organization 'TypeFox' + organizationUrl 'http://typefox.io' + } + developer { + name 'Stefan Oehme' + } + developer { + name 'Holger Schill' + email 'holger.schill@itemis.de' + organization 'itemis' + organizationUrl 'http://www.itemis.com' + } + developer { + name 'Christian Schneider' + email 'christian.schneider@typefox.io' + organization 'TypeFox' + organizationUrl 'http://typefox.io' + } + developer { + name 'Miro Spönemann' + email 'miro.spoenemann@typefox.io' + organization 'TypeFox' + organizationUrl 'http://typefox.io' + } + developer { + name 'Knut Wannheden' + } + developer { + name 'Sebastian Zarnekow' + } + } +} diff --git a/gradle/java-compiler-settings.gradle b/gradle/java-compiler-settings.gradle index dfe9f217f..0f2146516 100644 --- a/gradle/java-compiler-settings.gradle +++ b/gradle/java-compiler-settings.gradle @@ -6,6 +6,12 @@ tasks.withType(JavaCompile) { options.encoding = 'ISO-8859-1' } +tasks.withType(Javadoc) { + options.encoding = 'ISO-8859-1' + options.tags = [ 'noreference', 'noextend', 'noimplement', 'noinstantiate', 'nooverride', 'model', 'generated', 'ordered' ] + options.addStringOption('Xdoclint:none', '-quiet') +} + configurations { optional { description 'Dependencies required at build time, but not exported into meta data' @@ -25,4 +31,3 @@ configurations { sourceSets.main.compileClasspath += configurations.optional eclipse.classpath.plusConfigurations += [configurations.optional] javadoc.classpath += configurations.optional -javadoc.options.addStringOption('-Xdoclint:none') \ No newline at end of file diff --git a/gradle/maven-deployment.gradle b/gradle/maven-deployment.gradle new file mode 100644 index 000000000..962633124 --- /dev/null +++ b/gradle/maven-deployment.gradle @@ -0,0 +1,79 @@ +apply plugin: 'signing' + +task sourcesJar(type: Jar, dependsOn: classes) { + classifier = 'sources' + from sourceSets.main.allSource + from ('.') { + include 'schema/**', 'model/**' + } + metaInf { + from 'META-INF' + } +} + +task javadocJar(type: Jar, dependsOn: javadoc) { + classifier = 'javadoc' + from javadoc.destinationDir +} + +artifacts { + archives sourcesJar, javadocJar +} + +def envSecretKeyRingFile = System.getenv('SIGNING_KEY_RING') +if (envSecretKeyRingFile != null) + ext.'signing.secretKeyRingFile' = envSecretKeyRingFile +def envKeyId = System.getenv('SIGNING_KEY_ID') +if (envKeyId != null) + ext.'signing.keyId' = envKeyId +def envPassword = System.getenv('SIGNING_PASSWORD') +if (envPassword != null) + ext.'signing.password' = envPassword + +signing { + required { gradle.taskGraph.hasTask('uploadArchives') } + sign configurations.archives +} +if (!project.hasProperty('signing.secretKeyRingFile') || !project.property('signing.secretKeyRingFile') + || !project.hasProperty('signing.keyId') || !project.property('signing.keyId') + || !project.hasProperty('signing.password') || !project.property('signing.password')) { + signArchives.enabled = false +} + +def envSonatypeUser = System.getenv('SONATYPE_USER') +if (envSonatypeUser != null) + ext.'sonatypeUserName' = envSonatypeUser +def envSonatypePassword = System.getenv('SONATYPE_PASSWORD') +if (envSonatypePassword != null) + ext.'sonatypePassword' = envSonatypePassword + +uploadArchives.repositories.mavenDeployer { + beforeDeployment { deployment -> signing.signPom(deployment) } + repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") { + if (project.hasProperty('sonatypeUserName') && project.hasProperty('sonatypePassword')) { + authentication(userName: sonatypeUserName, password: sonatypePassword) + } + } + snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") { + if (project.hasProperty('sonatypeUserName') && project.hasProperty('sonatypePassword')) { + authentication(userName: sonatypeUserName, password: sonatypePassword) + } + } + pom.project { + packaging 'jar' + url 'https://www.eclipse.org/Xtext/' + licenses { + license { + name 'Eclipse Public License, Version 1.0' + url 'http://www.eclipse.org/legal/epl-v10.html' + } + } + scm { + connection 'scm:git:git@github.com:eclipse/xtext-core.git' + developerConnection 'scm:git:git@github.com:eclipse/xtext-core.git' + url 'git@github.com:eclipse/xtext-core.git' + } + } +} + +apply from: "${rootDir}/gradle/developers.gradle"