mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-12-01 18:24:06 +00:00
Load built-in modules only from the pack's own jar so an Iris update never changes a pack's modules
Iris no longer loads a bundled iris-builtins.jar with every pack. It carries the jar only to copy into new packs (/iris std create), so a pack and a world's copy of it keep the module versions they were made with. Built-in modules report Iris's version instead of "built-in", and /iris std modules lists every module with version, id and jar and takes the pack positionally.
This commit is contained in:
1 parent
620d59ad7a
commit
e7d1ed24cb
54 files changed
+213
-341
No files matched your search
@@ -1,6 +1,7 @@
|
||||
import org.gradle.api.tasks.bundling.ZipEntryCompression
|
||||
import org.gradle.jvm.tasks.Jar
|
||||
import java.io.ByteArrayOutputStream
|
||||
import java.util.Properties
|
||||
|
||||
plugins {
|
||||
`java-library`
|
||||
@@ -49,6 +50,39 @@ tasks.named<JavaCompile>("compileJava") {
|
||||
.withPathSensitivity(PathSensitivity.NONE)
|
||||
}
|
||||
|
||||
// The version every built-in module reports: Iris's own, so a pack's copy of the built-ins jar names the Iris build it came
|
||||
// from. This included build does not inherit Iris's gradle.properties, so it reads irisVersion from there.
|
||||
val irisVersion: String = providers.gradleProperty("irisVersion").orElse(provider {
|
||||
Properties().apply { layout.projectDirectory.file("../gradle.properties").asFile.reader().use(::load) }
|
||||
.getProperty("irisVersion")
|
||||
}).get()
|
||||
|
||||
val generateBuiltInModulesVersion = tasks.register("generateBuiltInModulesVersion") {
|
||||
description = "Writes BuiltInModulesVersion, which holds the version the built-in modules report."
|
||||
val output = layout.buildDirectory.dir("generated/sources/builtin-modules-version")
|
||||
inputs.property("irisVersion", irisVersion)
|
||||
outputs.dir(output)
|
||||
doLast {
|
||||
val source = output.get().file("art/arcane/iris/modules/BuiltInModulesVersion.java").asFile
|
||||
source.parentFile.mkdirs()
|
||||
source.writeText("""
|
||||
|package art.arcane.iris.modules;
|
||||
|
|
||||
|/** The version every built-in module reports: the Iris build the built-ins jar came from. Generated by the build. */
|
||||
|public final class BuiltInModulesVersion {
|
||||
| public static final String VERSION = "$irisVersion";
|
||||
|
|
||||
| private BuiltInModulesVersion() {
|
||||
| }
|
||||
|}
|
||||
|""".trimMargin())
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets.main {
|
||||
java.srcDir(generateBuiltInModulesVersion)
|
||||
}
|
||||
|
||||
// The built-ins as a pack module jar, build/libs/iris-builtins.jar. builtin-modules.txt lists what goes in:
|
||||
// "module <class>" (an entry point, with its nested classes) or "include <ant pattern>".
|
||||
val builtinModulesJarName = "iris-builtins.jar"
|
||||
|
||||
Reference in new issue
Block a user