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 'java-library'
id 'com.github.johnrengelman.shadow' version '6.0.0'
id 'maven-publish'
}
checkstyle {
@ -28,6 +29,7 @@ allprojects {
group = 'cloud.commandframework'
version = '0.3.0-SNAPSHOT'
description = 'Command framework and dispatcher for the JVM'
/* Disable checkstyle on tests */
project.gradle.startParameter.excludedTaskNames.add('checkstyleTest')
@ -49,11 +51,22 @@ subprojects {
apply plugin: 'java'
apply plugin: 'java-library'
apply plugin: 'maven-publish'
apply plugin: 'signing'
test {
useJUnitPlatform()
}
task publishingSourcesJar(type: Jar) {
from sourceSets.main.allJava
archiveClassifier.set('sources')
}
task publishingJavadocJar(type: Jar) {
from javadoc
archiveClassifier.set('javadoc')
}
repositories {
mavenLocal()
mavenCentral()
@ -101,6 +114,7 @@ subprojects {
dependencies {
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'
}
@ -109,23 +123,54 @@ subprojects {
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
publishing {
publications {
maven(MavenPublication) {
from components.java
artifact publishingJavadocJar
artifact publishingSourcesJar
pom {
name = project.name
url = 'https://github.com/Sauilitired/cloud'
description = project.description
developers {
developer {
id = 'Sauilitired'
name = 'Alexander Söderberg'
url = 'https://alexander-soderberg.com'
email = 'contact@alexander-soderberg.com'
}
}
task aggregatedJavadocs(type: Javadoc, description: "Generate javadocs from all child projects as if it was a single project", group: "Documentation") {
destinationDir = file("./docs/javadoc")
title = "$project.name $version API"
options.author true
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")
issueManagement {
system = 'GitHub Issues'
url = 'https://github.com/Sauilitired/cloud/issues'
}
delete("./docs")
licenses {
license {
name = 'MIT License'
url = 'https://opensource.org/licenses/MIT'
}
}
subprojects.each { proj ->
proj.tasks.withType(Javadoc).each { javadocTask ->
source += javadocTask.source
classpath += javadocTask.classpath
excludes += javadocTask.excludes
includes += javadocTask.includes
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-services')
include(':cloud-annotations')
include(':cloud-bukkit-test')
include(':cloud-velocity-test')
include(':cloud-bukkit')
include(':cloud-paper')
include(':cloud-brigadier')
@ -12,9 +10,6 @@ include(':cloud-bungee')
include(':cloud-velocity')
include(':cloud-minecraft-extras')
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-paper').projectDir = file('cloud-minecraft/cloud-paper')
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-minecraft-extras').projectDir = file('cloud-minecraft/cloud-minecraft-extras')
project(':cloud-cloudburst').projectDir = file('cloud-minecraft/cloud-cloudburst')
project(':cloud-cloudburst-test').projectDir = file('cloud-minecraft/cloud-cloudburst-test')