From 551501164402ee930e5ac8e8989e43b8b280085d Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Sun, 17 Nov 2024 13:31:36 +0100 Subject: [PATCH] Address Gradle deprecation warnings --- build-logic/src/main/kotlin/extensions.kt | 8 ++------ .../src/main/kotlin/via.base-conventions.gradle.kts | 1 + build.gradle.kts | 4 ++-- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/build-logic/src/main/kotlin/extensions.kt b/build-logic/src/main/kotlin/extensions.kt index 83828ac32..b72de159f 100644 --- a/build-logic/src/main/kotlin/extensions.kt +++ b/build-logic/src/main/kotlin/extensions.kt @@ -1,7 +1,6 @@ import org.gradle.api.Project import org.gradle.api.plugins.JavaPluginExtension import org.gradle.jvm.toolchain.JavaLanguageVersion -import java.io.ByteArrayOutputStream fun Project.latestCommitHash(): String { return runGitCommand(listOf("rev-parse", "--short", "HEAD")) @@ -16,12 +15,9 @@ fun Project.branchName(): String { } fun Project.runGitCommand(args: List): String { - val byteOut = ByteArrayOutputStream() - exec { + return providers.exec { commandLine = listOf("git") + args - standardOutput = byteOut - } - return byteOut.toString(Charsets.UTF_8.name()).trim() + }.standardOutput.asBytes.get().toString(Charsets.UTF_8).trim() } fun JavaPluginExtension.javaTarget(version: Int) { diff --git a/build-logic/src/main/kotlin/via.base-conventions.gradle.kts b/build-logic/src/main/kotlin/via.base-conventions.gradle.kts index d094aff73..043784492 100644 --- a/build-logic/src/main/kotlin/via.base-conventions.gradle.kts +++ b/build-logic/src/main/kotlin/via.base-conventions.gradle.kts @@ -1,5 +1,6 @@ plugins { `java-library` + `jvm-test-suite` } tasks { diff --git a/build.gradle.kts b/build.gradle.kts index a5f64b05b..57044fd9f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -16,10 +16,10 @@ val main = setOf( projects.viaversionBukkit, projects.viaversionVelocity, projects.viaversionFabric -).map { it.dependencyProject } +).map { it.path } subprojects { - when (this) { + when (path) { in main -> plugins.apply("via.shadow-conventions") else -> plugins.apply("via.base-conventions") }