cauldron-dyeing/build.gradle

89 lines
2 KiB
Groovy
Raw Permalink Normal View History

2022-01-04 12:23:14 -05:00
plugins {
alias(libs.plugins.fabric.loom)
alias(libs.plugins.loom.quiltflower)
alias(libs.plugins.qmol)
alias(libs.plugins.grgit)
2022-01-04 12:23:14 -05:00
}
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'
2022-01-04 12:23:14 -05:00
content {
includeGroup 'maven.modrinth'
2022-01-04 12:23:14 -05:00
}
}
}
dependencies {
minecraft libs.minecraft
2022-03-15 19:50:02 -05:00
mappings loom.layered {
addLayer quiltMappings.mappings("org.quiltmc:quilt-mappings:${libs.versions.quilt.mappings.get()}:v2")
2022-03-15 19:50:02 -05:00
}
modImplementation libs.fabric.loader
2022-01-04 12:23:14 -05:00
modImplementation libs.fabric.api
modCompileOnly libs.sodium
2022-01-04 12:23:14 -05:00
}
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'
// Minecraft 1.18 (1.18-pre2) upwards uses Java 17.
it.options.release = 17
2022-01-04 12:23:14 -05:00
}
java {
// Still required by IDEs such as Eclipse and Visual Studio Code
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
2022-01-04 12:23:14 -05:00
withSourcesJar()
}
jar {
from('LICENSE') {
rename { "${it}_${project.archivesBaseName}"}
}
}
def getMetadata() {
def build_id = System.getenv('GITHUB_RUN_NUMBER')
def workflow_id = System.getenv('GITHUB_WORKFLOW')
def metadata = libs.versions.minecraft.get()
2022-03-28 23:19:32 -05:00
// Release builds only
if (workflow_id == 'build-release') {
2022-03-28 23:19:32 -05:00
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
}