mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-27 16:25:36 +00:00
IrisModule is a Gradle Java build of its own. Its compile classpath is com.volmit:iris-api (never iris-host), VolmLib (sibling checkout or the published coordinate, as Iris resolves it), Gson, Lombok and the JDK, all compileOnly, with Iris's compiler options and Lombok config. check compiles every source and builds build/libs/iris-builtins.jar from these classes with IrisApi's ModuleJarCheck; the jar is byte-identical to the one Iris built before. Iris consumes it through the capability art.arcane:iris-builtins. The 111 sources that need Iris itself move to Iris core: the layout model (biomes, regions, dimensions and their types, generators, noise styles, expressions, images and image maps), the pack's objects, blocks and matter objects, mods and compat filters, the structure model with its assembler, locator, fitting and placer (behind StructureHost), and the object placers behind ObjectHost and FloatingHost. Nothing left here reaches Iris core, engine, platform or util. source-patterns.txt and the tasks that ran Iris's build (checkBuiltins, packageBuiltinModulesInIris, builtinSourcesJar) are gone.
43 lines
1.9 KiB
Kotlin
43 lines
1.9 KiB
Kotlin
rootProject.name = "IrisModule"
|
|
|
|
// The built-ins compile against the Iris API alone, from the sibling checkout. Never against iris-host: that is what a host
|
|
// such as Iris uses to load modules, and packs never see it.
|
|
includeBuild("../IrisApi") {
|
|
dependencySubstitution {
|
|
substitute(module("com.volmit:iris-api")).using(project(":api"))
|
|
substitute(module("com.volmit:iris-host")).using(project(":host"))
|
|
}
|
|
}
|
|
|
|
// VolmLib from a sibling checkout when there is one, as Iris resolves it (Iris's gradle/volmlib-resolution.settings.gradle):
|
|
// -PuseLocalVolmLib=false turns it off, -PlocalVolmLibDirectory=<path> or VOLMLIB_DIR names the checkout, and otherwise the
|
|
// first `VolmLib` folder with a settings script above this one is used. Without one, the build resolves the published
|
|
// coordinate in gradle.properties.
|
|
fun hasSettingsScript(directory: File): Boolean =
|
|
File(directory, "settings.gradle.kts").exists() || File(directory, "settings.gradle").exists()
|
|
|
|
fun localVolmLibDirectory(): File? {
|
|
val configuredPath = providers.gradleProperty("localVolmLibDirectory")
|
|
.orElse(providers.environmentVariable("VOLMLIB_DIR"))
|
|
.orNull
|
|
if (!configuredPath.isNullOrBlank()) {
|
|
val configured = File(configuredPath).let { if (it.isAbsolute) it else File(settingsDir, configuredPath) }
|
|
if (hasSettingsScript(configured)) {
|
|
return configured
|
|
}
|
|
}
|
|
return generateSequence(settingsDir) { it.parentFile }
|
|
.map { File(it, "VolmLib") }
|
|
.firstOrNull { hasSettingsScript(it) }
|
|
}
|
|
|
|
val useLocalVolmLib = providers.gradleProperty("useLocalVolmLib").orElse("true").get().equals("true", ignoreCase = true)
|
|
val volmLibCheckout = if (useLocalVolmLib) localVolmLibDirectory() else null
|
|
if (volmLibCheckout != null) {
|
|
includeBuild(volmLibCheckout) {
|
|
dependencySubstitution {
|
|
substitute(module("com.github.VolmitSoftware:VolmLib")).using(project(":shared"))
|
|
}
|
|
}
|
|
}
|