Fix build scripts and prepare Maven publishing

This commit is contained in:
Alexander Söderberg 2020-10-01 15:41:47 +02:00
parent 9d47a7c82d
commit a43c3e9145
No known key found for this signature in database
GPG key ID: C0207FF7EA146678
3 changed files with 59 additions and 23 deletions

View file

@ -14,6 +14,7 @@ plugins {
id 'com.github.hierynomus.license' version '0.15.0' id 'com.github.hierynomus.license' version '0.15.0'
id 'java-library' id 'java-library'
id 'com.github.johnrengelman.shadow' version '6.0.0' id 'com.github.johnrengelman.shadow' version '6.0.0'
id 'maven-publish'
} }
checkstyle { checkstyle {
@ -28,6 +29,7 @@ allprojects {
group = 'cloud.commandframework' group = 'cloud.commandframework'
version = '0.3.0-SNAPSHOT' version = '0.3.0-SNAPSHOT'
description = 'Command framework and dispatcher for the JVM'
/* Disable checkstyle on tests */ /* Disable checkstyle on tests */
project.gradle.startParameter.excludedTaskNames.add('checkstyleTest') project.gradle.startParameter.excludedTaskNames.add('checkstyleTest')
@ -49,11 +51,22 @@ subprojects {
apply plugin: 'java' apply plugin: 'java'
apply plugin: 'java-library' apply plugin: 'java-library'
apply plugin: 'maven-publish' apply plugin: 'maven-publish'
apply plugin: 'signing'
test { test {
useJUnitPlatform() useJUnitPlatform()
} }
task publishingSourcesJar(type: Jar) {
from sourceSets.main.allJava
archiveClassifier.set('sources')
}
task publishingJavadocJar(type: Jar) {
from javadoc
archiveClassifier.set('javadoc')
}
repositories { repositories {
mavenLocal() mavenLocal()
mavenCentral() mavenCentral()
@ -101,6 +114,7 @@ subprojects {
dependencies { dependencies {
compileOnly 'org.checkerframework:checker-qual:3.5.0' compileOnly 'org.checkerframework:checker-qual:3.5.0'
api 'io.leangen.geantyref:geantyref:0.3.4'
testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.7.0' testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.7.0'
} }
@ -109,23 +123,54 @@ subprojects {
tasks.withType(JavaCompile) { tasks.withType(JavaCompile) {
options.encoding = 'UTF-8' options.encoding = 'UTF-8'
} }
}
task aggregatedJavadocs(type: Javadoc, description: "Generate javadocs from all child projects as if it was a single project", group: "Documentation") { publishing {
destinationDir = file("./docs/javadoc") publications {
title = "$project.name $version API" maven(MavenPublication) {
options.author true from components.java
options.links "http://docs.spring.io/spring/docs/4.3.x/javadoc-api/", "http://docs.oracle.com/javase/8/docs/api/", "http://docs.spring.io/spring-ws/docs/2.3.0.RELEASE/api/", "http://docs.spring.io/spring-security/site/docs/4.0.4.RELEASE/apidocs/"
options.addStringOption("Xdoclint:none", "-quiet")
delete("./docs") artifact publishingJavadocJar
artifact publishingSourcesJar
subprojects.each { proj -> pom {
proj.tasks.withType(Javadoc).each { javadocTask -> name = project.name
source += javadocTask.source url = 'https://github.com/Sauilitired/cloud'
classpath += javadocTask.classpath description = project.description
excludes += javadocTask.excludes
includes += javadocTask.includes developers {
developer {
id = 'Sauilitired'
name = 'Alexander Söderberg'
url = 'https://alexander-soderberg.com'
email = 'contact@alexander-soderberg.com'
} }
} }
issueManagement {
system = 'GitHub Issues'
url = 'https://github.com/Sauilitired/cloud/issues'
}
licenses {
license {
name = 'MIT License'
url = 'https://opensource.org/licenses/MIT'
}
}
scm {
connection = 'scm:git@github.com:Sauilitired/cloud.git'
developerConnection = 'scm:git@github.com:Sauilitired/cloud.git'
url = 'https://github.com/Sauilitired/cloud/'
}
}
}
}
}
signing {
required { project.hasProperty('signing.keyId') && gradle.taskGraph.hasTask(':publish') && !project.version.endsWith('-SNAPSHOT') }
sign publishing.publications.maven
}
} }

View file

@ -1,3 +0,0 @@
dependencies {
api 'io.leangen.geantyref:geantyref:1.3.4'
}

View file

@ -3,8 +3,6 @@ include(':cloud-jline')
include(':cloud-core') include(':cloud-core')
include(':cloud-services') include(':cloud-services')
include(':cloud-annotations') include(':cloud-annotations')
include(':cloud-bukkit-test')
include(':cloud-velocity-test')
include(':cloud-bukkit') include(':cloud-bukkit')
include(':cloud-paper') include(':cloud-paper')
include(':cloud-brigadier') include(':cloud-brigadier')
@ -12,9 +10,6 @@ include(':cloud-bungee')
include(':cloud-velocity') include(':cloud-velocity')
include(':cloud-minecraft-extras') include(':cloud-minecraft-extras')
include(':cloud-cloudburst') include(':cloud-cloudburst')
include(':cloud-cloudburst-test')
project(':cloud-bukkit-test').projectDir = file('cloud-minecraft/cloud-bukkit-test')
project(':cloud-velocity-test').projectDir = file('cloud-minecraft/cloud-velocity-test')
project(':cloud-bukkit').projectDir = file('cloud-minecraft/cloud-bukkit') project(':cloud-bukkit').projectDir = file('cloud-minecraft/cloud-bukkit')
project(':cloud-paper').projectDir = file('cloud-minecraft/cloud-paper') project(':cloud-paper').projectDir = file('cloud-minecraft/cloud-paper')
project(':cloud-brigadier').projectDir = file('cloud-minecraft/cloud-brigadier') project(':cloud-brigadier').projectDir = file('cloud-minecraft/cloud-brigadier')
@ -22,4 +17,3 @@ project(':cloud-bungee').projectDir = file('cloud-minecraft/cloud-bungee')
project(':cloud-velocity').projectDir = file('cloud-minecraft/cloud-velocity') project(':cloud-velocity').projectDir = file('cloud-minecraft/cloud-velocity')
project(':cloud-minecraft-extras').projectDir = file('cloud-minecraft/cloud-minecraft-extras') project(':cloud-minecraft-extras').projectDir = file('cloud-minecraft/cloud-minecraft-extras')
project(':cloud-cloudburst').projectDir = file('cloud-minecraft/cloud-cloudburst') project(':cloud-cloudburst').projectDir = file('cloud-minecraft/cloud-cloudburst')
project(':cloud-cloudburst-test').projectDir = file('cloud-minecraft/cloud-cloudburst-test')