diff --git a/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/taskcontainers/BundlerJarTasks.kt b/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/taskcontainers/BundlerJarTasks.kt index 85adef97..296d9b1d 100644 --- a/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/taskcontainers/BundlerJarTasks.kt +++ b/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/taskcontainers/BundlerJarTasks.kt @@ -33,6 +33,7 @@ import org.gradle.api.artifacts.component.ProjectComponentIdentifier import org.gradle.api.file.RegularFile import org.gradle.api.plugins.JavaPlugin import org.gradle.api.provider.Provider +import org.gradle.api.provider.ProviderFactory import org.gradle.api.tasks.TaskProvider import org.gradle.kotlin.dsl.* @@ -41,6 +42,7 @@ class BundlerJarTasks( project: Project, private val bundlerJarName: Provider, private val mainClassString: Provider, + private val providers: ProviderFactory = project.providers, ) { val createBundlerJar: TaskProvider val createPaperclipJar: TaskProvider @@ -156,6 +158,7 @@ class BundlerJarTasks( registerVersionArtifact( bundlerJarName.get(), bundlerVersionJson, + providers, serverJar ) } @@ -175,9 +178,10 @@ class BundlerJarTasks( fun NamedDomainObjectContainer.registerVersionArtifact( name: String, versionJson: Provider, + providers: ProviderFactory, serverJar: Provider ) = register(name) { - id.set(versionJson.map { gson.fromJson(it)["id"].asString }) + id.set(providers.fileContents(versionJson).asText.map { gson.fromJson(it)["id"].asString }) file.set(serverJar) } } diff --git a/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/taskcontainers/DevBundleTasks.kt b/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/taskcontainers/DevBundleTasks.kt index 5e012ee5..11b1470c 100644 --- a/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/taskcontainers/DevBundleTasks.kt +++ b/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/taskcontainers/DevBundleTasks.kt @@ -34,6 +34,7 @@ import org.gradle.api.file.RegularFile import org.gradle.api.plugins.JavaPluginExtension import org.gradle.api.provider.Property import org.gradle.api.provider.Provider +import org.gradle.api.provider.ProviderFactory import org.gradle.api.tasks.TaskContainer import org.gradle.kotlin.dsl.* @@ -41,6 +42,7 @@ import org.gradle.kotlin.dsl.* class DevBundleTasks( project: Project, tasks: TaskContainer = project.tasks, + private val providers: ProviderFactory = project.providers, ) { val serverBundlerForDevBundle by tasks.registering { paperclip.from(project.configurations.named(PAPERCLIP_CONFIG)) @@ -75,6 +77,7 @@ class DevBundleTasks( registerVersionArtifact( bundlerJarName, versionJsonFile, + providers, project.tasks.named("includeMappings").flatMap { it.outputJar } ) } diff --git a/paperweight-lib/src/main/kotlin/io/papermc/paperweight/tasks/CreateBundlerJar.kt b/paperweight-lib/src/main/kotlin/io/papermc/paperweight/tasks/CreateBundlerJar.kt index fca79ac9..cbddce58 100644 --- a/paperweight-lib/src/main/kotlin/io/papermc/paperweight/tasks/CreateBundlerJar.kt +++ b/paperweight-lib/src/main/kotlin/io/papermc/paperweight/tasks/CreateBundlerJar.kt @@ -97,7 +97,7 @@ abstract class CreateBundlerJar : ZippedTask() { } override fun run(rootDir: Path) { - paperclip.singleFile.toPath().openZip().use { zip -> + paperclip.singleFile.toPath().openZipSafe().use { zip -> zip.getPath("/").copyRecursivelyTo(rootDir) } @@ -127,7 +127,7 @@ abstract class CreateBundlerJar : ZippedTask() { rootDir.resolve("META-INF/main-class").writeText(mainClass.get()) // copy version.json file - vanillaBundlerJar.path.openZip().use { fs -> + vanillaBundlerJar.path.openZipSafe().use { fs -> fs.getPath("/").resolve(FileEntry.VERSION_JSON).copyTo(rootDir.resolve("version.json")) } } diff --git a/paperweight-lib/src/main/kotlin/io/papermc/paperweight/tasks/CreatePaperclipJar.kt b/paperweight-lib/src/main/kotlin/io/papermc/paperweight/tasks/CreatePaperclipJar.kt index 7b57029f..93510cf2 100644 --- a/paperweight-lib/src/main/kotlin/io/papermc/paperweight/tasks/CreatePaperclipJar.kt +++ b/paperweight-lib/src/main/kotlin/io/papermc/paperweight/tasks/CreatePaperclipJar.kt @@ -76,8 +76,8 @@ abstract class CreatePaperclipJar : JavaLauncherZippedTask() { override fun run(rootDir: Path) { // Vanilla's URL uses a SHA1 hash of the vanilla server jar val patchEntries: List - bundlerJar.path.openZip().use { newBundlerFs -> - originalBundlerJar.path.openZip().use { originalBundlerFs -> + bundlerJar.path.openZipSafe().use { newBundlerFs -> + originalBundlerJar.path.openZipSafe().use { originalBundlerFs -> val originalBundlerRoot = originalBundlerFs.getPath("/") val newBundlerRoot = newBundlerFs.getPath("/")