diff --git a/build.gradle b/build.gradle index f4b664a..fb9350a 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,6 @@ plugins { - id 'fabric-loom' version '0.4-SNAPSHOT' + id 'fabric-loom' version '0.5-SNAPSHOT' + id 'maven-publish' } sourceCompatibility = 1.8 @@ -19,7 +20,7 @@ repositories { dependencies { minecraft "com.mojang:minecraft:${project.minecraft_version}" - mappings "net.fabricmc:yarn:${project.minecraft_version}+build.${project.yarn_build}" + mappings "net.fabricmc:yarn:${project.yarn_build}:v2" modApi "net.fabricmc:fabric-loader:${project.loader_version}" modApi "net.fabricmc.fabric-api:fabric-api:${project.api_version}" @@ -31,18 +32,60 @@ dependencies { } } -idea { - module { - inheritOutputDirs = false - outputDir = compileJava.destinationDir - testOutputDir = compileTestJava.destinationDir +processResources { + inputs.property "version", project.version + + filesMatching("fabric.mod.json") { + expand "version": project.version + } +} + +tasks.withType(JavaCompile).configureEach { + // 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 + // If Javadoc is generated, this must be specified in that task too. + it.options.encoding = "UTF-8" + + // The Minecraft launcher currently installs Java 8 for users, so your mod probably wants to target Java 8 too + // JDK 9 introduced a new way of specifying this that will make sure no newer classes or methods are used. + // We'll use that if it's available, but otherwise we'll use the older option. + def targetVersion = 8 + if (JavaVersion.current().isJava9Compatible()) { + it.options.release = targetVersion } } -// 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") { + 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 + } + } + } + + // Select the repositories you want to publish to + // To publish to maven local, no extra repositories are necessary. Just use the task `publishToMavenLocal`. + repositories { + // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. + } +} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 0bcef8c..126c183 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,10 +4,10 @@ org.gradle.jvmargs=-Xmx1G auto_config_version=3.3.1 mod_menu_version=1.14+ -minecraft_version=1.16.3 -loader_version=0.10.0+build.208 -api_version=0.27.1+1.16 -yarn_build=47:v2 +minecraft_version=1.16.4 +loader_version=0.10.6+build.214 +api_version=0.25.1+build.416-1.16 +yarn_build=1.16.4+build.6 -version=1.2.0 +version=1.2.1 modid=snowdrift diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index e0b3fb8..ae92376 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-bin.zip zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists +zipStorePath=wrapper/dists \ No newline at end of file