|
1 | 1 | plugins { |
2 | | - id 'fabric-loom' version '1.0-SNAPSHOT' |
3 | | - id 'org.ajoberstar.grgit' version '4.1.0' |
| 2 | + alias libs.plugins.fabric.loom |
| 3 | + id "maven-publish" |
4 | 4 | } |
5 | 5 |
|
6 | | -sourceCompatibility = JavaVersion.VERSION_17 |
7 | | -targetCompatibility = JavaVersion.VERSION_17 |
| 6 | +version = "$mod_version+$target_version" |
| 7 | +group = maven_group |
8 | 8 |
|
9 | | -def getVersionMetadata() { |
10 | | - // CI builds version numbers |
11 | | - def build_id = System.getenv("RELEASE_TAG") |
12 | | - if (build_id != null) { |
13 | | - return build_id |
14 | | - } |
15 | | - |
16 | | - // Development builds |
17 | | - if (grgit == null) { |
18 | | - return "dev" |
19 | | - } |
20 | | - |
21 | | - // Named development builds |
22 | | - def id = grgit.head().abbreviatedId |
23 | | - if (!grgit.status().clean) { |
24 | | - id += "-dirty" |
25 | | - } |
| 9 | +base { |
| 10 | + archivesName = archives_name |
| 11 | +} |
26 | 12 |
|
27 | | - return "rev.${id}" |
| 13 | +repositories { |
| 14 | + maven { url "https://s01.oss.sonatype.org/content/repositories/snapshots" } |
| 15 | + maven { url "https://jitpack.io" } |
| 16 | + // flatDir { dirs "libs" } |
28 | 17 | } |
29 | 18 |
|
30 | | -archivesBaseName = "${project.mod_id}-${project.minecraft_version}" |
31 | | -version = "${getVersionMetadata()}" |
| 19 | +loom { |
| 20 | + decompilers { |
| 21 | + vineflower { |
| 22 | + options.putAll(["mark-corresponding-synthetics": "1", "ind": " "]) |
| 23 | + } |
| 24 | + } |
| 25 | + mixin { |
| 26 | + useLegacyMixinAp = false |
| 27 | + } |
| 28 | +} |
32 | 29 |
|
33 | 30 | dependencies { |
34 | | - minecraft "com.mojang:minecraft:${project.minecraft_version}" |
35 | | - mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" |
36 | | - modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" |
| 31 | + minecraft libs.minecraft |
| 32 | + mappings variantOf(libs.yarn.mappings) { classifier "v2" } |
| 33 | + modImplementation libs.fabric.loader |
| 34 | + vineflowerDecompilerClasspath libs.vineflower |
37 | 35 | } |
38 | 36 |
|
39 | 37 | processResources { |
40 | | - inputs.property "mod_id", project.mod_id |
41 | | - inputs.property "version", project.version |
42 | | - |
43 | | - filesMatching("fabric.mod.json") { |
44 | | - expand "mod_id": project.mod_id, "version": project.version |
45 | | - } |
| 38 | + filesMatching "fabric.mod.json", { |
| 39 | + expand "version": version |
| 40 | + } |
46 | 41 | } |
47 | 42 |
|
48 | 43 | tasks.withType(JavaCompile).configureEach { |
49 | | - it.options.release = 17 |
| 44 | + it.options.encoding = "UTF-8" |
| 45 | + if (JavaVersion.current().isJava9Compatible()) it.options.release.set(8) |
50 | 46 | } |
51 | 47 |
|
52 | 48 | java { |
53 | | - withSourcesJar() |
| 49 | + sourceCompatibility = targetCompatibility = JavaVersion.VERSION_1_8 |
54 | 50 | } |
55 | 51 |
|
56 | 52 | jar { |
57 | | - from("LICENSE") |
| 53 | + from "LICENSE" |
| 54 | +} |
| 55 | + |
| 56 | +publishing { |
| 57 | + publications.create("mavenJava", MavenPublication) { |
| 58 | + from components.java |
| 59 | + } |
| 60 | + repositories {} |
58 | 61 | } |
0 commit comments