137 lines
4.1 KiB
Groovy
137 lines
4.1 KiB
Groovy
plugins {
|
|
id 'java'
|
|
id 'maven-publish'
|
|
id 'signing'
|
|
}
|
|
|
|
version = project.mod_version
|
|
group = project.maven_group
|
|
|
|
base {
|
|
archivesName = project.maven_artifact
|
|
}
|
|
|
|
repositories {
|
|
maven {
|
|
name = 'Fabric maven'
|
|
url = 'https://maven.fabricmc.net/'
|
|
}
|
|
maven {
|
|
name = 'NeoForge maven'
|
|
url = 'https://maven.neoforged.net/releases/'
|
|
}
|
|
maven {
|
|
name = "Forge maven"
|
|
url = "https://maven.minecraftforge.net/"
|
|
}
|
|
maven {
|
|
name = 'Minecraft maven'
|
|
url = 'https://libraries.minecraft.net/'
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
implementation("io.github.llamalad7:mixinextras-fabric:${project.mixinextras_version}")
|
|
compileOnly "net.fabricmc:fabric-loader:${project.fabric_version}"
|
|
//noinspection VulnerableLibrariesLocal
|
|
compileOnly "net.neoforged:neoforge:${project.neoforge_version}"
|
|
// istg why does forge need this many different dependencies to ensure getting all the needed classes,
|
|
// couldn't they use transitive dependencies like everyone?
|
|
compileOnly "net.minecraftforge:fmlloader:${project.forge_version}"
|
|
compileOnly "net.minecraftforge:forge:${project.forge_version}:universal"
|
|
compileOnly "net.minecraftforge:fmlcore:${project.forge_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.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/releases"
|
|
credentials(PasswordCredentials.class)
|
|
authentication {
|
|
it.create("basic", BasicAuthentication.class)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
signing {
|
|
sign publishing.publications.getByName("mavenJava")
|
|
}
|