diff options
author | Linnea Gräf <nea@nea.moe> | 2024-09-12 13:34:11 +0200 |
---|---|---|
committer | Linnea Gräf <nea@nea.moe> | 2024-09-12 13:34:11 +0200 |
commit | 52623b715d395f65f96e09f4492285935b797b4b (patch) | |
tree | 1b96097a17dd9c81671478b11d127ce3278ddada /build.gradle.kts | |
parent | ab809e197f3e8c9a51745ee9510bc65c952c0cc8 (diff) | |
download | firmament-52623b715d395f65f96e09f4492285935b797b4b.tar.gz firmament-52623b715d395f65f96e09f4492285935b797b4b.tar.bz2 firmament-52623b715d395f65f96e09f4492285935b797b4b.zip |
Isolate CIT resewn compat
Diffstat (limited to 'build.gradle.kts')
-rw-r--r-- | build.gradle.kts | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/build.gradle.kts b/build.gradle.kts index cb31469..cdb97ff 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -94,6 +94,18 @@ kotlin { } } } +fun String.capitalizeN() = replaceFirstChar { it.uppercaseChar() } +fun innerJarsOf(name: String, dependency: Dependency): FileCollection { + val task = tasks.create("unpackInnerJarsFor${name.capitalizeN()}", InnerJarsUnpacker::class) { + this.inputJars.setFrom(files(configurations.detachedConfiguration(dependency))) + this.outputDir.set(layout.buildDirectory.dir("unpackedJars/$name").also { + it.get().asFile.mkdirs() + }) + } + println("Constructed innerJars task: ${project.files(task).toList()}") + return project.files(task) +} + val compatSourceSets: MutableSet<SourceSet> = mutableSetOf() fun createIsolatedSourceSet(name: String, path: String = "compat/$name"): SourceSet { val ss = sourceSets.create(name) { @@ -103,7 +115,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() } + val upperName = ss.name.capitalizeN() configurations { (ss.implementationConfigurationName) { extendsFrom(getByName(mainSS.compileClasspathConfigurationName)) @@ -140,6 +152,7 @@ val SourceSet.modImplementationConfigurationName }!!.sourceConfiguration val configuredSourceSet = createIsolatedSourceSet("configured") val sodiumSourceSet = createIsolatedSourceSet("sodium") +val citResewnSourceSet = createIsolatedSourceSet("citresewn") val shadowMe by configurations.creating { exclude(group = "org.jetbrains.kotlin") @@ -163,8 +176,6 @@ val nonModImplentation by configurations.creating { configurations.implementation.get().extendsFrom(this) } -loom { -} dependencies { // Minecraft dependencies @@ -208,6 +219,10 @@ dependencies { (configuredSourceSet.modImplementationConfigurationName)(libs.configured) (sodiumSourceSet.modImplementationConfigurationName)(libs.sodium) + (citResewnSourceSet.modImplementationConfigurationName)( + innerJarsOf("citresewn", dependencies.create(libs.citresewn.get())).asFileTree) + (citResewnSourceSet.modImplementationConfigurationName)(libs.citresewn) + // Actual dependencies modCompileOnly(libs.rei.api) { exclude(module = "architectury") @@ -227,7 +242,6 @@ dependencies { // Dev environment preinstalled mods modLocalRuntime(libs.bundles.runtime.required) modLocalRuntime(libs.bundles.runtime.optional) - modImplementation(modLocalRuntime(project.files("citresewn-defaults-1.2.0+1.21.jar"))!!) modLocalRuntime(libs.jarvis.fabric) transInclude.resolvedConfiguration.resolvedArtifacts.forEach { |