first test

This commit is contained in:
2026-01-08 23:51:21 +01:00
parent 156b8f17e3
commit 45e0df8b9e

View File

@@ -1,66 +1,87 @@
plugins { plugins {
id 'net.fabricmc.fabric-loom-remap' version "${loom_version}" id 'net.fabricmc.fabric-loom-remap' version "${loom_version}"
id 'dev.kikugie.stonecutter'
id 'maven-publish' id 'maven-publish'
} }
version = project.mod_version def modId = property('mod.id')
group = project.maven_group def modName = property('mod.name')
def modVersion = property('mod.version')
def modGroup = property('mod.group')
def modDescription = property('mod.description')
def modLicense = property('mod.license')
def modAuthor = property('mod.author')
def javaVersion = Integer.parseInt(property('java_version'))
def fabricLoaderVersion = property('deps.fabric_loader')
version = "${modVersion}+${stonecutter.current.version}"
group = modGroup
base { base {
archivesName = project.archives_base_name archivesName = modId
} }
repositories { repositories {
// Add repositories to retrieve artifacts from in here. // Loom provides Minecraft, mappings, and Fabric repositories.
// You should only use this when depending on other mods because
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
// for more information about repositories.
} }
loom { loom {
splitEnvironmentSourceSets() splitEnvironmentSourceSets()
mods { mods {
"template-mod" { "${modId}" {
sourceSet sourceSets.main sourceSet sourceSets.main
sourceSet sourceSets.client sourceSet sourceSets.client
} }
} }
if (stonecutter.current.isActive) {
runConfigs.all {
ideConfigGenerated = true
runDir "../../run"
}
}
} }
dependencies { dependencies {
// To change the versions see the gradle.properties file minecraft "com.mojang:minecraft:${stonecutter.current.version}"
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings loom.officialMojangMappings() mappings loom.officialMojangMappings()
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" modImplementation "net.fabricmc:fabric-loader:${property('deps.fabric_loader')}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${property('deps.fabric_api')}"
// Fabric API. This is technically optional, but you probably want it anyway.
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_api_version}"
} }
processResources { processResources {
inputs.property "version", project.version inputs.property "version", project.version
inputs.property "mod_id", modId
inputs.property "mod_name", modName
inputs.property "mod_description", modDescription
inputs.property "mod_license", modLicense
inputs.property "mod_author", modAuthor
inputs.property "minecraft_version", stonecutter.current.version
inputs.property "fabric_loader_version", fabricLoaderVersion
filesMatching("fabric.mod.json") { filesMatching("fabric.mod.json") {
expand "version": inputs.properties.version expand(
version: project.version,
mod_id: modId,
mod_name: modName,
mod_description: modDescription,
mod_license: modLicense,
mod_author: modAuthor,
minecraft_version: stonecutter.current.version,
fabric_loader_version: fabricLoaderVersion
)
} }
} }
tasks.withType(JavaCompile).configureEach { tasks.withType(JavaCompile).configureEach {
it.options.release = 21 options.release = javaVersion
} }
java { 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() withSourcesJar()
sourceCompatibility = JavaVersion.toVersion(javaVersion)
sourceCompatibility = JavaVersion.VERSION_21 targetCompatibility = JavaVersion.toVersion(javaVersion)
targetCompatibility = JavaVersion.VERSION_21
} }
jar { jar {
@@ -71,20 +92,15 @@ jar {
} }
} }
// configure the maven publication
publishing { publishing {
publications { publications {
create("mavenJava", MavenPublication) { create("mavenJava", MavenPublication) {
artifactId = project.archives_base_name artifactId = project.base.archivesName.get()
from components.java from components.java
} }
} }
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories { repositories {
// Add repositories to publish to here. // Configure publishing repositories here if needed.
// Notice: This block does NOT have the same function as the block in the top level.
// The repositories here will be used for publishing your artifact, not for
// retrieving dependencies.
} }
} }