|
| 1 | +plugins { |
| 2 | + id 'fabric-loom' version '0.12-SNAPSHOT' |
| 3 | + id 'maven-publish' |
| 4 | +} |
| 5 | + |
| 6 | +version = project.mod_version |
| 7 | +group = project.maven_group |
| 8 | + |
| 9 | +repositories { |
| 10 | + // Add repositories to retrieve artifacts from in here. |
| 11 | + // You should only use this when depending on other mods because |
| 12 | + // Loom adds the essential maven repositories to download Minecraft and libraries from automatically. |
| 13 | + // See https://docs.gradle.org/current/userguide/declaring_repositories.html |
| 14 | + // for more information about repositories. |
| 15 | + |
| 16 | + maven { |
| 17 | + name "CurseMaven" |
| 18 | + url "https://cursemaven.com" |
| 19 | + content { |
| 20 | + includeGroup "curse.maven" |
| 21 | + } |
| 22 | + } |
| 23 | + |
| 24 | + maven { |
| 25 | + name "Modrinth" |
| 26 | + url "https://api.modrinth.com/maven" |
| 27 | + content { |
| 28 | + includeGroup "maven.modrinth" |
| 29 | + } |
| 30 | + } |
| 31 | + |
| 32 | + maven { |
| 33 | + name "Jitpack" |
| 34 | + url "https://jitpack.io" |
| 35 | + } |
| 36 | +} |
| 37 | + |
| 38 | +dependencies { |
| 39 | + // To change the versions see the gradle.properties file |
| 40 | + minecraft "com.mojang:minecraft:${project.minecraft_version}" |
| 41 | + mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" |
| 42 | + modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" |
| 43 | + modImplementation "net.fabricmc.fabric-api:fabric-api:0.57.0+1.19" |
| 44 | + |
| 45 | + // Only used so I actually have frames when testing. |
| 46 | + modRuntimeOnly "curse.maven:ferritecore-fabric-459857:3824694" |
| 47 | + modRuntimeOnly "maven.modrinth:lazydfu:0.1.3" |
| 48 | + modRuntimeOnly "maven.modrinth:lithium:mc1.19-0.8.0" |
| 49 | + modRuntimeOnly "maven.modrinth:starlight:1.1.1+1.19" |
| 50 | + modRuntimeOnly "maven.modrinth:sodium:mc1.19-0.4.2" |
| 51 | + |
| 52 | + // Added because otherwise Sodium physically will not function in testing. |
| 53 | + // I have no idea why. |
| 54 | + runtimeOnly 'org.joml:joml:1.10.4' |
| 55 | +} |
| 56 | + |
| 57 | +processResources { |
| 58 | + inputs.property "version", project.version |
| 59 | + filteringCharset "UTF-8" |
| 60 | + |
| 61 | + filesMatching("fabric.mod.json") { |
| 62 | + expand "version": project.version |
| 63 | + } |
| 64 | +} |
| 65 | + |
| 66 | +def targetJavaVersion = 17 |
| 67 | +tasks.withType(JavaCompile).configureEach { |
| 68 | + // ensure that the encoding is set to UTF-8, no matter what the system default is |
| 69 | + // this fixes some edge cases with special characters not displaying correctly |
| 70 | + // see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html |
| 71 | + // If Javadoc is generated, this must be specified in that task too. |
| 72 | + it.options.encoding = "UTF-8" |
| 73 | + if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) { |
| 74 | + it.options.release = targetJavaVersion |
| 75 | + } |
| 76 | +} |
| 77 | + |
| 78 | +java { |
| 79 | + def javaVersion = JavaVersion.toVersion(targetJavaVersion) |
| 80 | + if (JavaVersion.current() < javaVersion) { |
| 81 | + toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion) |
| 82 | + } |
| 83 | + archivesBaseName = project.archives_base_name |
| 84 | + // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task |
| 85 | + // if it is present. |
| 86 | + // If you remove this line, sources will not be generated. |
| 87 | + withSourcesJar() |
| 88 | +} |
| 89 | + |
| 90 | +jar { |
| 91 | + from("LICENSE") { |
| 92 | + rename { "${it}_${project.archivesBaseName}" } |
| 93 | + } |
| 94 | +} |
| 95 | + |
| 96 | +// configure the maven publication |
| 97 | +publishing { |
| 98 | + publications { |
| 99 | + mavenJava(MavenPublication) { |
| 100 | + from components.java |
| 101 | + } |
| 102 | + } |
| 103 | + |
| 104 | + // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. |
| 105 | + repositories { |
| 106 | + // Add repositories to publish to here. |
| 107 | + // Notice: This block does NOT have the same function as the block in the top level. |
| 108 | + // The repositories here will be used for publishing your artifact, not for |
| 109 | + // retrieving dependencies. |
| 110 | + } |
| 111 | +} |
0 commit comments