mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2025-07-03 00:15:35 +00:00
Use kotlin's Path extensions rather than Files.whatever
Signed-off-by: solonovamax <solonovamax@12oclockpoint.com>
This commit is contained in:
parent
0ab463f34f
commit
3f9f2bdce4
@ -5,8 +5,6 @@ import java.net.URI
|
|||||||
import java.net.URL
|
import java.net.URL
|
||||||
import java.nio.file.FileSystemNotFoundException
|
import java.nio.file.FileSystemNotFoundException
|
||||||
import java.nio.file.FileSystems
|
import java.nio.file.FileSystems
|
||||||
import java.nio.file.Files
|
|
||||||
import java.nio.file.StandardCopyOption
|
|
||||||
import org.gradle.api.DefaultTask
|
import org.gradle.api.DefaultTask
|
||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
import org.gradle.api.plugins.BasePluginExtension
|
import org.gradle.api.plugins.BasePluginExtension
|
||||||
@ -17,6 +15,10 @@ import org.gradle.kotlin.dsl.get
|
|||||||
import org.gradle.kotlin.dsl.named
|
import org.gradle.kotlin.dsl.named
|
||||||
import org.yaml.snakeyaml.DumperOptions
|
import org.yaml.snakeyaml.DumperOptions
|
||||||
import org.yaml.snakeyaml.Yaml
|
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() {
|
fun Project.configureDistribution() {
|
||||||
@ -51,7 +53,7 @@ fun Project.configureDistribution() {
|
|||||||
FileSystems.getFileSystem(dest)
|
FileSystems.getFileSystem(dest)
|
||||||
} catch (e: FileSystemNotFoundException) {
|
} catch (e: FileSystemNotFoundException) {
|
||||||
null
|
null
|
||||||
} ?: FileSystems.newFileSystem(dest, mapOf("create" to "false"), null);
|
} ?: FileSystems.newFileSystem(dest, mapOf("create" to "false"), null)
|
||||||
provider?.use { fs ->
|
provider?.use { fs ->
|
||||||
forSubProjects(":common:addons") {
|
forSubProjects(":common:addons") {
|
||||||
if (fs.isOpen) {
|
if (fs.isOpen) {
|
||||||
@ -63,10 +65,10 @@ fun Project.configureDistribution() {
|
|||||||
val boot = if (extra.has("bootstrap") && extra.get("bootstrap") as Boolean) "bootstrap/" else ""
|
val boot = if (extra.has("bootstrap") && extra.get("bootstrap") as Boolean) "bootstrap/" else ""
|
||||||
val addonPath = fs.getPath("/addons/$boot${jar.archiveFileName.get()}")
|
val addonPath = fs.getPath("/addons/$boot${jar.archiveFileName.get()}")
|
||||||
|
|
||||||
if (!Files.exists(addonPath)) {
|
if (!addonPath.exists()) {
|
||||||
Files.createDirectories(addonPath.parent)
|
addonPath.parent.createDirectories()
|
||||||
Files.createFile(addonPath)
|
addonPath.createFile()
|
||||||
Files.copy(jar.archiveFile.get().asFile.toPath(), addonPath, StandardCopyOption.REPLACE_EXISTING)
|
jar.archiveFile.get().asFile.toPath().copyTo(addonPath, overwrite = true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -136,7 +138,7 @@ fun Project.configureDistribution() {
|
|||||||
dependsOn(downloadDefaultPacks)
|
dependsOn(downloadDefaultPacks)
|
||||||
configurations = listOf(project.configurations["shaded"])
|
configurations = listOf(project.configurations["shaded"])
|
||||||
archiveClassifier.set("shaded")
|
archiveClassifier.set("shaded")
|
||||||
setVersion(project.version)
|
version = project.version
|
||||||
relocate("org.apache.commons", "com.dfsek.terra.lib.commons")
|
relocate("org.apache.commons", "com.dfsek.terra.lib.commons")
|
||||||
relocate("org.objectweb.asm", "com.dfsek.terra.lib.asm")
|
relocate("org.objectweb.asm", "com.dfsek.terra.lib.asm")
|
||||||
relocate("com.dfsek.paralithic", "com.dfsek.terra.lib.paralithic")
|
relocate("com.dfsek.paralithic", "com.dfsek.terra.lib.paralithic")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user