Files
Iris/gradle/nested-build.init.gradle
T
Brian Neumann-Fopiano fc810221bb Parallelized mod builds
- Mod targets run through bounded Gradle workers with separate caches and daemon slots
- Target logs retain verification failures and bounded output summaries
- Nested tests use bounded forks and JVM thread counts
- Lifecycle tests control deadlines through injected clocks
2026-10-21 02:53:00 -04:00

32 lines
1.6 KiB
Groovy

Gradle rootBuild = gradle
while (rootBuild.parent != null) {
rootBuild = rootBuild.parent
}
String buildLane = rootBuild.startParameter.projectProperties['irisBuildLane']
if (buildLane == null) {
throw new GradleException('The nested build requires -PirisBuildLane.')
}
if (!(buildLane ==~ /[a-zA-Z0-9][a-zA-Z0-9._-]*/)) {
throw new GradleException('irisBuildLane must contain only letters, numbers, dots, underscores and hyphens.')
}
gradle.extensions.extraProperties.set('irisBuildLane', buildLane)
gradle.startParameter.projectCacheDir = new File(gradle.startParameter.currentDir, ".gradle/iris-lanes/${buildLane}")
gradle.beforeSettings { Settings settings ->
settings.gradle.startParameter.projectCacheDir = new File(settings.settingsDir, ".gradle/iris-lanes/${buildLane}")
}
gradle.beforeProject { Project candidate ->
boolean sharedRuntime = candidate.rootProject.name == 'Iris'
&& candidate.path in [':core', ':core:agent', ':spi']
if (!candidate.rootProject.name.startsWith('iris-') && !sharedRuntime) {
candidate.layout.buildDirectory.set(candidate.layout.projectDirectory.dir("build/iris-lanes/${buildLane}"))
}
candidate.plugins.withId('io.papermc.paperweight.userdev') {
candidate.tasks.named('paperweightUserdevSetup').configure { Task setup ->
Directory taskCache = candidate.layout.projectDirectory.dir(".gradle/iris-lanes/${buildLane}/caches/paperweight/taskCache")
setup.mappedServerJar.set(taskCache.file('mappedServerJar.jar'))
setup.reobfMappings.set(taskCache.file('reobfMappings.tiny'))
}
}
}