Ship each built-in module as its own jar and let a pack's modules.json decide which update on their own

The built-ins no longer travel as one iris-builtins.jar that a pack has to
copy by hand. IrisModule builds one jar per module (the eight placement
stages share one) with an index of the id and version each module reports,
and Iris bundles that folder.

A pack lists the modules it uses in modules.json, with the version it was
built with and an optional pinned list. Before a pack loads, Iris installs
the jars of listed modules and replaces a jar that differs from the one it
ships. It keeps a jar when the module is pinned, when the pack holds a newer
version than Iris ships, and, in a world's copy of a pack, when the major
version changed, because new chunks would not match the old ones. A jar that
shares classes with a kept jar stays with it, since the two were compiled
against each other. /iris pack update takes the kept terrain changes for a
world. What is installed is recorded in modules.lock.json.

Module versions are now major.minor.patch per module, starting at 1.0.0,
with major meaning "places different blocks or stops loading settings".
This commit is contained in:
piexel committed 2026-11-11 12:51:53 +01:00
1 parent e7d1ed24cb
commit 6e96c6b71e
85 files changed
+2568 -480

No files matched your search

+38 -10
View File
@@ -313,10 +313,14 @@ List<String> dependencyBuildMetadata = [
'META-INF/versions/*/OSGI-INF/**'
]
// The built-in modules as a pack module jar, iris-builtins.jar, which IrisModule builds from its classes and checks as a pack
// load would. Iris carries it in the plugin, never loading it itself: PackBuiltIns copies it into new packs, which load their
// own copy. It is checked once more against what Iris's own Bukkit jar leaves out of VolmLib, which only Iris knows.
// The built-in modules as pack module jars, which IrisModule builds from its classes and checks as a pack load would. Iris
// carries the folder of them in the plugin, never loading them itself: ShippedModules installs into a pack the jars its
// modules.json lists, and the pack loads its own copies. IrisModule also hands over all of them as one jar,
// iris-builtins.jar, which is checked once more against what Iris's own Bukkit jar leaves out of VolmLib, which only Iris
// knows. That jar is not bundled.
String builtinModulesJarName = 'iris-builtins.jar'
// Where the plugin carries the shipped jars and their index.json; ShippedModules.RESOURCE_FOLDER names the same.
String shippedModulesResourceFolder = 'shipped-modules'
// The packages pack modules may use besides the IrisApi; IrisModuleHost.EXPOSED_PACKAGES lists the same.
List<String> builtinExposedPackages = ['art.arcane.iris.builtin', 'art.arcane.iris.core.structure.authoring', 'art.arcane.volmlib',
'com.google.gson']
@@ -330,6 +334,13 @@ configurations {
attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage, Usage.JAVA_RUNTIME))
}
}
shippedModules {
canBeConsumed = false
transitive = false
attributes {
attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage, Usage.JAVA_RUNTIME))
}
}
// What the check sees besides the jar: the IrisApi (its host side included, as in the plugin, where the check finds it
// hidden), the libraries Iris shares with pack modules, and the module classes that are not in the jar.
builtinModulesCheckClasspath {
@@ -347,6 +358,11 @@ dependencies {
requireCapability('art.arcane:iris-builtins')
}
}
shippedModules('art.arcane:iris-module') {
capabilities {
requireCapability('art.arcane:iris-shipped-modules')
}
}
builtinModulesCheckClasspath('com.volmit:iris-api')
builtinModulesCheckClasspath('com.volmit:iris-host')
builtinModulesCheckClasspath('art.arcane:iris-module')
@@ -357,7 +373,7 @@ dependencies {
def builtinModulesJar = tasks.register('builtinModulesJar', JavaExec) {
group = 'build'
description = "Checks IrisModule's ${builtinModulesJarName} against the VolmLib classes the Bukkit jar leaves out and writes" +
" it to build/builtin-modules for bundling."
" it to build/builtin-modules, where the plugin reads which classes to leave out."
FileCollection built = configurations.builtinModules
classpath = configurations.builtinModulesCheckClasspath
mainClass.set('com.volmit.host.ModuleJarCheck')
@@ -383,8 +399,8 @@ def builtinModulesJar = tasks.register('builtinModulesJar', JavaExec) {
}
}
// The class entries of the bundled jar. Those classes load from it only, in each pack's class loader, so the plugin leaves
// the module artifact's copies out.
// The class entries of the shipped jars. Those classes load from them only, in each pack's class loader, so the plugin
// leaves the module artifact's copies out.
Set<String> builtinJarClassEntries = null
Closure<Boolean> inBuiltinModulesJar = { FileTreeElement element ->
if (builtinJarClassEntries == null) {
@@ -395,19 +411,31 @@ Closure<Boolean> inBuiltinModulesJar = { FileTreeElement element ->
builtinJarClassEntries.contains(element.relativePath.pathString)
}
// The shipped jars and their index pass through only after the one-jar form of the same classes passed Iris's check.
def shippedModulesFolder = tasks.register('shippedModulesFolder', Sync) {
description = 'Collects the module jars the plugin ships, with their index.json, into build/shipped-modules.'
dependsOn(builtinModulesJar)
from(configurations.shippedModules)
into(layout.buildDirectory.dir('shipped-modules'))
}
tasks.named('test').configure {
inputs.files(builtinModulesJar)
systemProperty('iris.builtinModulesJar', bundledBuiltinModulesJar.get().asFile.absolutePath)
inputs.files(shippedModulesFolder)
systemProperty('iris.shippedModulesFolder', layout.buildDirectory.dir('shipped-modules').get().asFile.absolutePath)
}
tasks.named('jar', Jar).configure {
from(builtinModulesJar)
from(shippedModulesFolder) {
into(shippedModulesResourceFolder)
}
}
tasks.named('shadowJar', com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar).configure {
dependsOn(embeddedAgentJar)
exclude(inBuiltinModulesJar)
from(builtinModulesJar)
from(shippedModulesFolder) {
into(shippedModulesResourceFolder)
}
mergeServiceFiles()
// minimize() stays off. Caffeine reaches its 520 generated cache and node classes through
// MethodHandles.Lookup.findClass on a computed name, and the VolmLib command, GUI and hotload