mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-06-18 14:50:56 +00:00
Actually fix issue
This commit is contained in:
@@ -3,6 +3,7 @@ import java.io.File
|
|||||||
import java.io.FileWriter
|
import java.io.FileWriter
|
||||||
import java.net.URI
|
import java.net.URI
|
||||||
import java.net.URL
|
import java.net.URL
|
||||||
|
import java.nio.file.FileSystemNotFoundException
|
||||||
import java.nio.file.FileSystems
|
import java.nio.file.FileSystems
|
||||||
import java.nio.file.Files
|
import java.nio.file.Files
|
||||||
import java.nio.file.StandardCopyOption
|
import java.nio.file.StandardCopyOption
|
||||||
@@ -46,29 +47,28 @@ fun Project.configureDistribution() {
|
|||||||
// https://github.com/johnrengelman/shadow/issues/111
|
// https://github.com/johnrengelman/shadow/issues/111
|
||||||
val dest = URI.create("jar:" + tasks.named<ShadowJar>("shadowJar").get().archiveFile.get().asFile.toURI())
|
val dest = URI.create("jar:" + tasks.named<ShadowJar>("shadowJar").get().archiveFile.get().asFile.toURI())
|
||||||
|
|
||||||
val preExistingProvider = try {
|
val provider = try {
|
||||||
FileSystems.getFileSystem(dest)
|
FileSystems.getFileSystem(dest)
|
||||||
} catch (e: Exception) {
|
} catch (e: FileSystemNotFoundException) {
|
||||||
null
|
null
|
||||||
};
|
} ?: FileSystems.newFileSystem(dest, mapOf("create" to "false"), null);
|
||||||
val provider = if (preExistingProvider == null) {
|
|
||||||
preExistingProvider
|
|
||||||
} else {
|
|
||||||
FileSystems.newFileSystem(dest, mapOf("create" to "false"), null)
|
|
||||||
};
|
|
||||||
provider?.use { fs ->
|
provider?.use { fs ->
|
||||||
forSubProjects(":common:addons") {
|
forSubProjects(":common:addons") {
|
||||||
val jar = getJarTask()
|
if (fs.isOpen) {
|
||||||
|
val jar = getJarTask()
|
||||||
println("Packaging addon ${jar.archiveFileName.get()} to $dest. size: ${jar.archiveFile.get().asFile.length() / 1024}KB")
|
|
||||||
|
if (jar.archiveFile.get().asFile.exists()) {
|
||||||
val boot = if (extra.has("bootstrap") && extra.get("bootstrap") as Boolean) "bootstrap/" else ""
|
println("Packaging addon ${jar.archiveFileName.get()} to $dest. size: ${jar.archiveFile.get().asFile.length() / 1024}KB")
|
||||||
val addonPath = fs.getPath("/addons/$boot${jar.archiveFileName.get()}")
|
|
||||||
|
val boot = if (extra.has("bootstrap") && extra.get("bootstrap") as Boolean) "bootstrap/" else ""
|
||||||
if (!Files.exists(addonPath)) {
|
val addonPath = fs.getPath("/addons/$boot${jar.archiveFileName.get()}")
|
||||||
Files.createDirectories(addonPath.parent)
|
|
||||||
Files.createFile(addonPath)
|
if (!Files.exists(addonPath)) {
|
||||||
Files.copy(jar.archiveFile.get().asFile.toPath(), addonPath, StandardCopyOption.REPLACE_EXISTING)
|
Files.createDirectories(addonPath.parent)
|
||||||
|
Files.createFile(addonPath)
|
||||||
|
Files.copy(jar.archiveFile.get().asFile.toPath(), addonPath, StandardCopyOption.REPLACE_EXISTING)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user