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
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 {
|
||||
}
|
||||
36
build-logic/src/main/kotlin/Versions.kt
Normal file
36
build-logic/src/main/kotlin/Versions.kt
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
object Versions {
|
||||
const val checkerQual = "3.9.1"
|
||||
const val geantyref = "1.3.11"
|
||||
const val errorprone = "2.5.1"
|
||||
|
||||
// INTEGRATION DEPENDENCIES
|
||||
const val guice = "4.2.3"
|
||||
|
||||
// DISCORD DEPENDENCIES
|
||||
const val javacord = "3.1.1"
|
||||
const val jda = "4.2.1_257"
|
||||
|
||||
// MINECRAFT DEPENDENCIES
|
||||
const val brigadier = "1.0.17"
|
||||
const val bukkit = "1.13.2-R0.1-SNAPSHOT"
|
||||
const val commodore = "1.10"
|
||||
const val bungeecord = "1.8-SNAPSHOT"
|
||||
const val cloudburst = "1.0.0-SNAPSHOT"
|
||||
const val adventureApi = "4.7.0"
|
||||
const val adventurePlatform = "4.0.0-SNAPSHOT"
|
||||
const val paperApi = "1.15.2-R0.1-SNAPSHOT"
|
||||
const val velocityApi = "1.1.0"
|
||||
const val spongeApi7 = "7.3.0"
|
||||
const val jetbrainsAnnotations = "20.1.0"
|
||||
const val guava = "21.0-jre"
|
||||
const val fabricLoader = "0.11.1"
|
||||
const val fabricMc = "1.16.5"
|
||||
const val fabricApi = "0.31.0+1.16"
|
||||
|
||||
// IRC DEPENDENCIES
|
||||
const val pircbotx = "83a4c22e80"
|
||||
|
||||
// TEST DEPENDENCIES
|
||||
const val jupiterEngine = "5.7.0"
|
||||
const val jmh = "1.27"
|
||||
}
|
||||
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")
|
||||
Loading…
Add table
Add a link
Reference in a new issue