mirror of
https://github.com/ViaVersion/ViaBackwards.git
synced 2024-12-04 14:14:15 +01:00
Address Gradle deprecation warnings
This commit is contained in:
parent
07e2848e5b
commit
4a9c98aa1b
@ -1,33 +1,23 @@
|
|||||||
import org.gradle.api.JavaVersion
|
|
||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
import org.gradle.api.plugins.JavaPluginExtension
|
import org.gradle.api.plugins.JavaPluginExtension
|
||||||
import java.io.ByteArrayOutputStream
|
import org.gradle.jvm.toolchain.JavaLanguageVersion
|
||||||
|
|
||||||
fun Project.latestCommitHash(): String {
|
fun Project.latestCommitHash(): String {
|
||||||
val byteOut = ByteArrayOutputStream()
|
return runGitCommand(listOf("rev-parse", "--short", "HEAD"))
|
||||||
exec {
|
|
||||||
commandLine = listOf("git", "rev-parse", "--short", "HEAD")
|
|
||||||
standardOutput = byteOut
|
|
||||||
}
|
|
||||||
return byteOut.toString(Charsets.UTF_8.name()).trim()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Project.latestCommitMessage(): String {
|
fun Project.latestCommitMessage(): String {
|
||||||
val byteOut = ByteArrayOutputStream()
|
return runGitCommand(listOf("log", "-1", "--pretty=%B"))
|
||||||
exec {
|
|
||||||
commandLine = listOf("git", "log", "-1", "--pretty=%B")
|
|
||||||
standardOutput = byteOut
|
|
||||||
}
|
|
||||||
return byteOut.toString(Charsets.UTF_8.name()).trim()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Project.branchName(): String {
|
fun Project.branchName(): String {
|
||||||
val byteOut = ByteArrayOutputStream()
|
return runGitCommand(listOf("rev-parse", "--abbrev-ref", "HEAD"))
|
||||||
exec {
|
}
|
||||||
commandLine = listOf("git", "rev-parse", "--abbrev-ref", "HEAD")
|
|
||||||
standardOutput = byteOut
|
fun Project.runGitCommand(args: List<String>): String {
|
||||||
}
|
return providers.exec {
|
||||||
return byteOut.toString(Charsets.UTF_8.name()).trim()
|
commandLine = listOf("git") + args
|
||||||
|
}.standardOutput.asBytes.get().toString(Charsets.UTF_8).trim()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Project.parseMinecraftSnapshotVersion(version: String): String? {
|
fun Project.parseMinecraftSnapshotVersion(version: String): String? {
|
||||||
@ -40,6 +30,5 @@ fun Project.parseMinecraftSnapshotVersion(version: String): String? {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun JavaPluginExtension.javaTarget(version: Int) {
|
fun JavaPluginExtension.javaTarget(version: Int) {
|
||||||
sourceCompatibility = JavaVersion.toVersion(version)
|
toolchain.languageVersion.set(JavaLanguageVersion.of(version))
|
||||||
targetCompatibility = JavaVersion.toVersion(version)
|
|
||||||
}
|
}
|
||||||
|
@ -16,10 +16,10 @@ val main = setOf(
|
|||||||
projects.viabackwardsVelocity,
|
projects.viabackwardsVelocity,
|
||||||
projects.viabackwardsSponge,
|
projects.viabackwardsSponge,
|
||||||
projects.viabackwardsFabric
|
projects.viabackwardsFabric
|
||||||
).map { it.dependencyProject }
|
).map { it.path }
|
||||||
|
|
||||||
subprojects {
|
subprojects {
|
||||||
when (this) {
|
when (path) {
|
||||||
in main -> plugins.apply("vb.shadow-conventions")
|
in main -> plugins.apply("vb.shadow-conventions")
|
||||||
else -> plugins.apply("vb.base-conventions")
|
else -> plugins.apply("vb.base-conventions")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user