|
1 | 1 | plugins { |
| 2 | + id 'java' |
2 | 3 | id 'fabric-loom' version '1.5-SNAPSHOT' |
3 | | - id 'maven-publish' |
4 | 4 | } |
5 | 5 |
|
6 | | -sourceCompatibility = JavaVersion.VERSION_17 |
7 | | -targetCompatibility = JavaVersion.VERSION_17 |
8 | | - |
9 | | -archivesBaseName = project.archives_base_name |
10 | | -version = project.mod_version |
11 | | -group = project.maven_group |
12 | | - |
13 | 6 | dependencies { |
14 | | - // To change the versions see the gradle.properties file |
15 | 7 | minecraft "com.mojang:minecraft:${project.minecraft_version}" |
16 | 8 | mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" |
17 | 9 | modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" |
18 | | - include(implementation(annotationProcessor("io.github.llamalad7:mixinextras-fabric:${project.mixinextras_version}"))) |
19 | 10 | } |
20 | 11 |
|
| 12 | +version = "${project.mod_version}+${project.minecraft_version}" |
| 13 | + |
21 | 14 | processResources { |
22 | 15 | inputs.property "version", project.version |
23 | 16 |
|
24 | 17 | filesMatching("fabric.mod.json") { |
25 | | - expand "version": project.version |
| 18 | + expand "mod_version": project.version |
26 | 19 | } |
27 | | -} |
28 | 20 |
|
29 | | -tasks.withType(JavaCompile).configureEach { |
30 | | - // ensure that the encoding is set to UTF-8, no matter what the system default is |
31 | | - // this fixes some edge cases with special characters not displaying correctly |
32 | | - // see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html |
33 | | - // If Javadoc is generated, this must be specified in that task too. |
34 | | - it.options.encoding = "UTF-8" |
35 | | - |
36 | | - // The Minecraft launcher currently installs Java 8 for users, so your mod probably wants to target Java 8 too |
37 | | - // JDK 9 introduced a new way of specifying this that will make sure no newer classes or methods are used. |
38 | | - // We'll use that if it's available, but otherwise we'll use the older option. |
39 | | - def targetVersion = 17 |
40 | | - if (JavaVersion.current().isJava9Compatible()) { |
41 | | - it.options.release = targetVersion |
| 21 | + filesMatching("*.mixins.json") { |
| 22 | + expand "java_version": project.java_version |
42 | 23 | } |
43 | 24 | } |
44 | 25 |
|
45 | 26 | java { |
46 | | - // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task |
47 | | - // if it is present. |
48 | | - // If you remove this line, sources will not be generated. |
49 | | - withSourcesJar() |
| 27 | + sourceCompatibility = JavaVersion.toVersion(project.java_version) |
| 28 | + targetCompatibility = JavaVersion.toVersion(project.java_version) |
50 | 29 | } |
51 | 30 |
|
52 | | -jar { |
53 | | - from("LICENSE") { |
54 | | - rename { "${it}_${project.archivesBaseName}"} |
55 | | - } |
56 | | -} |
57 | | - |
58 | | -// configure the maven publication |
59 | | -publishing { |
60 | | - publications { |
61 | | - mavenJava(MavenPublication) { |
62 | | - // add all the jars that should be included when publishing to maven |
63 | | - artifact(remapJar) { |
64 | | - builtBy remapJar |
65 | | - } |
66 | | - artifact(sourcesJar) { |
67 | | - builtBy remapSourcesJar |
68 | | - } |
69 | | - } |
70 | | - } |
71 | | - |
72 | | - // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. |
73 | | - repositories { |
74 | | - // Add repositories to publish to here. |
75 | | - // Notice: This block does NOT have the same function as the block in the top level. |
76 | | - // The repositories here will be used for publishing your artifact, not for |
77 | | - // retrieving dependencies. |
78 | | - } |
| 31 | +tasks.withType(JavaCompile).configureEach { |
| 32 | + it.options.release = project.java_version.toInteger() |
79 | 33 | } |
0 commit comments