plugins { id 'fabric-loom' version '1.7-SNAPSHOT' id "io.github.goooler.shadow" version "8.1.8" id 'io.freefair.lombok' version "8.6" id 'maven-publish' } version = project.mod_version group = project.maven_group base { archivesName = project.archives_base_name } allprojects { apply plugin: 'fabric-loom' apply plugin: 'io.freefair.lombok' apply plugin: 'maven-publish' repositories { mavenCentral() maven { url = 'https://maven.fabricmc.net/' } maven { url = 'https://maven.parchmentmc.org' } gradlePluginPortal() } dependencies { minecraft "com.mojang:minecraft:${project.minecraft_version}" mappings loom.layered() { officialMojangMappings() parchment "org.parchmentmc.data:parchment-${rootProject.parchment_version}@zip" mappings new File(rootProject.rootDir as File, "mcgel-mappings.tiny") } modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_api_version}" implementation "blue.endless:jankson:${jankson_version}" include(implementation(annotationProcessor("io.github.llamalad7:mixinextras-fabric:0.4.0"))) } idea.module.excludeDirs += project.file "run" // "borrowed" from https://gist.github.com/EmmaTheMartian/9ffb0c1a9557b5f4734e26fea05ca4c6#file-build-gradle-kts-L51 loom.runs.configureEach { vmArg("-Dfabric.log.level=debug") vmArg("-Dmixin.debug.export=true") // https://github.com/JetBrains/JetBrainsRuntime/releases/tag/jbr-release-21.0.3b509.4 vmArg("-XX:+AllowEnhancedClassRedefinition") } } subprojects { dependencies { include(modImplementation(rootProject)) } tasks.processIncludeJars.dependsOn rootProject.tasks.build tasks.processIncludeJars.mustRunAfter rootProject.tasks.shadowJar tasks.runClient.dependsOn rootProject.tasks.build tasks.runServer.dependsOn rootProject.tasks.build } shadowJar { minimize() dependencies { include(dependency("blue.endless:jankson:${jankson_version}")) } exclude "mappings/**" relocate("blue.endless.jankson", "me.thosea.mcgel.libs.jankson") archiveFileName = "mcgel-${version}.jar" // overwrite old jar tasks.build.finalizedBy tasks.shadowJar tasks.shadowJar.outputs.upToDateWhen { false } } dependencies { testImplementation 'org.junit.jupiter:junit-jupiter:5.7.1' testRuntimeOnly 'org.junit.platform:junit-platform-launcher:1.10.1' testImplementation "org.mockito:mockito-core:5.11.0" } tasks.named('test', Test) { useJUnitPlatform() maxHeapSize = '2G' maxParallelForks = 2 testLogging { events "passed" } } processResources { inputs.property "version", project.version filesMatching("fabric.mod.json") { expand "version": project.version } } fabricApi { configureDataGeneration() } java { withSourcesJar() sourceCompatibility = JavaVersion.VERSION_21 targetCompatibility = JavaVersion.VERSION_21 } jar { from("LICENSE") { rename { "${it}_${project.base.archivesName.get()}" } } } idea.module { def exclude = [ ".github", "gradle", // dirs "gradlew", "gradlew.bat" // files ] exclude.forEach { excludeDirs += file(it) } } //TODO // configure the maven publication publishing { publications { create("mavenJava", MavenPublication) { artifactId = project.archives_base_name from components.java } } // 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. // Notice: This block does NOT have the same function as the block in the top level. // The repositories here will be used for publishing your artifact, not for // retrieving dependencies. } }