|
| 1 | +val quiltVersion = property("quilt_version").toString() |
| 2 | +val quiltedFabricVersion = property("quilted_fabric_version").toString() |
| 3 | +val kotlinQuiltVersion = property("kotlin_quilt_version").toString() |
| 4 | +val kotlinxCoroutineVersion = property("kotlinx_coroutines_version").toString() |
| 5 | + |
| 6 | +base.archivesName.set("${base.archivesName.get()}-quilt") |
| 7 | + |
| 8 | +architectury { |
| 9 | + platformSetupLoomIde() |
| 10 | + loader("quilt") |
| 11 | +} |
| 12 | + |
| 13 | +loom { |
| 14 | + accessWidenerPath = project(":common").loom.accessWidenerPath |
| 15 | +} |
| 16 | + |
| 17 | +repositories { |
| 18 | + maven("https://maven.quiltmc.org/repository/release/") |
| 19 | +} |
| 20 | + |
| 21 | +val common: Configuration by configurations.creating { |
| 22 | + configurations.compileClasspath.get().extendsFrom(this) |
| 23 | + configurations.runtimeClasspath.get().extendsFrom(this) |
| 24 | + configurations["developmentQuilt"].extendsFrom(this) |
| 25 | +} |
| 26 | + |
| 27 | +val includeLib: Configuration by configurations.creating |
| 28 | +val includeMod: Configuration by configurations.creating |
| 29 | +val shadowBundle: Configuration by configurations.creating { |
| 30 | + isCanBeResolved = true |
| 31 | + isCanBeConsumed = false |
| 32 | +} |
| 33 | + |
| 34 | +fun DependencyHandlerScope.setupConfigurations() { |
| 35 | + includeLib.dependencies.forEach { |
| 36 | + implementation(it) |
| 37 | + include(it) |
| 38 | + } |
| 39 | + |
| 40 | + includeMod.dependencies.forEach { |
| 41 | + modImplementation(it) |
| 42 | + include(it) |
| 43 | + } |
| 44 | + |
| 45 | + shadowBundle.dependencies.forEach { |
| 46 | + shadowCommon(it) |
| 47 | + shadow(it) |
| 48 | + } |
| 49 | +} |
| 50 | + |
| 51 | +dependencies { |
| 52 | + // Quilt Loader |
| 53 | + modImplementation("org.quiltmc:quilt-loader:$quiltVersion") |
| 54 | + |
| 55 | + // Quilted Fabric API |
| 56 | + modImplementation("org.quiltmc.quilted-fabric-api:quilted-fabric-api:$quiltedFabricVersion") |
| 57 | + |
| 58 | + // Add dependencies on the required Kotlin modules. |
| 59 | + includeLib("org.reflections:reflections:0.10.2") |
| 60 | + includeLib("org.javassist:javassist:3.28.0-GA") |
| 61 | + |
| 62 | + // Add mods to the mod jar |
| 63 | + includeMod("org.quiltmc.quilt-kotlin-libraries:quilt-kotlin-libraries:$kotlinQuiltVersion") { |
| 64 | + // Exclude fabric |
| 65 | + exclude("net.fabricmc") |
| 66 | + exclude("net.fabricmc.fabric-api") |
| 67 | + } |
| 68 | + |
| 69 | + |
| 70 | + // Common (Do not touch) |
| 71 | + common(project(path = ":common", configuration = "namedElements")) { isTransitive = false } |
| 72 | + shadowBundle(project(path = ":common", configuration = "transformProductionQuilt")) |
| 73 | + |
| 74 | + // Finish the configuration |
| 75 | + setupConfigurations() |
| 76 | +} |
| 77 | + |
| 78 | +tasks { |
| 79 | + remapJar { |
| 80 | + injectAccessWidener = true |
| 81 | + } |
| 82 | + |
| 83 | + processResources { |
| 84 | + filesMatching("quilt.mod.json") { |
| 85 | + expand(project(":common").properties) |
| 86 | + } |
| 87 | + } |
| 88 | +} |
0 commit comments