Revert "Actually fix issue"

This reverts commit 0b1d67b533.
This commit is contained in:
Zoë Gidiere
2023-11-13 15:21:17 -07:00
parent 16e61098d9
commit 4dfe2054e9
@@ -3,7 +3,6 @@ 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 org.gradle.api.DefaultTask import org.gradle.api.DefaultTask
import org.gradle.api.Project import org.gradle.api.Project
@@ -49,17 +48,20 @@ 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 provider = try { val preExistingProvider = try {
FileSystems.getFileSystem(dest) FileSystems.getFileSystem(dest)
} catch (e: FileSystemNotFoundException) { } catch (e: Exception) {
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") {
if (fs.isOpen) {
val jar = getJarTask() val jar = getJarTask()
if (jar.archiveFile.get().asFile.exists()) {
println("Packaging addon ${jar.archiveFileName.get()} to $dest. size: ${jar.archiveFile.get().asFile.length() / 1024}KB") println("Packaging addon ${jar.archiveFileName.get()} to $dest. size: ${jar.archiveFile.get().asFile.length() / 1024}KB")
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 ""
@@ -70,8 +72,6 @@ fun Project.configureDistribution() {
addonPath.createFile() addonPath.createFile()
jar.archiveFile.get().asFile.toPath().copyTo(addonPath, overwrite = true) jar.archiveFile.get().asFile.toPath().copyTo(addonPath, overwrite = true)
} }
}
}
} }
} }