summaryrefslogtreecommitdiff
path: root/build.gradle
diff options
context:
space:
mode:
authorKeuin <[email protected]>2022-01-04 19:09:33 +0800
committerKeuin <[email protected]>2022-01-04 19:18:44 +0800
commit83b689216daf35d3da8f33be9a62c46403a577e5 (patch)
tree692d558c4d02400e03142365886c01b0edc23480 /build.gradle
parent7ca4ac1080d8dd896f16215bda1639c4bf516dcd (diff)
Make it compile for Minecraft 1.18.
Diffstat (limited to 'build.gradle')
-rw-r--r--build.gradle52
1 files changed, 21 insertions, 31 deletions
diff --git a/build.gradle b/build.gradle
index eff7f20..c71ec07 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,10 +1,10 @@
plugins {
- id 'fabric-loom' version '0.5-SNAPSHOT'
+ id 'fabric-loom' version '0.10-SNAPSHOT'
id 'maven-publish'
}
-sourceCompatibility = JavaVersion.VERSION_1_8
-targetCompatibility = JavaVersion.VERSION_1_8
+sourceCompatibility = JavaVersion.VERSION_17
+targetCompatibility = JavaVersion.VERSION_17
archivesBaseName = project.archives_base_name
version = project.mod_version + "_mc" + project.minecraft_version
@@ -28,52 +28,42 @@ dependencies {
processResources {
inputs.property "version", project.version
- from(sourceSets.main.resources.srcDirs) {
- include "fabric.mod.json"
+ filesMatching("fabric.mod.json") {
expand "version": project.version
}
-
- from(sourceSets.main.resources.srcDirs) {
- exclude "fabric.mod.json"
- }
}
-// ensure that the encoding is set to UTF-8, no matter what the system default is
-// this fixes some edge cases with special characters not displaying correctly
-// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
-tasks.withType(JavaCompile) {
- options.encoding = "UTF-8"
+tasks.withType(JavaCompile).configureEach {
+ // Minecraft 1.18 (1.18-pre2) upwards uses Java 17.
+ it.options.release = 17
}
-// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
-// if it is present.
-// If you remove this task, sources will not be generated.
-task sourcesJar(type: Jar, dependsOn: classes) {
- classifier = "sources"
- from sourceSets.main.allSource
+java {
+ // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
+ // if it is present.
+ // If you remove this line, sources will not be generated.
+ withSourcesJar()
}
jar {
- from "LICENSE"
+ from("LICENSE") {
+ rename { "${it}_${project.archivesBaseName}"}
+ }
}
// configure the maven publication
publishing {
publications {
mavenJava(MavenPublication) {
- // add all the jars that should be included when publishing to maven
- artifact(remapJar) {
- builtBy remapJar
- }
- artifact(sourcesJar) {
- builtBy remapSourcesJar
- }
+ from components.java
}
}
- // select the repositories you want to publish to
+ // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
- // uncomment to publish to the local maven
- // mavenLocal()
+ // 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.
}
}