Skip to content

Commit

Permalink
chore(deps): Update all dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
phinner committed Nov 27, 2024
1 parent 2f1ce93 commit 2aeb83e
Show file tree
Hide file tree
Showing 35 changed files with 264 additions and 258 deletions.
18 changes: 18 additions & 0 deletions HEADER.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* HexedReloaded, A reimplementation of the hexed gamemode from Anuke, with more features and better performances.
*
* Copyright (C) 2024 Xpdustry
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
16 changes: 0 additions & 16 deletions LICENSE_HEADER.md

This file was deleted.

190 changes: 70 additions & 120 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,81 +1,63 @@
import fr.xpdustry.toxopid.dsl.mindustryDependencies
import fr.xpdustry.toxopid.spec.ModMetadata
import fr.xpdustry.toxopid.spec.ModPlatform
import fr.xpdustry.toxopid.task.GithubArtifactDownload
import com.xpdustry.toxopid.extension.anukeXpdustry
import com.xpdustry.toxopid.spec.ModMetadata
import com.xpdustry.toxopid.spec.ModPlatform
import com.xpdustry.toxopid.task.GithubAssetDownload
import net.ltgt.gradle.errorprone.CheckSeverity
import net.ltgt.gradle.errorprone.errorprone

plugins {
id("com.diffplug.spotless") version "6.23.3"
id("net.kyori.indra") version "3.1.3"
id("net.kyori.indra.publishing") version "3.1.3"
id("net.kyori.indra.git") version "3.1.3"
id("net.kyori.indra.licenser.spotless") version "3.1.3"
id("net.ltgt.errorprone") version "3.1.0"
id("com.github.johnrengelman.shadow") version "8.1.1"
id("fr.xpdustry.toxopid") version "3.2.0"
id("com.github.ben-manes.versions") version "0.50.0"
}

val metadata = ModMetadata.fromJson(file("plugin.json"))

// Remove the following line if you don't want snapshot versions
if (indraGit.headTag() == null) {
metadata.version += "-SNAPSHOT"
alias(libs.plugins.spotless)
alias(libs.plugins.indra.common)
alias(libs.plugins.indra.git)
alias(libs.plugins.indra.publishing)
alias(libs.plugins.shadow)
alias(libs.plugins.toxopid)
alias(libs.plugins.errorprone.gradle)
}

val metadata = ModMetadata.fromJson(rootProject.file("plugin.json"))
if (indraGit.headTag() == null) metadata.version += "-SNAPSHOT"
group = "com.xpdustry"
val rootPackage = "com.xpdustry.template"
version = metadata.version
description = metadata.description

toxopid {
compileVersion.set("v${metadata.minGameVersion}")
platforms.set(setOf(ModPlatform.HEADLESS))
compileVersion = "v${metadata.minGameVersion}"
platforms = setOf(ModPlatform.SERVER)
}

repositories {
mavenCentral()
// This repository provides mindustry artifacts built by xpdustry
maven("https://maven.xpdustry.com/mindustry")
// This repository provides xpdustry libraries, such as the distributor-api
maven("https://maven.xpdustry.com/releases")
anukeXpdustry()
maven("https://maven.xpdustry.com/releases") {
name = "xpdustry-releases"
mavenContent { releasesOnly() }
}
}

dependencies {
mindustryDependencies()
compileOnly("fr.xpdustry:distributor-api:3.3.0")

val junit = "5.10.1"
testImplementation("org.junit.jupiter:junit-jupiter-params:$junit")
testImplementation("org.junit.jupiter:junit-jupiter-api:$junit")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:$junit")

val checker = "3.41.0"
compileOnly("org.checkerframework:checker-qual:$checker")
testImplementation("org.checkerframework:checker-qual:$checker")

// Static analysis
annotationProcessor("com.uber.nullaway:nullaway:0.10.18")
errorprone("com.google.errorprone:error_prone_core:2.23.0")
implementation(libs.distributor.cloud)
implementation(libs.cloud.core)
implementation(libs.cloud.annotations)
compileOnly(libs.distributor.api)
compileOnly(libs.checker.qual)
annotationProcessor(libs.nullaway)
errorprone(libs.errorprone.core)
}

