From 222aa391357fd606588957e1fb30c1ec99b131e5 Mon Sep 17 00:00:00 2001 From: Michael Rittmeister Date: Tue, 1 Aug 2023 22:36:37 +0200 Subject: [PATCH] Fix Gradle issues (#6) --- main/build.gradle.kts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/main/build.gradle.kts b/main/build.gradle.kts index f34b2ab3..e0aafaeb 100644 --- a/main/build.gradle.kts +++ b/main/build.gradle.kts @@ -1,5 +1,8 @@ import com.vanniktech.maven.publish.JavaLibrary import com.vanniktech.maven.publish.JavadocJar +import kotlin.io.path.Path +import kotlin.io.path.createDirectories +import kotlin.io.path.writeText plugins { `java-library` @@ -34,14 +37,18 @@ dependencies { tasks { val updateVersion by registering { - File("$projectDir/src/main/resources/com/sedmelluq/discord/lavaplayer/tools/version.txt").let { - it.parentFile.mkdirs() + val output = "$buildDir/resources/main/com/sedmelluq/discord/lavaplayer/tools/version.txt" + inputs.property("version", version) + outputs.file(output) + + Path(output).let { + it.parent.createDirectories() it.writeText(version.toString()) } } classes { - finalizedBy(updateVersion) + dependsOn(updateVersion) } }