diff --git a/buildSrc/src/main/kotlin/DistributionConfig.kt b/buildSrc/src/main/kotlin/DistributionConfig.kt index f871b1cbb..b492e90de 100644 --- a/buildSrc/src/main/kotlin/DistributionConfig.kt +++ b/buildSrc/src/main/kotlin/DistributionConfig.kt @@ -5,8 +5,6 @@ import java.net.URI import java.net.URL import java.nio.file.FileSystemNotFoundException import java.nio.file.FileSystems -import java.nio.file.Files -import java.nio.file.StandardCopyOption import org.gradle.api.DefaultTask import org.gradle.api.Project import org.gradle.api.plugins.BasePluginExtension @@ -17,6 +15,10 @@ import org.gradle.kotlin.dsl.get import org.gradle.kotlin.dsl.named import org.yaml.snakeyaml.DumperOptions import org.yaml.snakeyaml.Yaml +import kotlin.io.path.copyTo +import kotlin.io.path.createDirectories +import kotlin.io.path.createFile +import kotlin.io.path.exists fun Project.configureDistribution() { @@ -51,7 +53,7 @@ fun Project.configureDistribution() { FileSystems.getFileSystem(dest) } catch (e: FileSystemNotFoundException) { null - } ?: FileSystems.newFileSystem(dest, mapOf("create" to "false"), null); + } ?: FileSystems.newFileSystem(dest, mapOf("create" to "false"), null) provider?.use { fs -> forSubProjects(":common:addons") { if (fs.isOpen) { @@ -63,10 +65,10 @@ fun Project.configureDistribution() { val boot = if (extra.has("bootstrap") && extra.get("bootstrap") as Boolean) "bootstrap/" else "" val addonPath = fs.getPath("/addons/$boot${jar.archiveFileName.get()}") - if (!Files.exists(addonPath)) { - Files.createDirectories(addonPath.parent) - Files.createFile(addonPath) - Files.copy(jar.archiveFile.get().asFile.toPath(), addonPath, StandardCopyOption.REPLACE_EXISTING) + if (!addonPath.exists()) { + addonPath.parent.createDirectories() + addonPath.createFile() + jar.archiveFile.get().asFile.toPath().copyTo(addonPath, overwrite = true) } } } @@ -136,7 +138,7 @@ fun Project.configureDistribution() { dependsOn(downloadDefaultPacks) configurations = listOf(project.configurations["shaded"]) archiveClassifier.set("shaded") - setVersion(project.version) + version = project.version relocate("org.apache.commons", "com.dfsek.terra.lib.commons") relocate("org.objectweb.asm", "com.dfsek.terra.lib.asm") relocate("com.dfsek.paralithic", "com.dfsek.terra.lib.paralithic")