indra {
javaVersions {
target(17)
minimumToolchain(17)
target(libs.versions.java.get().toInt())
minimumToolchain(libs.versions.java.get().toInt())
}

publishSnapshotsTo("xpdustry", "https://maven.xpdustry.com/snapshots")
publishReleasesTo("xpdustry", "https://maven.xpdustry.com/releases")

// The license of your project, kyori has already functions for the most common licenses
// such as gpl3OnlyLicense() for GPLv3, apache2License() for Apache 2.0, etc.
// You can still specify your own license using the license { } builder function.
mitLicense()
gpl3OnlyLicense()

if (metadata.repo.isNotBlank()) {
val repo = metadata.repo.split("/")
if (metadata.repository.isNotBlank()) {
val repo = metadata.repository.split("/")
github(repo[0], repo[1]) {
ci(true)
issues(true)
Expand All @@ -101,83 +83,33 @@ signing {

spotless {
java {
// Palantir is an excellent java linter, balanced between google codestyle and regular java codestyle
palantirJavaFormat()
formatAnnotations()
// Makes sure static imports are after normal imports
importOrderFile(rootProject.file(".spotless/project.importorder"))
// Makes sure there is no wildcard imports.
// If you want to allow them,
// remove the following line and the bumpThisNumberIfACustomStepChanges(1)
custom("noWildcardImports") {
if (it.contains("*;\n")) {
throw Error("No wildcard imports allowed")
}
it
}
importOrder("", "\\#")
custom("no-wildcard-imports") { it.apply { if (contains("*;\n")) error("No wildcard imports allowed") } }
licenseHeaderFile(rootProject.file("HEADER.txt"))
bumpThisNumberIfACustomStepChanges(1)
}
kotlinGradle {
ktlint()
}
}

indraSpotlessLicenser {
licenseHeaderFile(rootProject.file("LICENSE_HEADER.md"))
// Some properties to make updating the licence header easier
property("NAME", metadata.displayName)
property("DESCRIPTION", metadata.description)
property("AUTHOR", metadata.author)
property("YEAR", "2023")
}

tasks.withType<JavaCompile> {
options.errorprone {
disableWarningsInGeneratedCode.set(true)
disable("MissingSummary", "InlineMeSuggester", "FutureReturnValueIgnored")
if (!name.contains("test", ignoreCase = true)) {
check("NullAway", CheckSeverity.ERROR)
option("NullAway:AnnotatedPackages", rootPackage)
option("NullAway:TreatGeneratedAsUnannotated", true)
}
val generateMetadataFile by tasks.registering {
inputs.property("metadata", metadata)
val output = temporaryDir.resolve("plugin.json")
outputs.file(output)
doLast {
output.writeText(ModMetadata.toJson(metadata))
}
}

// Required for the GitHub actions
tasks.register("getArtifactPath") {
doLast { println(tasks.shadowJar.get().archiveFile.get().toString()) }
}

tasks.shadowJar {
// Makes sure the name of the final jar is (plugin-name).jar
archiveFileName.set("${metadata.name}.jar")
// Set the classifier to plugin for publication on a maven repository
archiveClassifier.set("plugin")
// Configure the dependencies shading.
// WARNING: SQL drivers do not play well with shading,
// the best solution would be to load them in an isolated classloader.
// If it's too difficult, you can disable relocation but be aware this can conflict with other plugins.
isEnableRelocation = true
relocationPrefix = "$rootPackage.shadow"
// Reduce shadow jar size by removing unused classes.
// Warning, if one of your dependencies use service loaders or reflection, add to the exclude list
// such as "minimize { exclude(dependency("some.group:some-dependency:.*")) }"
archiveFileName = "${metadata.name}.jar"
archiveClassifier = "plugin"
from(generateMetadataFile)
from(rootProject.file("LICENSE.md")) { into("META-INF") }
minimize()
// Include the plugin.json file with the modified version
doFirst {
val temp = temporaryDir.resolve("plugin.json")
temp.writeText(metadata.toJson(true))
from(temp)
}
// Include the license of your project
from(rootProject.file("LICENSE.md")) {
into("META-INF")
}
}

tasks.build {
// Make sure the shadow jar is built during the build task
dependsOn(tasks.shadowJar)
}

tasks.register<Copy>("release") {
Expand All @@ -186,14 +118,32 @@ tasks.register<Copy>("release") {
destinationDir = temporaryDir
}

val downloadDistributorCore =
tasks.register<GithubArtifactDownload>("downloadDistributorCore") {
user.set("xpdustry")
repo.set("distributor")
version.set("v3.3.0")
name.set("distributor-core.jar")
tasks.withType<JavaCompile> {
options.errorprone {
disableWarningsInGeneratedCode = true
disable("MissingSummary", "InlineMeSuggester")
if (!name.contains("test", ignoreCase = true)) {
check("NullAway", CheckSeverity.ERROR)
option("NullAway:AnnotatedPackages", "com.xpdustry.hexed")
option("NullAway:TreatGeneratedAsUnannotated", true)
}
}
}

val downloadSlf4md by tasks.registering(GithubAssetDownload::class) {
owner = "xpdustry"
repo = "slf4md"
asset = "slf4md-simple.jar"
version = "v${libs.versions.slf4md.get()}"
}

val downloadDistributorCommon by tasks.registering(GithubAssetDownload::class) {
owner = "xpdustry"
repo = "distributor"
asset = "distributor-common.jar"
version = "v${libs.versions.distributor.get()}"
}

tasks.runMindustryServer {
mods.setFrom(tasks.shadowJar, downloadDistributorCore)
mods.from(downloadSlf4md, downloadDistributorCommon)
}
50 changes: 50 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
[versions]

# platforms
java = "17"

# utilities
distributor = "4.0.0-rc.3"
cloud = "2.0.0"
slf4md = "1.0.1"

# static analysis
errorprone-gradle = "4.1.0"
errorprone-core = "2.36.0"
nullaway = "0.12.1"
checker-qual = "3.48.2"

# gradle
toxopid = "4.1.1"
indra = "3.1.3"
spotless = "6.25.0"
shadow = "8.3.5"

[libraries]

# utilities
distributor-api = { module = "com.xpdustry:distributor-common-api", version.ref = "distributor" }
distributor-cloud = { module = "com.xpdustry:distributor-command-cloud", version.ref = "distributor" }
cloud-core = { module = "org.incendo:cloud-core", version.ref = "cloud" }
cloud-annotations = { module = "org.incendo:cloud-annotations", version.ref = "cloud" }

# static analysis
errorprone-core = { module = "com.google.errorprone:error_prone_core", version.ref = "errorprone-core" }
nullaway = { module = "com.uber.nullaway:nullaway", version.ref = "nullaway" }
checker-qual = { module = "org.checkerframework:checker-qual", version.ref = "checker-qual" }

# gradle
toxopid = { module = "com.xpdustry:toxopid", version.ref = "toxopid" }
indra-common = { module = "net.kyori:indra-common", version.ref = "indra" }
indra-licenser-spotless = { module = "net.kyori:indra-licenser-spotless", version.ref = "indra" }
spotless = { module = "com.diffplug.spotless:spotless-plugin-gradle", version.ref = "spotless" }
shadow = { module = "com.gradleup.shadow:shadow-gradle-plugin", version.ref = "shadow" }

[plugins]
indra-common = { id = "net.kyori.indra", version.ref = "indra" }
shadow = { id = "com.gradleup.shadow", version.ref = "shadow" }
indra-publishing = { id = "net.kyori.indra.publishing", version.ref = "indra" }
indra-git = { id = "net.kyori.indra.git", version.ref = "indra" }
toxopid = { id = "com.xpdustry.toxopid", version.ref = "toxopid" }
spotless = { id = "com.diffplug.spotless", version.ref = "spotless" }
errorprone-gradle = { id = "net.ltgt.errorprone", version.ref = "errorprone-gradle" }
8 changes: 3 additions & 5 deletions plugin.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
{
"name": "hexed-reloaded",
"author": "Xpdustry",
"displayName": "HexedPluginReloaded",
"description": "A reimplementation of the hexed gamemode, with more features and better performances.",
"displayName": "HexedReloaded",
"description": "A reimplementation of the hexed gamemode from Anuke, with more features and better performances.",
"repo": "xpdustry/hexed-reloaded",
"version": "1.0.0",
"java": true,
"hidden": true,
"main": "com.xpdustry.hexed.HexedPluginReloaded",
"minGameVersion": "146",
"dependencies": [
"distributor-core"
]
"dependencies": [ "distributor-common" ]
}
Loading

0 comments on commit 2aeb83e

Please sign in to comment.