fix: Support Gradle isolated projects

This commit is contained in:
Siphalor committed 2026-10-19 20:36:38 +02:00
1 parent e335d0fd3e
commit cd8c3a9ce3
1 file changed
+5 -5
@@ -17,7 +17,7 @@ abstract class SmcmtkSettingsPlugin : Plugin<Settings> {
@get:Inject @get:Inject
protected abstract val objectFactory: ObjectFactory protected abstract val objectFactory: ObjectFactory
private val logger = lazy { Logging.getLogger(javaClass) } private val logger by lazy { Logging.getLogger(javaClass) }
override fun apply(settings: Settings) { override fun apply(settings: Settings) {
val gradleProperties = loadProperties(settings.rootDir.resolve("gradle.properties")) val gradleProperties = loadProperties(settings.rootDir.resolve("gradle.properties"))
@@ -39,7 +39,7 @@ abstract class SmcmtkSettingsPlugin : Plugin<Settings> {
} }
if (fabricLoomModule != null) { if (fabricLoomModule != null) {
logger.value.info("Choosing Fabric Loom $fabricLoomModule") logger.info("Choosing Fabric Loom $fabricLoomModule")
} }
settings.pluginManagement.plugins { settings.pluginManagement.plugins {
@@ -58,13 +58,13 @@ abstract class SmcmtkSettingsPlugin : Plugin<Settings> {
} }
} }
if (fabricLoom == "plain") { if (fabricLoom == "plain") {
settings.gradle.allprojects { project -> settings.gradle.lifecycle.beforeProject { project ->
project.extensions.findByType(ExtraPropertiesExtension::class.java)?.apply { project.extensions.findByType(ExtraPropertiesExtension::class.java)?.apply {
// Loom uses the same jar for both plugin variants (plain and remap) and tries to determine // Loom uses the same jar for both plugin variants (plain and remap) and tries to determine
// which one is in use by checking the plugin manager. // which one is in use by checking the plugin manager.
// This doesn't seem to work when using convention plugins, so we're forcing the remapping off here. // This doesn't seem to work when using convention plugins, so we're forcing the remapping off here.
project.extensions.extraProperties.set("fabric.loom.disableObfuscation", "true") set("fabric.loom.disableObfuscation", "true")
project.extensions.extraProperties.set("fabric.loom.dontRemap", "true") set("fabric.loom.dontRemap", "true")
} }
} }
} }