Update gradle configuration

This commit is contained in:
BitHeaven 2025-01-27 10:05:23 +05:00
parent 019bce1c4b
commit 8346570549
5 changed files with 54 additions and 59 deletions

View File

@ -1,15 +1,17 @@
plugins {
id 'fabric-loom' version '1.7-SNAPSHOT'
alias libs.plugins.fabric.loom
id "io.github.p03w.machete" version "1.+" // automatic jar compressing on build
id 'maven-publish'
}
version = "${project.mod_version}-${project.minecraft_version}"
group = project.maven_group
base {
archivesName = project.archives_base_name
}
String buildNumber = System.getenv("RUN_NUMBER")
version = "${mod_version}+${libs.versions.minecraft.get()}" + (buildNumber != null ? "-${buildNumber}" : "")
group = project.maven_group
loom {
splitEnvironmentSourceSets()
@ -35,12 +37,13 @@ configurations {
dependencies {
// To change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
minecraft libs.minecraft
mappings variantOf(libs.yarn.mappings) { classifier 'v2' }
modImplementation libs.fabric.loader
// Fabric API. This is technically optional, but you probably want it anyway.
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
modImplementation libs.fabric.version
implementation group: 'org.yaml', name: 'snakeyaml', version: '2.3'
includedJars group: 'org.yaml', name: 'snakeyaml', version: '2.3'
@ -50,38 +53,22 @@ dependencies {
processResources {
inputs.property "version", project.version
inputs.property "minecraft_version", project.minecraft_version
inputs.property "loader_version", project.loader_version
filteringCharset "UTF-8"
filesMatching("fabric.mod.json") {
expand "version": project.version,
"minecraft_version": project.minecraft_version,
"loader_version": project.loader_version
expand "version": project.version
}
}
def targetJavaVersion = 21
tasks.withType(JavaCompile).configureEach {
// 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
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
// If Javadoc is generated, this must be specified in that task too.
it.options.encoding = "UTF-8"
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
it.options.release.set(targetJavaVersion)
}
it.options.release = 21
}
java {
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
if (JavaVersion.current() < javaVersion) {
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
}
// 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()
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
// withSourcesJar()
}
jar {
@ -94,21 +81,4 @@ jar {
it.isDirectory() ? it : zipTree(it)
}
}
}
// configure the maven publication
publishing {
publications {
create("mavenJava", MavenPublication) {
artifactId = project.archives_base_name
from components.java
}
}
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// Add repositories to publish to here.
// 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.
}
}
}

View File

@ -1,14 +1,9 @@
# Done to increase the memory available to gradle.
org.gradle.jvmargs=-Xmx1G
# Fabric Properties
# check these on https://modmuss50.me/fabric.html
minecraft_version=1.21.1
yarn_mappings=1.21.1+build.3
loader_version=0.16.5
# Mod Properties
mod_version=1.0.1
mod_version=1.0
maven_group=ru.bitheaven
archives_base_name=donpayinteg
# Dependencies
# check this on https://modmuss50.me/fabric.html
fabric_version=0.105.0+1.21.1
# Dependencies are managed at gradle/libs.versions.toml

23
gradle/libs.versions.toml Normal file
View File

@ -0,0 +1,23 @@
# The latest versions are available at https://quiltmc.org/en/usage/latest-versions
[versions]
minecraft = "1.21.4"
yarn_mappings="1.21.4+build.8"
fabric_loom = "1.9-SNAPSHOT"
# check these on https://modmuss50.me/fabric.html
fabric_loader = "0.16.10"
fabric_version="0.115.0+1.21.4"
[libraries]
minecraft = { module = "com.mojang:minecraft", version.ref = "minecraft" }
fabric_loader = { module = "net.fabricmc:fabric-loader", version.ref = "fabric_loader" }
fabric_version = { module = "net.fabricmc.fabric-api:fabric-api", version.ref = "fabric_version" }
yarn_mappings = { module = "net.fabricmc:yarn", version.ref = "yarn_mappings" }
# If you have multiple similar dependencies, you can declare a dependency bundle and reference it on the build script with "libs.bundles.example".
[bundles]
[plugins]
fabric_loom = { id = "fabric-loom", version.ref = "fabric_loom" }

View File

@ -1 +1,7 @@
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@ -4,6 +4,7 @@ pluginManagement {
name = 'Fabric'
url = 'https://maven.fabricmc.net/'
}
mavenCentral()
gradlePluginPortal()
}
}
}