build: Update Gradle and plugins, small cleanup to build scripts
This commit is contained in:
parent
9692593095
commit
fb48a3c8af
19 changed files with 245 additions and 189 deletions
15
build-logic/build.gradle.kts
Normal file
15
build-logic/build.gradle.kts
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
plugins {
|
||||
`kotlin-dsl`
|
||||
}
|
||||
|
||||
repositories {
|
||||
gradlePluginPortal()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(libs.indraCommon)
|
||||
implementation(libs.indraPublishingSonatype)
|
||||
implementation(libs.testLoggerPlugin)
|
||||
implementation(libs.errorpronePlugin)
|
||||
implementation(libs.licenser)
|
||||
}
|
||||
12
build-logic/settings.gradle.kts
Normal file
12
build-logic/settings.gradle.kts
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
import ca.stellardrift.build.configurate.ConfigFormats
|
||||
import ca.stellardrift.build.configurate.catalog.PolyglotVersionCatalogExtension
|
||||
|
||||
enableFeaturePreview("VERSION_CATALOGS")
|
||||
|
||||
plugins {
|
||||
id("ca.stellardrift.polyglot-version-catalogs") version "5.0.0"
|
||||
}
|
||||
|
||||
extensions.configure<PolyglotVersionCatalogExtension> {
|
||||
from(ConfigFormats.YAML, file("../gradle/libs.versions.yml"))
|
||||
}
|
||||
2
build-logic/src/main/kotlin/CloudExampleExtension.kt
Normal file
2
build-logic/src/main/kotlin/CloudExampleExtension.kt
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
abstract class CloudExampleExtension {
|
||||
}
|
||||
103
build-logic/src/main/kotlin/cloud.base-conventions.gradle.kts
Normal file
103
build-logic/src/main/kotlin/cloud.base-conventions.gradle.kts
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
import net.kyori.indra.repository.sonatypeSnapshots
|
||||
import net.ltgt.gradle.errorprone.errorprone
|
||||
import org.cadixdev.gradle.licenser.header.HeaderStyle
|
||||
|
||||
plugins {
|
||||
id("net.kyori.indra")
|
||||
id("net.kyori.indra.publishing")
|
||||
id("net.kyori.indra.checkstyle")
|
||||
id("net.kyori.indra.license-header")
|
||||
id("net.ltgt.errorprone")
|
||||
}
|
||||
|
||||
indra {
|
||||
publishSnapshotsTo("incendo", "https://repo.incendo.org/content/repositories/snapshots/")
|
||||
|
||||
github("Incendo", "cloud") {
|
||||
ci(true)
|
||||
}
|
||||
mitLicense()
|
||||
|
||||
javaVersions {
|
||||
testWith(8, 11, 16)
|
||||
}
|
||||
|
||||
checkstyle("8.39")
|
||||
|
||||
configurePublications {
|
||||
pom {
|
||||
developers {
|
||||
developer {
|
||||
id.set("Sauilitired")
|
||||
name.set("Alexander Söderberg")
|
||||
url.set("https://alexander-soderberg.com")
|
||||
email.set("contact@alexander-soderberg.com")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Disable checkstyle on tests */
|
||||
project.gradle.startParameter.excludedTaskNames.add("checkstyleTest")
|
||||
|
||||
tasks {
|
||||
withType<JavaCompile> {
|
||||
options.errorprone {
|
||||
/* These are just annoying */
|
||||
disable(
|
||||
"JdkObsolete",
|
||||
"FutureReturnValueIgnored",
|
||||
"ImmutableEnumChecker",
|
||||
"StringSplitter",
|
||||
"EqualsGetClass",
|
||||
"CatchAndPrintStackTrace"
|
||||
)
|
||||
}
|
||||
options.compilerArgs.addAll(listOf("-Xlint:-processing", "-Werror"))
|
||||
}
|
||||
}
|
||||
|
||||
license {
|
||||
header(rootProject.file("HEADER"))
|
||||
style["java"] = HeaderStyle.DOUBLE_SLASH.format
|
||||
style["kt"] = HeaderStyle.DOUBLE_SLASH.format
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
sonatypeSnapshots()
|
||||
/* Velocity, used for cloud-velocity */
|
||||
maven("https://nexus.velocitypowered.com/repository/velocity-artifacts-release/") {
|
||||
mavenContent { releasesOnly() }
|
||||
}
|
||||
/* The Minecraft repository, used for cloud-brigadier */
|
||||
maven("https://libraries.minecraft.net/") {
|
||||
mavenContent { releasesOnly() }
|
||||
}
|
||||
/* The current Sponge repository */
|
||||
maven("https://repo-new.spongepowered.org/repository/maven-public/")
|
||||
/* The Spigot repository, used for cloud-bukkit */
|
||||
maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/") {
|
||||
mavenContent { snapshotsOnly() }
|
||||
}
|
||||
/* The paper repository, used for cloud-paper */
|
||||
maven("https://papermc.io/repo/repository/maven-public/")
|
||||
/* The NukkitX repository, used for cloud-cloudburst */
|
||||
maven("https://repo.nukkitx.com/maven-snapshots") {
|
||||
mavenContent { snapshotsOnly() }
|
||||
}
|
||||
/* JitPack, used for random dependencies */
|
||||
maven("https://jitpack.io") {
|
||||
content { includeGroupByRegex("com\\.github\\..*") }
|
||||
}
|
||||
/* JDA's maven repository for cloud-jda */
|
||||
maven("https://m2.dv8tion.net/releases")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnlyApi("org.checkerframework", "checker-qual", Versions.checkerQual)
|
||||
testImplementation("org.junit.jupiter", "junit-jupiter-engine", Versions.jupiterEngine)
|
||||
errorprone("com.google.errorprone", "error_prone_core", Versions.errorprone)
|
||||
compileOnlyApi("com.google.errorprone", "error_prone_annotations", Versions.errorprone)
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
plugins {
|
||||
id("cloud.base-conventions")
|
||||
}
|
||||
|
||||
extensions.create<CloudExampleExtension>("cloudExample")
|
||||
|
||||
// Only compile examples on CI, or when the compile-examples property exists
|
||||
if (!ci.get() && !compileExamples) {
|
||||
tasks.configureEach {
|
||||
onlyIf { false }
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
plugins {
|
||||
id("net.kyori.indra.publishing.sonatype")
|
||||
}
|
||||
|
||||
System.getenv("SNAPSHOT_PUBLISHING_USERNAME")?.run {
|
||||
setProperty("incendoUsername", this)
|
||||
}
|
||||
System.getenv("SNAPSHOT_PUBLISHING_PASSWORD")?.run {
|
||||
setProperty("incendoPassword", this)
|
||||
}
|
||||
12
build-logic/src/main/kotlin/extensions.kt
Normal file
12
build-logic/src/main/kotlin/extensions.kt
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
import org.gradle.api.Project
|
||||
import org.gradle.api.provider.Provider
|
||||
|
||||
// set by GitHub Actions
|
||||
val Project.ci: Provider<Boolean>
|
||||
get() = providers.environmentVariable("CI")
|
||||
.forUseAtConfigurationTime()
|
||||
.map { it.toBoolean() }
|
||||
.orElse(false)
|
||||
|
||||
val Project.compileExamples: Boolean
|
||||
get() = hasProperty("compile-examples")
|
||||
142
build.gradle.kts
142
build.gradle.kts
|
|
@ -1,148 +1,12 @@
|
|||
import io.github.gradlenexus.publishplugin.NexusPublishExtension
|
||||
import net.kyori.indra.IndraLicenseHeaderPlugin
|
||||
import net.kyori.indra.IndraCheckstylePlugin
|
||||
import net.kyori.indra.IndraPublishingPlugin
|
||||
import net.kyori.indra.IndraExtension
|
||||
import net.kyori.indra.IndraPlugin
|
||||
import net.kyori.indra.repository.sonatypeSnapshots
|
||||
import net.ltgt.gradle.errorprone.ErrorPronePlugin
|
||||
import net.ltgt.gradle.errorprone.errorprone
|
||||
import org.cadixdev.gradle.licenser.LicenseExtension
|
||||
import org.cadixdev.gradle.licenser.header.HeaderStyle
|
||||
import org.gradle.api.plugins.JavaPlugin.COMPILE_ONLY_API_CONFIGURATION_NAME
|
||||
import org.gradle.api.plugins.JavaPlugin.TEST_IMPLEMENTATION_CONFIGURATION_NAME
|
||||
|
||||
plugins {
|
||||
val indraVersion = "2.0.2"
|
||||
id("net.kyori.indra") version indraVersion apply false
|
||||
id("net.kyori.indra.checkstyle") version indraVersion apply false
|
||||
id("net.kyori.indra.publishing") version indraVersion apply false
|
||||
id("net.kyori.indra.publishing.sonatype") version indraVersion
|
||||
id("net.kyori.indra.license-header") version indraVersion apply false
|
||||
id("com.github.johnrengelman.shadow") version "7.0.0" apply false
|
||||
id("net.ltgt.errorprone") version "2.0.1" apply false
|
||||
id("com.github.ben-manes.versions") version "0.38.0"
|
||||
}
|
||||
|
||||
//buildGroups("Minecraft", "Discord", "IRC")
|
||||
|
||||
gradle.taskGraph.whenReady {
|
||||
gradle.taskGraph.allTasks.forEach {
|
||||
if (it.project.name.contains("example")) {
|
||||
it.onlyIf {
|
||||
project.hasProperty("compile-examples")
|
||||
}
|
||||
}
|
||||
}
|
||||
id("cloud.parent-build-logic")
|
||||
id("com.github.ben-manes.versions")
|
||||
}
|
||||
|
||||
group = "cloud.commandframework"
|
||||
version = "1.5.0-SNAPSHOT"
|
||||
description = "Command framework and dispatcher for the JVM"
|
||||
|
||||
extensions.configure<NexusPublishExtension> {
|
||||
repositories.create("incendoSnapshots") {
|
||||
snapshotRepositoryUrl.set(uri("https://repo.incendo.org/content/repositories/snapshots/"))
|
||||
username.set(System.getenv("SNAPSHOT_PUBLISHING_USERNAME"))
|
||||
password.set(System.getenv("SNAPSHOT_PUBLISHING_PASSWORD"))
|
||||
}
|
||||
}
|
||||
|
||||
subprojects {
|
||||
apply<IndraPlugin>()
|
||||
apply<IndraPublishingPlugin>()
|
||||
apply<IndraCheckstylePlugin>()
|
||||
apply<IndraLicenseHeaderPlugin>()
|
||||
apply<ErrorPronePlugin>()
|
||||
|
||||
extensions.configure(IndraExtension::class) {
|
||||
github("Incendo", "cloud") {
|
||||
ci(true)
|
||||
}
|
||||
mitLicense()
|
||||
|
||||
javaVersions {
|
||||
testWith(8, 11, 16)
|
||||
}
|
||||
|
||||
checkstyle("8.39")
|
||||
|
||||
configurePublications {
|
||||
pom {
|
||||
developers {
|
||||
developer {
|
||||
id.set("Sauilitired")
|
||||
name.set("Alexander Söderberg")
|
||||
url.set("https://alexander-soderberg.com")
|
||||
email.set("contact@alexander-soderberg.com")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Disable checkstyle on tests */
|
||||
project.gradle.startParameter.excludedTaskNames.add("checkstyleTest")
|
||||
|
||||
tasks {
|
||||
withType(JavaCompile::class) {
|
||||
options.errorprone {
|
||||
/* These are just annoying */
|
||||
disable(
|
||||
"JdkObsolete",
|
||||
"FutureReturnValueIgnored",
|
||||
"ImmutableEnumChecker",
|
||||
"StringSplitter",
|
||||
"EqualsGetClass",
|
||||
"CatchAndPrintStackTrace"
|
||||
)
|
||||
}
|
||||
options.compilerArgs.addAll(listOf("-Xlint:-processing", "-Werror"))
|
||||
}
|
||||
}
|
||||
|
||||
extensions.configure<LicenseExtension> {
|
||||
header(rootProject.file("HEADER"))
|
||||
style["java"] = HeaderStyle.DOUBLE_SLASH.format
|
||||
style["kt"] = HeaderStyle.DOUBLE_SLASH.format
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
sonatypeSnapshots()
|
||||
/* Velocity, used for cloud-velocity */
|
||||
maven("https://nexus.velocitypowered.com/repository/velocity-artifacts-release/") {
|
||||
mavenContent { releasesOnly() }
|
||||
}
|
||||
/* The Minecraft repository, used for cloud-brigadier */
|
||||
maven("https://libraries.minecraft.net/") {
|
||||
mavenContent { releasesOnly() }
|
||||
}
|
||||
/* The current Sponge repository */
|
||||
maven("https://repo-new.spongepowered.org/repository/maven-public/")
|
||||
/* The Spigot repository, used for cloud-bukkit */
|
||||
maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/") {
|
||||
mavenContent { snapshotsOnly() }
|
||||
}
|
||||
/* The paper repository, used for cloud-paper */
|
||||
maven("https://papermc.io/repo/repository/maven-public/")
|
||||
/* The NukkitX repository, used for cloud-cloudburst */
|
||||
maven("https://repo.nukkitx.com/maven-snapshots") {
|
||||
mavenContent { snapshotsOnly() }
|
||||
}
|
||||
/* JitPack, used for random dependencies */
|
||||
maven("https://jitpack.io") {
|
||||
content { includeGroupByRegex("com\\.github\\..*") }
|
||||
}
|
||||
/* JDA's maven repository for cloud-jda */
|
||||
maven("https://m2.dv8tion.net/releases")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
COMPILE_ONLY_API_CONFIGURATION_NAME("org.checkerframework", "checker-qual", Versions.checkerQual)
|
||||
TEST_IMPLEMENTATION_CONFIGURATION_NAME("org.junit.jupiter", "junit-jupiter-engine", Versions.jupiterEngine)
|
||||
"errorprone"("com.google.errorprone", "error_prone_core", Versions.errorprone)
|
||||
COMPILE_ONLY_API_CONFIGURATION_NAME("com.google.errorprone", "error_prone_annotations", Versions.errorprone)
|
||||
}
|
||||
|
||||
plugins.apply("cloud.base-conventions")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +0,0 @@
|
|||
plugins {
|
||||
`kotlin-dsl`
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven("https://oss.sonatype.org/content/repositories/snapshots/")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("com.bmuschko", "gradle-nexus-plugin", "2.3.1")
|
||||
}
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
import org.gradle.api.Project
|
||||
import org.gradle.kotlin.dsl.invoke
|
||||
|
||||
fun Project.buildGroups(vararg groupNames: String) =
|
||||
groupNames.forEach(this::buildGroup)
|
||||
|
||||
fun Project.buildGroup(groupName: String) {
|
||||
tasks {
|
||||
register("build$groupName") {
|
||||
group = "cloud"
|
||||
rootProject.subprojects
|
||||
.filter { it.projectDir.parentFile.name == "cloud-${groupName.toLowerCase()}" }
|
||||
.map { it.tasks.getByName("build") }
|
||||
.forEach { dependsOn(it) }
|
||||
}
|
||||
register("install$groupName") {
|
||||
group = "cloud"
|
||||
rootProject.subprojects
|
||||
.filter { it.projectDir.parentFile.name == "cloud-${groupName.toLowerCase()}" }
|
||||
.map { it.tasks.getByName("publishToMavenLocal") }
|
||||
.forEach { dependsOn(it) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,8 +1,21 @@
|
|||
plugins {
|
||||
id("cloud.example-conventions")
|
||||
id("com.github.johnrengelman.shadow")
|
||||
id("xyz.jpenilla.run-paper") version "1.0.3-SNAPSHOT"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
/* Cloud */
|
||||
implementation(project(":cloud-paper"))
|
||||
implementation(project(":cloud-annotations"))
|
||||
implementation(project(":cloud-minecraft-extras"))
|
||||
/* Extras */
|
||||
implementation("me.lucko", "commodore", Versions.commodore)
|
||||
implementation("net.kyori", "adventure-platform-bukkit", Versions.adventurePlatform)
|
||||
/* Bukkit */
|
||||
compileOnly("org.bukkit", "bukkit", Versions.bukkit)
|
||||
}
|
||||
|
||||
tasks {
|
||||
shadowJar {
|
||||
dependencies {
|
||||
|
|
@ -18,15 +31,3 @@ tasks {
|
|||
legacyPluginLoading()
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
/* Cloud */
|
||||
implementation(project(":cloud-paper"))
|
||||
implementation(project(":cloud-annotations"))
|
||||
implementation(project(":cloud-minecraft-extras"))
|
||||
/* Extras */
|
||||
implementation("me.lucko", "commodore", Versions.commodore)
|
||||
implementation("net.kyori", "adventure-platform-bukkit", Versions.adventurePlatform)
|
||||
/* Bukkit */
|
||||
compileOnly("org.bukkit", "bukkit", Versions.bukkit)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
plugins {
|
||||
id("cloud.example-conventions")
|
||||
id ("com.github.johnrengelman.shadow")
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,7 @@
|
|||
plugins {
|
||||
id("cloud.example-conventions")
|
||||
}
|
||||
|
||||
apply plugin: "application"
|
||||
apply plugin: "com.github.johnrengelman.shadow"
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
plugins {
|
||||
application
|
||||
id("cloud.example-conventions")
|
||||
id("com.github.johnrengelman.shadow")
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
plugins {
|
||||
id ("com.github.johnrengelman.shadow")
|
||||
id("com.github.johnrengelman.shadow")
|
||||
id("cloud.example-conventions")
|
||||
}
|
||||
|
||||
val velocityRunClasspath by configurations.creating {
|
||||
|
|
|
|||
49
gradle/libs.versions.yml
Normal file
49
gradle/libs.versions.yml
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
metadata:
|
||||
format: { version: 1.0 }
|
||||
polyglot-extensions:
|
||||
- plugins
|
||||
|
||||
plugins:
|
||||
com.github.johnrengelman.shadow: 7.0.0
|
||||
net.ltgt.errorprone: 2.0.1
|
||||
com.github.ben-manes.versions: 0.36.0
|
||||
|
||||
versions:
|
||||
checkerQual: 3.14.0
|
||||
|
||||
# build-logic
|
||||
checkstyle: 8.39
|
||||
indra: 2.0.5
|
||||
testLoggerPlugin: 3.0.0
|
||||
errorpronePlugin: 2.0.1
|
||||
licenser: 0.6.0
|
||||
|
||||
dependencies:
|
||||
checkerQual:
|
||||
group: org.checkerframework
|
||||
name: checker-qual
|
||||
version: { ref: checkerQual }
|
||||
|
||||
# build-logic
|
||||
indraCommon:
|
||||
group: net.kyori
|
||||
name: indra-common
|
||||
version: { ref: indra }
|
||||
indraPublishingSonatype:
|
||||
group: net.kyori
|
||||
name: indra-publishing-sonatype
|
||||
version: { ref: indra }
|
||||
licenser:
|
||||
group: gradle.plugin.org.cadixdev.gradle
|
||||
name: licenser
|
||||
version: { ref: licenser }
|
||||
testLoggerPlugin:
|
||||
group: com.adarshr
|
||||
name: gradle-test-logger-plugin
|
||||
version: { ref: testLoggerPlugin }
|
||||
errorpronePlugin:
|
||||
group: net.ltgt.gradle
|
||||
name: gradle-errorprone-plugin
|
||||
version: { ref: errorpronePlugin }
|
||||
|
||||
bundles:
|
||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
|
|
@ -1,5 +1,5 @@
|
|||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
|
|
|||
|
|
@ -4,6 +4,11 @@ pluginManagement {
|
|||
maven("https://maven.fabricmc.net")
|
||||
maven("https://repo.jpenilla.xyz/snapshots") // todo - for run-paper snapshot
|
||||
}
|
||||
includeBuild("build-logic")
|
||||
}
|
||||
|
||||
plugins {
|
||||
id("ca.stellardrift.polyglot-version-catalogs") version "5.0.0"
|
||||
}
|
||||
|
||||
rootProject.name = "cloud"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue