From a43c3e9145ff90be1254b144da9ba24a7f2f5ff1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20S=C3=B6derberg?= Date: Thu, 1 Oct 2020 15:41:47 +0200 Subject: [PATCH] :sparkles: Fix build scripts and prepare Maven publishing --- build.gradle | 73 ++++++++++++++++++++++++++++++------- cloud-services/build.gradle | 3 -- settings.gradle | 6 --- 3 files changed, 59 insertions(+), 23 deletions(-) diff --git a/build.gradle b/build.gradle index 0b510edf..d5246275 100644 --- a/build.gradle +++ b/build.gradle @@ -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' } -} -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") + publishing { + publications { + maven(MavenPublication) { + from components.java - delete("./docs") + artifact publishingJavadocJar + artifact publishingSourcesJar - subprojects.each { proj -> - proj.tasks.withType(Javadoc).each { javadocTask -> - source += javadocTask.source - classpath += javadocTask.classpath - excludes += javadocTask.excludes - includes += javadocTask.includes + 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' + } + } + + 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 + } } + diff --git a/cloud-services/build.gradle b/cloud-services/build.gradle index 99ac7546..e69de29b 100644 --- a/cloud-services/build.gradle +++ b/cloud-services/build.gradle @@ -1,3 +0,0 @@ -dependencies { - api 'io.leangen.geantyref:geantyref:1.3.4' -} diff --git a/settings.gradle b/settings.gradle index 9dfcc80b..a715227d 100644 --- a/settings.gradle +++ b/settings.gradle @@ -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')