diff options
Diffstat (limited to 'quilt')
-rw-r--r-- | quilt/build.gradle.kts | 118 | ||||
-rw-r--r-- | quilt/gradle.properties | 1 | ||||
-rw-r--r-- | quilt/src/main/kotlin/net/examplemod/fabric/ExampleExpectPlatformImpl.kt | 13 | ||||
-rw-r--r-- | quilt/src/main/kotlin/net/examplemod/quilt/ExampleModQuilt.kt | 12 | ||||
-rw-r--r-- | quilt/src/main/resources/quilt.mod.json | 45 |
5 files changed, 189 insertions, 0 deletions
diff --git a/quilt/build.gradle.kts b/quilt/build.gradle.kts new file mode 100644 index 0000000..5f859c1 --- /dev/null +++ b/quilt/build.gradle.kts @@ -0,0 +1,118 @@ +plugins { + id("com.github.johnrengelman.shadow") version "7.1.2" +} + +repositories { + maven { url = uri("https://maven.quiltmc.org/repository/release/") } + mavenCentral() +} + +architectury { + platformSetupLoomIde() + loader("quilt") +} + +loom { + accessWidenerPath.set(project(":common").loom.accessWidenerPath) +} + +/** + * @see: https://docs.gradle.org/current/userguide/migrating_from_groovy_to_kotlin_dsl.html + * */ +val common: Configuration by configurations.creating +val shadowCommon: Configuration by configurations.creating // Don't use shadow from the shadow plugin because we don't want IDEA to index this. + +val developmentQuilt: Configuration = configurations.getByName("developmentQuilt") +configurations { + compileClasspath.get().extendsFrom(configurations["common"]) + runtimeClasspath.get().extendsFrom(configurations["common"]) + developmentQuilt.extendsFrom(configurations["common"]) +} + +dependencies { + modImplementation("org.quiltmc:quilt-loader:${rootProject.property("quilt_loader_version")}") + modApi("org.quiltmc.quilted-fabric-api:quilted-fabric-api:${rootProject.property("quilt_fabric_api_version")}") + // Remove the next few lines if you don't want to depend on the API + modApi("dev.architectury:architectury-fabric:${rootProject.property("architectury_version")}") { + // We must not pull Fabric Loader from Architectury Fabric + exclude(group = "net.fabricmc") + exclude(group = "net.fabricmc.fabric-api") + } + + common(project(":common", configuration = "namedElements")) { isTransitive = false } + shadowCommon(project(":common", configuration = "transformProductionQuilt")) { isTransitive = false } + common(kotlin("stdlib-jdk8")) +} + +val javaComponent = components.getByName("java", AdhocComponentWithVariants::class) +javaComponent.withVariantsFromConfiguration(configurations["sourcesElements"]) { + skip() +} + +tasks { + processResources { + inputs.property("group", rootProject.property("maven_group")) + inputs.property("version", project.version) + + filesMatching("quilt.mod.json") { + expand( + "group" to rootProject.property("maven_group"), + "version" to project.version + ) + } + } + + shadowJar { + exclude("architectury.common.json") + /** + * magic! + * groovy -> kotlin dsl + * [project.configurations.shadowCommon] -> listOf(project.configurations["shadowCommon"]) + * */ + configurations = listOf(project.configurations["shadowCommon"]) + archiveClassifier.set("dev-shadow") + } + + remapJar { + injectAccessWidener.set(true) + /** + * magic! + * groovy -> kotlin dsl + * shadowJar.archiveFile -> shadowJar.flatMap { it.archiveFile } + * */ + inputFile.set(shadowJar.flatMap { it.archiveFile }) + dependsOn(shadowJar) + /** + * affect suffix of build jar name + * if { archiveClassifier.set("quilt") } + * name will be examplemod-1.0.0-quilt.jar + */ + archiveClassifier.set("quilt") + } + + jar { + archiveClassifier.set("dev") + } + + + sourcesJar { + val commonSources = project(":common").tasks.getByName("sourcesJar", Jar::class) + dependsOn(commonSources) + from(commonSources.archiveFile.map { zipTree(it) }) + } + + + publishing { + publications { + create<MavenPublication>("mavenQuilt") { + artifactId = "${rootProject.property("archives_base_name")}-${project.name}" + from(javaComponent) + } + } + + // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. + repositories { + // Add repositories to publish to here. + } + } +}
\ No newline at end of file diff --git a/quilt/gradle.properties b/quilt/gradle.properties new file mode 100644 index 0000000..96758ce --- /dev/null +++ b/quilt/gradle.properties @@ -0,0 +1 @@ +loom.platform=quilt
\ No newline at end of file diff --git a/quilt/src/main/kotlin/net/examplemod/fabric/ExampleExpectPlatformImpl.kt b/quilt/src/main/kotlin/net/examplemod/fabric/ExampleExpectPlatformImpl.kt new file mode 100644 index 0000000..6f78162 --- /dev/null +++ b/quilt/src/main/kotlin/net/examplemod/fabric/ExampleExpectPlatformImpl.kt @@ -0,0 +1,13 @@ +package net.examplemod.fabric + +import org.quiltmc.loader.api.QuiltLoader +import java.nio.file.Path +import net.examplemod.ExampleExpectPlatform + +object ExampleExpectPlatformImpl { + /** + * This is our actual method to [ExampleExpectPlatform.getConfigDirectory]. + */ + @JvmStatic + fun getConfigDirectory(): Path = QuiltLoader.getConfigDir() +}
\ No newline at end of file diff --git a/quilt/src/main/kotlin/net/examplemod/quilt/ExampleModQuilt.kt b/quilt/src/main/kotlin/net/examplemod/quilt/ExampleModQuilt.kt new file mode 100644 index 0000000..94a36c9 --- /dev/null +++ b/quilt/src/main/kotlin/net/examplemod/quilt/ExampleModQuilt.kt @@ -0,0 +1,12 @@ +package net.examplemod.quilt + +import net.examplemod.ExampleMod.init +import org.quiltmc.loader.api.ModContainer +import org.quiltmc.qsl.base.api.entrypoint.ModInitializer + +@Suppress("unused") +class ExampleModQuilt : ModInitializer { + override fun onInitialize(mod: ModContainer) { + init() + } +}
\ No newline at end of file diff --git a/quilt/src/main/resources/quilt.mod.json b/quilt/src/main/resources/quilt.mod.json new file mode 100644 index 0000000..6cdf9ae --- /dev/null +++ b/quilt/src/main/resources/quilt.mod.json @@ -0,0 +1,45 @@ +{ + "schema_version": 1, + "mixins": [ + "notenoughupdates.mixins.json", + "notenoughupdates-common.mixins.json" + ], + "quilt_loader": { + "group": "${group}", + "id": "notenoughupdates", + "version": "${version}", + "name": "Not Enough Updates", + "description": "Not Enough Updates - A mod for Hypixel Skyblock", + "authors": ["nea89"], + "contact": { + "sources": "https://github.com/romangraef/TODO" + }, + "license": "LGPL-3.0", + "icon": "assets/notenoughupdates/icon.png", + "intermediate_mappings": "net.fabricmc:intermediary", + "environment": "*", + "entrypoints": { + "init": [ + "net.examplemod.quilt.ExampleModQuilt" + ] + }, + "depends": [ + { + "id": "quilt_loader", + "version": "*" + }, + { + "id": "quilt_base", + "version": "*" + }, + { + "id": "minecraft", + "version": ">=1.18.2" + }, + { + "id": "architectury", + "version": ">=4.2.50" + } + ] + } +} |