Compile core against IrisApi from the sibling checkout

gradle/irisapi-resolution.settings.gradle includes the IrisApi checkout as
a composite build, like VolmLib, and fails clearly when there is none.
Core uses it compileOnly and in tests: how the API reaches a server is
undecided, so it is not shaded and a built jar cannot load packs yet.
This commit is contained in:
piexel committed 2026-10-06 14:17:54 +02:00
1 parent efc1320923
commit d80dd66588
3 files changed
+91

No files matched your search

+6
View File
@@ -53,6 +53,11 @@ String volmLibCoordinate = providers.gradleProperty('volmLibCoordinate')
dependencies {
api(project(':spi'))
// IrisApi, from the sibling checkout (gradle/irisapi-resolution.settings.gradle). compileOnly on
// purpose: how the API reaches a server at runtime is undecided, so it is not shaded into the
// plugin or mod jars, and a built jar cannot load packs until that is decided.
compileOnly('com.volmit:IrisApi')
// Provided or Classpath
compileOnly(libs.lombok)
annotationProcessor(libs.lombok)
@@ -107,6 +112,7 @@ dependencies {
slim(libs.dom4j)
slim(libs.jaxen)
testImplementation('com.volmit:IrisApi')
testImplementation('junit:junit:4.13.2')
testImplementation('org.mockito:mockito-core:5.23.0')
testImplementation(libs.paper.api)
+84
View File
@@ -0,0 +1,84 @@
/*
* Iris is a World Generator for Minecraft Servers
* Copyright (c) 2026 Arcane Arts (Volmit Software)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/*
* IrisApi source resolution, applied by the root settings file:
*
* apply from: new File(settingsDir, 'gradle/irisapi-resolution.settings.gradle')
*
* IrisApi is a separate project with no published artifact, so Iris always compiles against a sibling
* checkout as a composite build. Core declares `com.volmit:IrisApi`; this substitutes it with the
* checkout's root project.
*
* Behaviour:
* -PlocalIrisApiDirectory=<path> explicit IrisApi checkout (relative paths resolve against the
* including build's settings directory).
* IRISAPI_DIR=<path> same, via environment.
* otherwise walk up from settingsDir looking for an `IrisApi` directory
* that contains a settings script.
*
* When nothing is found the build fails here, naming where it looked, rather than later with an
* unresolvable dependency.
*
* The modded adapters do not apply this: they compile against core's jar and use no IrisApi type.
*/
import java.io.File
boolean irisHasIrisApiSettings(File directory) {
if (directory == null) {
return false
}
new File(directory, 'settings.gradle.kts').exists() || new File(directory, 'settings.gradle').exists()
}
File irisResolveLocalIrisApiDirectory() {
String configuredPath = providers.gradleProperty('localIrisApiDirectory')
.orElse(providers.environmentVariable('IRISAPI_DIR'))
.orNull
if (configuredPath != null && !configuredPath.isBlank()) {
File configuredDirectory = new File(configuredPath)
if (!configuredDirectory.isAbsolute()) {
configuredDirectory = new File(settingsDir, configuredPath)
}
if (irisHasIrisApiSettings(configuredDirectory)) {
return configuredDirectory
}
throw new GradleException("IrisApi checkout ${configuredDirectory} has no settings script")
}
File currentDirectory = settingsDir
while (currentDirectory != null) {
File candidate = new File(currentDirectory, 'IrisApi')
if (irisHasIrisApiSettings(candidate)) {
return candidate
}
currentDirectory = currentDirectory.parentFile
}
throw new GradleException("No IrisApi checkout found in ${settingsDir} or its parent directories; "
+ "clone IrisApi next to Iris, or pass -PlocalIrisApiDirectory=<path> or IRISAPI_DIR")
}
includeBuild(irisResolveLocalIrisApiDirectory()) {
dependencySubstitution {
substitute(module('com.volmit:IrisApi')).using(project(':'))
}
}
+1
View File
@@ -23,6 +23,7 @@ plugins {
rootProject.name = 'Iris'
apply from: new File(settingsDir, 'gradle/volmlib-resolution.settings.gradle')
apply from: new File(settingsDir, 'gradle/irisapi-resolution.settings.gradle')
include(':core', ':core:agent')
include(':probe')