115 lines
3.3 KiB
Groovy
115 lines
3.3 KiB
Groovy
plugins {
|
|
id 'fabric-loom' version '1.17-SNAPSHOT'
|
|
id 'maven-publish'
|
|
id 'signing'
|
|
}
|
|
|
|
version = project.mod_version
|
|
group = project.maven_group
|
|
|
|
base {
|
|
archivesName = project.maven_artifact
|
|
}
|
|
|
|
repositories {
|
|
}
|
|
|
|
dependencies {
|
|
minecraft "com.mojang:minecraft:${project.minecraft_version}"
|
|
mappings loom.officialMojangMappings()
|
|
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
|
|
}
|
|
|
|
def targetJavaVersion = 17
|
|
tasks.withType(JavaCompile).configureEach {
|
|
it.options.encoding = "UTF-8"
|
|
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
|
|
it.options.release.set(targetJavaVersion)
|
|
}
|
|
}
|
|
|
|
processResources {
|
|
outputs.upToDateWhen { false }
|
|
|
|
inputs.property "version", project.version
|
|
inputs.property "java_version", targetJavaVersion
|
|
|
|
filteringCharset "UTF-8"
|
|
|
|
filesMatching("fabric.mod.json") {
|
|
expand inputs.properties
|
|
}
|
|
}
|
|
|
|
java {
|
|
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
|
|
if (JavaVersion.current() < javaVersion) {
|
|
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
|
|
}
|
|
withSourcesJar()
|
|
}
|
|
|
|
jar {
|
|
from("LICENSE") {
|
|
rename { "${it}_${project.maven_artifact}" }
|
|
}
|
|
}
|
|
|
|
publishing {
|
|
publications {
|
|
create("mavenJava", MavenPublication) {
|
|
from components.java
|
|
|
|
it.artifactId = project.maven_artifact
|
|
it.version = "${project.mod_version}-${project.minecraft_version}"
|
|
|
|
pom {
|
|
packaging = "jar"
|
|
inceptionYear = java.time.LocalDateTime.now().year.toString()
|
|
licenses {
|
|
name = "GNU Lesser General Public License, Version 3"
|
|
url = "https://opensource.org/license/lgpl-3.0"
|
|
}
|
|
developers {
|
|
developer {
|
|
id = "nerjal"
|
|
name = "Nerjal Nosk"
|
|
email = "nosk.nerjal@gmx.com"
|
|
url = "https://nerjal.com"
|
|
roles = [ "author", "developer" ]
|
|
timezone = "France/Paris"
|
|
}
|
|
}
|
|
scm {
|
|
connection = "scm:git:git://codeberg.org/NerjalNosk/modding-utils.git"
|
|
developerConnection = "sec:git:ssh://codeberg.org/NerjalNosk/modding-utils.git"
|
|
url = "https://codeberg.org/NerjalNosk/modding-utils"
|
|
tag = "main"
|
|
}
|
|
it.withXml {xml->
|
|
def props = xml.asNode().get("properties") ?: xml.asNode().appendNode("properties")
|
|
props.appendNode("project.build.sourceEncoding", "UTF-8")
|
|
props.appendNode("project.build.outputEncoding", "UTF-8")
|
|
props.appendNode("maven.compiler.source", targetJavaVersion)
|
|
props.appendNode("maven.compiler.target", targetJavaVersion)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
repositories {
|
|
maven {
|
|
name = "Nerjal"
|
|
url = "https://maven.nerjal.com/snapshots"
|
|
credentials(PasswordCredentials.class)
|
|
authentication {
|
|
it.create("basic", BasicAuthentication.class)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
signing {
|
|
sign publishing.publications.getByName("mavenJava")
|
|
}
|