|
1 | 1 | plugins { |
2 | | - id 'fabric-loom' version '0.7.1' |
3 | | - id 'maven-publish' |
| 2 | + alias libs.plugins.fabric.loom |
| 3 | + id "maven-publish" |
4 | 4 | } |
5 | 5 |
|
6 | | -sourceCompatibility = JavaVersion.VERSION_1_8 |
7 | | -targetCompatibility = JavaVersion.VERSION_1_8 |
| 6 | +version = "$mod_version+$target_version" |
| 7 | +group = maven_group |
8 | 8 |
|
9 | | -archivesBaseName = project.archives_base_name |
10 | | -version = project.mod_version |
11 | | -group = project.maven_group |
| 9 | +base { |
| 10 | + archivesName = archives_name |
| 11 | +} |
12 | 12 |
|
13 | | -dependencies { |
14 | | - //to change the versions see the gradle.properties file |
15 | | - minecraft "com.mojang:minecraft:${project.minecraft_version}" |
16 | | - mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" |
17 | | - modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" |
| 13 | +repositories { |
| 14 | + maven { url "https://s01.oss.sonatype.org/content/repositories/snapshots" } |
| 15 | + maven { url "https://jitpack.io" } |
| 16 | +} |
18 | 17 |
|
19 | | - // Fabric API. This is technically optional, but you probably want it anyway. |
20 | | -// modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" |
| 18 | +loom { |
| 19 | + decompilers { |
| 20 | + vineflower { |
| 21 | + options.putAll(["mark-corresponding-synthetics": "1", "ind": " "]) |
| 22 | + } |
| 23 | + } |
| 24 | + mixin { |
| 25 | + useLegacyMixinAp = false |
| 26 | + } |
| 27 | +} |
21 | 28 |
|
22 | | - // PSA: Some older mods, compiled on Loom 0.2.1, might have outdated Maven POMs. |
23 | | - // You may need to force-disable transitiveness on them. |
| 29 | +dependencies { |
| 30 | + minecraft libs.minecraft |
| 31 | + mappings variantOf(libs.yarn.mappings) { classifier "v2" } |
| 32 | + modImplementation libs.fabric.loader |
| 33 | + vineflowerDecompilerClasspath libs.vineflower |
24 | 34 | } |
25 | 35 |
|
26 | 36 | processResources { |
27 | | - inputs.property "version", project.version |
28 | | - filteringCharset "UTF-8" |
29 | | - |
30 | | - filesMatching("fabric.mod.json") { |
31 | | - expand "version": project.version |
| 37 | + filesMatching "fabric.mod.json", { |
| 38 | + expand "version": version |
32 | 39 | } |
33 | 40 | } |
34 | 41 |
|
35 | | -// ensure that the encoding is set to UTF-8, no matter what the system default is |
36 | | -// this fixes some edge cases with special characters not displaying correctly |
37 | | -// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html |
38 | | -tasks.withType(JavaCompile) { |
39 | | - options.encoding = "UTF-8" |
| 42 | +tasks.withType(JavaCompile).configureEach { |
| 43 | + it.options.encoding = "UTF-8" |
| 44 | + if (JavaVersion.current().isJava9Compatible()) it.options.release.set(8) |
40 | 45 | } |
41 | 46 |
|
42 | | -// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task |
43 | | -// if it is present. |
44 | | -// If you remove this task, sources will not be generated. |
45 | | -task sourcesJar(type: Jar, dependsOn: classes) { |
46 | | - classifier = "sources" |
47 | | - from sourceSets.main.allSource |
| 47 | +java { |
| 48 | + sourceCompatibility = targetCompatibility = JavaVersion.VERSION_1_8 |
48 | 49 | } |
49 | 50 |
|
50 | 51 | jar { |
51 | 52 | from "LICENSE" |
52 | 53 | } |
53 | 54 |
|
54 | | -// configure the maven publication |
55 | 55 | publishing { |
56 | | - publications { |
57 | | - mavenJava(MavenPublication) { |
58 | | - // add all the jars that should be included when publishing to maven |
59 | | - artifact(remapJar) { |
60 | | - builtBy remapJar |
61 | | - } |
62 | | - artifact(sourcesJar) { |
63 | | - builtBy remapSourcesJar |
64 | | - } |
65 | | - } |
66 | | - } |
67 | | - |
68 | | - // select the repositories you want to publish to |
69 | | - repositories { |
70 | | - // uncomment to publish to the local maven |
71 | | - // mavenLocal() |
| 56 | + publications.create("mavenJava", MavenPublication) { |
| 57 | + from components.java |
72 | 58 | } |
| 59 | + repositories {} |
73 | 60 | } |
0 commit comments