Address Gradle deprecation warnings

This commit is contained in:
Nassim Jahnke 2024-11-17 13:31:36 +01:00
parent f59e2a2de4
commit 5515011644
No known key found for this signature in database
GPG Key ID: EF6771C01F6EF02F
3 changed files with 5 additions and 8 deletions

View File

@ -1,7 +1,6 @@
import org.gradle.api.Project import org.gradle.api.Project
import org.gradle.api.plugins.JavaPluginExtension import org.gradle.api.plugins.JavaPluginExtension
import org.gradle.jvm.toolchain.JavaLanguageVersion import org.gradle.jvm.toolchain.JavaLanguageVersion
import java.io.ByteArrayOutputStream
fun Project.latestCommitHash(): String { fun Project.latestCommitHash(): String {
return runGitCommand(listOf("rev-parse", "--short", "HEAD")) return runGitCommand(listOf("rev-parse", "--short", "HEAD"))
@ -16,12 +15,9 @@ fun Project.branchName(): String {
} }
fun Project.runGitCommand(args: List<String>): String { fun Project.runGitCommand(args: List<String>): String {
val byteOut = ByteArrayOutputStream() return providers.exec {
exec {
commandLine = listOf("git") + args commandLine = listOf("git") + args
standardOutput = byteOut }.standardOutput.asBytes.get().toString(Charsets.UTF_8).trim()
}
return byteOut.toString(Charsets.UTF_8.name()).trim()
} }
fun JavaPluginExtension.javaTarget(version: Int) { fun JavaPluginExtension.javaTarget(version: Int) {

View File

@ -1,5 +1,6 @@
plugins { plugins {
`java-library` `java-library`
`jvm-test-suite`
} }
tasks { tasks {

View File

@ -16,10 +16,10 @@ val main = setOf(
projects.viaversionBukkit, projects.viaversionBukkit,
projects.viaversionVelocity, projects.viaversionVelocity,
projects.viaversionFabric projects.viaversionFabric
).map { it.dependencyProject } ).map { it.path }
subprojects { subprojects {
when (this) { when (path) {
in main -> plugins.apply("via.shadow-conventions") in main -> plugins.apply("via.shadow-conventions")
else -> plugins.apply("via.base-conventions") else -> plugins.apply("via.base-conventions")
} }