From 2892e6fa11d1979df9c2f3350a265fca1edb9ab0 Mon Sep 17 00:00:00 2001 From: Frank Date: Wed, 19 Jan 2022 23:25:23 +0100 Subject: [PATCH] Updated gradle script (might help with #376) --- build.gradle | 62 ++++++++++++++++++++++++++-------------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/build.gradle b/build.gradle index 93c749ef..629e5698 100644 --- a/build.gradle +++ b/build.gradle @@ -5,8 +5,6 @@ buildscript { } plugins { - id 'idea' - id 'eclipse' id 'fabric-loom' version "${loom_version}" id 'maven-publish' } @@ -86,17 +84,11 @@ def useApi(String dep) { } processResources { - inputs.property "version", project.version - duplicatesStrategy = 'WARN' - - from(sourceSets.main.resources.srcDirs) { - include "fabric.mod.json" - expand "version": project.version - } - - from(sourceSets.main.resources.srcDirs) { - exclude "fabric.mod.json" - } + println "Version: ${project.version}" + inputs.property "version", project.version + filesMatching("fabric.mod.json") { + expand "version": project.version + } } // ensure that the encoding is set to UTF-8, no matter what the system default is @@ -104,6 +96,7 @@ processResources { // see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html tasks.withType(JavaCompile) { options.encoding = "UTF-8" + it.options.release = 17 } javadoc { @@ -123,6 +116,13 @@ task sourcesJar(type: Jar, dependsOn: classes) { 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" } @@ -159,21 +159,21 @@ task release(dependsOn: [remapJar, sourcesJar, javadocJar]) { } // configure the maven publication -//publishing { -// publications { -// mavenJava(MavenPublication) { -// artifact(remapJar) { -// builtBy remapJar -// } -// artifact(sourcesJar) { -// builtBy remapSourcesJar -// } -// } -// } -// -// // select the repositories you want to publish to -// repositories { -// // uncomment to publish to the local maven -// // mavenLocal() -// } -//} \ No newline at end of file +publishing { + publications { + mavenJava(MavenPublication) { + artifact(remapJar) { + builtBy remapJar + } + artifact(sourcesJar) { + builtBy remapSourcesJar + } + } + } + + // select the repositories you want to publish to + repositories { + // uncomment to publish to the local maven + // mavenLocal() + } +} \ No newline at end of file