From 5ed74f2df49c93ed1617520a935078b59ad7e195 Mon Sep 17 00:00:00 2001 From: Linnea Gräf Date: Sun, 1 Sep 2024 22:21:19 +0200 Subject: Add per compat project event listeners [no changelog] --- build.gradle.kts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'build.gradle.kts') diff --git a/build.gradle.kts b/build.gradle.kts index 90eb334..1df163e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -6,10 +6,11 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ +import com.google.devtools.ksp.gradle.KspTaskJvm import moe.nea.licenseextractificator.LicenseDiscoveryTask import net.fabricmc.loom.LoomGradleExtension -import org.gradle.internal.extensions.stdlib.capitalized import org.jetbrains.kotlin.gradle.dsl.JvmTarget +import org.jetbrains.kotlin.gradle.plugin.SubpluginOption import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { @@ -102,6 +103,7 @@ fun createIsolatedSourceSet(name: String, path: String = "compat/$name"): Source compatSourceSets.add(ss) loom.createRemapConfigurations(ss) val mainSS = sourceSets.main.get() + val upperName = ss.name.replaceFirstChar { it.uppercaseChar() } configurations { (ss.implementationConfigurationName) { extendsFrom(getByName(mainSS.compileClasspathConfigurationName)) @@ -112,10 +114,15 @@ fun createIsolatedSourceSet(name: String, path: String = "compat/$name"): Source (mainSS.runtimeOnlyConfigurationName) { extendsFrom(getByName(ss.runtimeClasspathConfigurationName)) } - ("ksp" + ss.name.replaceFirstChar { it.uppercaseChar() }) { + ("ksp$upperName") { extendsFrom(ksp.get()) } } + afterEvaluate { + tasks.named("ksp${upperName}Kotlin", KspTaskJvm::class) { + this.options.add(SubpluginOption("apoption", "firmament.sourceset=${ss.name}")) + } + } dependencies { runtimeOnly(ss.output) (ss.implementationConfigurationName)(sourceSets.main.get().output) -- cgit