Updated gradle script (might help with #376)

This commit is contained in:
Frank 2022-01-19 23:25:23 +01:00
parent 5d765d3877
commit 2892e6fa11

View file

@ -5,8 +5,6 @@ buildscript {
} }
plugins { plugins {
id 'idea'
id 'eclipse'
id 'fabric-loom' version "${loom_version}" id 'fabric-loom' version "${loom_version}"
id 'maven-publish' id 'maven-publish'
} }
@ -86,17 +84,11 @@ def useApi(String dep) {
} }
processResources { processResources {
inputs.property "version", project.version println "Version: ${project.version}"
duplicatesStrategy = 'WARN' inputs.property "version", project.version
filesMatching("fabric.mod.json") {
from(sourceSets.main.resources.srcDirs) { expand "version": project.version
include "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 // 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 // see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
tasks.withType(JavaCompile) { tasks.withType(JavaCompile) {
options.encoding = "UTF-8" options.encoding = "UTF-8"
it.options.release = 17
} }
javadoc { javadoc {
@ -123,6 +116,13 @@ task sourcesJar(type: Jar, dependsOn: classes) {
from sourceSets.main.allSource 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 { jar {
from "LICENSE" from "LICENSE"
} }
@ -159,21 +159,21 @@ task release(dependsOn: [remapJar, sourcesJar, javadocJar]) {
} }
// configure the maven publication // configure the maven publication
//publishing { publishing {
// publications { publications {
// mavenJava(MavenPublication) { mavenJava(MavenPublication) {
// artifact(remapJar) { artifact(remapJar) {
// builtBy remapJar builtBy remapJar
// } }
// artifact(sourcesJar) { artifact(sourcesJar) {
// builtBy remapSourcesJar builtBy remapSourcesJar
// } }
// } }
// } }
//
// // select the repositories you want to publish to // select the repositories you want to publish to
// repositories { repositories {
// // uncomment to publish to the local maven // uncomment to publish to the local maven
// // mavenLocal() // mavenLocal()
// } }
//} }