|
| 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 architecturyVersion = /*property("architectury_version").toString()*/ "10.1.19" |
| 5 | +val kotlinxCoroutineVersion = property("kotlinx_coroutines_version").toString() |
| 6 | + |
| 7 | +architectury { |
| 8 | + platformSetupLoomIde() |
| 9 | + loader("quilt") |
| 10 | +} |
| 11 | + |
| 12 | +base.archivesName.set("${base.archivesName.get()}-quilt") |
| 13 | + |
| 14 | +loom { |
| 15 | + accessWidenerPath.set(project(":common").loom.accessWidenerPath) |
| 16 | + enableTransitiveAccessWideners.set(true) |
| 17 | + |
| 18 | + mods { |
| 19 | + register("quilt") { |
| 20 | + sourceSet("main", project(":quilt")) |
| 21 | + } |
| 22 | + } |
| 23 | +} |
| 24 | + |
| 25 | +repositories { |
| 26 | + maven("https://maven.quiltmc.org/repository/release/") |
| 27 | +} |
| 28 | + |
| 29 | +val common: Configuration by configurations.creating { |
| 30 | + configurations.compileClasspath.get().extendsFrom(this) |
| 31 | + configurations.runtimeClasspath.get().extendsFrom(this) |
| 32 | + configurations["developmentQuilt"].extendsFrom(this) |
| 33 | +} |
| 34 | + |
| 35 | +val includeLib: Configuration by configurations.creating |
| 36 | +val includeMod: Configuration by configurations.creating |
| 37 | + |
| 38 | +fun DependencyHandlerScope.setupConfigurations() { |
| 39 | + includeLib.dependencies.forEach { |
| 40 | + implementation(it) |
| 41 | + include(it) |
| 42 | + } |
| 43 | + |
| 44 | + includeMod.dependencies.forEach { |
| 45 | + modImplementation(it) |
| 46 | + include(it) |
| 47 | + } |
| 48 | +} |
| 49 | + |
| 50 | +dependencies { |
| 51 | + // Quilt Loader |
| 52 | + modImplementation("org.quiltmc:quilt-loader:$quiltVersion") |
| 53 | + |
| 54 | + // Quilted Fabric API |
| 55 | + modApi("org.quiltmc.quilted-fabric-api:quilted-fabric-api:$quiltedFabricVersion") |
| 56 | + |
| 57 | + // Remove the following line if you don't want to depend on the API |
| 58 | + modApi("dev.architectury:architectury-fabric:$architecturyVersion") { |
| 59 | + exclude("net.fabricmc") |
| 60 | + exclude("net.fabricmc.fabric-api") |
| 61 | + } |
| 62 | + |
| 63 | + // Kotlin for Quilt |
| 64 | + modImplementation("org.quiltmc.quilt-kotlin-libraries:quilt-kotlin-libraries:$kotlinQuiltVersion") |
| 65 | + |
| 66 | + // Add dependencies on the required Kotlin modules. |
| 67 | + includeLib("org.reflections:reflections:0.10.2") |
| 68 | + includeLib("org.javassist:javassist:3.27.0-GA") |
| 69 | + |
| 70 | + // Add mods to the mod jar |
| 71 | + // includeMod(...) |
| 72 | + |
| 73 | + |
| 74 | + // Common (Do not touch) |
| 75 | + common(project(":common", configuration = "namedElements")) { isTransitive = false } |
| 76 | + shadowCommon(project(":common", configuration = "transformProductionQuilt")) { isTransitive = false } |
| 77 | + |
| 78 | + // Finish the configuration |
| 79 | + setupConfigurations() |
| 80 | +} |
| 81 | + |
| 82 | +tasks { |
| 83 | + processResources { |
| 84 | + inputs.property("group", project.group) |
| 85 | + inputs.property("version", project.version) |
| 86 | + |
| 87 | + filesMatching("quilt.mod.json") { |
| 88 | + expand(getProperties()) |
| 89 | + expand(mutableMapOf( |
| 90 | + "group" to project.group, |
| 91 | + "version" to project.version |
| 92 | + )) |
| 93 | + } |
| 94 | + } |
| 95 | + |
| 96 | + remapJar { |
| 97 | + injectAccessWidener.set(true) |
| 98 | + } |
| 99 | +} |
0 commit comments