Adjust build.gradle code style, use minecraft_version property in modrinth publish
This commit is contained in:
parent
2806a25203
commit
8e8753da68
1 changed files with 18 additions and 15 deletions
33
build.gradle
33
build.gradle
|
@ -41,40 +41,40 @@ dependencies {
|
||||||
}
|
}
|
||||||
|
|
||||||
processResources {
|
processResources {
|
||||||
inputs.property "version", project.version
|
inputs.property 'version', project.version
|
||||||
duplicatesStrategy = DuplicatesStrategy.INCLUDE
|
duplicatesStrategy = DuplicatesStrategy.INCLUDE
|
||||||
|
|
||||||
from(sourceSets.main.resources.srcDirs) {
|
from(sourceSets.main.resources.srcDirs) {
|
||||||
include "fabric.mod.json"
|
include 'fabric.mod.json'
|
||||||
expand "version": project.version
|
expand 'version': project.version
|
||||||
}
|
}
|
||||||
|
|
||||||
from(sourceSets.main.resources.srcDirs) {
|
from(sourceSets.main.resources.srcDirs) {
|
||||||
exclude "fabric.mod.json"
|
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
|
||||||
// this fixes some edge cases with special characters not displaying correctly
|
// 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
|
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
|
||||||
tasks.withType(JavaCompile) {
|
tasks.withType(JavaCompile).configureEach {
|
||||||
options.encoding = "UTF-8"
|
options.encoding = "UTF-8"
|
||||||
}
|
}
|
||||||
|
|
||||||
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
|
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
|
||||||
// if it is present.
|
// if it is present.
|
||||||
// If you remove this task, sources will not be generated.
|
// If you remove this task, sources will not be generated.
|
||||||
task sourcesJar(type: Jar, dependsOn: classes) {
|
tasks.register('sourcesJar', Jar) {
|
||||||
classifier = "sources"
|
dependsOn classes
|
||||||
from sourceSets.main.allSource
|
from sourceSets.main.allSource
|
||||||
}
|
}
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
from "LICENSE"
|
from 'LICENSE'
|
||||||
}
|
}
|
||||||
|
|
||||||
shadowJar {
|
shadowJar {
|
||||||
archiveClassifier = "shaded-dev"
|
archiveClassifier = 'shaded-dev'
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
include dependency("io.prometheus:simpleclient:${project.prometheus_version}")
|
include dependency("io.prometheus:simpleclient:${project.prometheus_version}")
|
||||||
|
@ -83,21 +83,24 @@ shadowJar {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
task remapShadowJar(type: RemapJarTask, dependsOn: shadowJar) {
|
tasks.register('remapShadowJar', RemapJarTask) {
|
||||||
|
dependsOn shadowJar
|
||||||
input = shadowJar.archiveFile
|
input = shadowJar.archiveFile
|
||||||
archiveFileName = shadowJar.archiveFileName.get().replaceAll("-shaded-dev\\.jar\$", ".jar")
|
archiveFileName = shadowJar.archiveFileName.get().replaceAll('-shaded-dev\\.jar\$', '.jar')
|
||||||
addNestedDependencies = true
|
addNestedDependencies = true
|
||||||
}
|
}
|
||||||
|
|
||||||
assemble.dependsOn(remapShadowJar)
|
assemble.dependsOn(remapShadowJar)
|
||||||
|
|
||||||
task publishModrinth(type: TaskModrinthUpload, dependsOn: remapShadowJar) {
|
tasks.register('publishModrinth', TaskModrinthUpload) {
|
||||||
onlyIf { System.getenv("MODRINTH_TOKEN") }
|
dependsOn remapShadowJar
|
||||||
|
onlyIf { System.getenv('MODRINTH_TOKEN') }
|
||||||
|
|
||||||
token = System.getenv("MODRINTH_TOKEN")
|
token = System.getenv('MODRINTH_TOKEN')
|
||||||
projectId = 'dbVXHSlv'
|
projectId = 'dbVXHSlv'
|
||||||
versionNumber = project.mod_version
|
versionNumber = project.mod_version
|
||||||
uploadFile = remapShadowJar
|
uploadFile = remapShadowJar
|
||||||
addGameVersion("1.19.3")
|
|
||||||
|
addGameVersion((String) project.minecraft_version)
|
||||||
addLoader('fabric')
|
addLoader('fabric')
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue