cauldron-dyeing/build.gradle

99 lines
2.3 KiB
Groovy
Raw Normal View History

2022-01-04 12:23:14 -05:00
plugins {
2022-03-15 19:15:37 -05:00
id 'fabric-loom' version '0.11.+'
2022-06-07 19:34:48 -05:00
id 'io.github.juuxel.loom-quiltflower' version '1.7.+'
2022-03-15 19:50:02 -05:00
id 'org.quiltmc.quilt-mappings-on-loom' version '4.0.0'
2022-03-15 19:15:37 -05:00
id 'org.ajoberstar.grgit' version '5.0.0'
2022-01-04 12:23:14 -05:00
}
sourceCompatibility = '17'
targetCompatibility = '17'
archivesBaseName = project.archives_base_name
version = "${project.mod_version}+${getMetadata()}"
2022-01-04 12:23:14 -05:00
group = project.maven_group
repositories {
maven {
name = "Modrinth"
url = "https://api.modrinth.com/maven"
content {
includeGroup "maven.modrinth"
}
}
}
var apiModules = [
"fabric-api-base",
2022-03-15 19:15:37 -05:00
"fabric-networking-api-v1",
"fabric-object-builder-api-v1",
"fabric-registry-sync-v0"
]
2022-01-04 12:23:14 -05:00
dependencies {
// To change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${project.minecraft_version}"
2022-03-15 19:50:02 -05:00
mappings loom.layered {
2022-06-07 19:34:48 -05:00
addLayer quiltMappings.mappings("org.quiltmc:quilt-mappings:${project.minecraft_version}+build.${project.quilt_mappings}:v2")
2022-03-15 19:50:02 -05:00
}
2022-01-04 12:23:14 -05:00
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
// Fabric API
apiModules.forEach {
include modImplementation(fabricApi.module(it, project.fabric_version))
}
2022-01-04 12:23:14 -05:00
// Sodium
modCompileOnly "maven.modrinth:sodium:${project.sodium_version}"
}
processResources {
inputs.property 'version', project.version
filteringCharset 'UTF-8'
filesMatching('fabric.mod.json') {
expand 'version': project.version
}
}
tasks.withType(JavaCompile) {
it.options.encoding = 'UTF-8'
}
java {
withSourcesJar()
}
jar {
from('LICENSE') {
rename { "${it}_${project.archivesBaseName}"}
}
}
def getMetadata() {
def build_id = System.getenv("GITHUB_RUN_NUMBER")
2022-03-28 23:19:32 -05:00
def workflow_id = System.getenv("GITHUB_WORKFLOW")
def metadata = project.minecraft_version
2022-03-28 23:19:32 -05:00
// Release builds only
if (workflow_id == "build-release") {
return metadata
}
if (build_id != null) {
metadata += "-build.${build_id}"
} else if (grgit != null) {
def head = grgit.head()
def id = head.abbreviatedId
// Flag the build if the build tree is not clean
if (!grgit.status().clean) {
id += "-dirty"
}
metadata += "-${id}"
}
return metadata
}