2022-01-04 12:23:14 -05:00
|
|
|
plugins {
|
2022-06-07 19:58:31 -05:00
|
|
|
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
|
|
|
}
|
|
|
|
|
2022-01-17 16:20:25 -05:00
|
|
|
archivesBaseName = project.archives_base_name
|
2022-01-25 17:43:50 -05:00
|
|
|
version = "${project.mod_version}+${getMetadata()}"
|
2022-01-04 12:23:14 -05:00
|
|
|
group = project.maven_group
|
|
|
|
|
|
|
|
repositories {
|
|
|
|
maven {
|
2022-06-07 19:58:31 -05:00
|
|
|
name = 'Modrinth'
|
|
|
|
url = 'https://api.modrinth.com/maven'
|
2022-01-04 12:23:14 -05:00
|
|
|
content {
|
2022-06-07 19:58:31 -05:00
|
|
|
includeGroup 'maven.modrinth'
|
2022-01-04 12:23:14 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
2022-06-07 19:58:31 -05:00
|
|
|
minecraft libs.minecraft
|
2022-03-15 19:50:02 -05:00
|
|
|
mappings loom.layered {
|
2022-06-07 19:58:31 -05:00
|
|
|
addLayer quiltMappings.mappings("org.quiltmc:quilt-mappings:${libs.versions.quilt.mappings.get()}:v2")
|
2022-03-15 19:50:02 -05:00
|
|
|
}
|
2022-06-07 19:58:31 -05:00
|
|
|
modImplementation libs.fabric.loader
|
2022-01-04 12:23:14 -05:00
|
|
|
|
2022-06-07 19:58:31 -05:00
|
|
|
modImplementation libs.fabric.api
|
|
|
|
modCompileOnly libs.sodium
|
2022-01-04 12:23:14 -05:00
|
|
|
}
|
|
|
|
|
2022-08-18 19:28:36 -05:00
|
|
|
loom {
|
|
|
|
accessWidenerPath.set file("src/main/resources/cauldron-dyeing.accesswidener")
|
|
|
|
}
|
|
|
|
|
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'
|
2022-06-07 19:58:31 -05:00
|
|
|
// Minecraft 1.18 (1.18-pre2) upwards uses Java 17.
|
|
|
|
it.options.release = 17
|
2022-01-04 12:23:14 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
java {
|
2022-06-07 19:58:31 -05:00
|
|
|
// 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}"}
|
|
|
|
}
|
|
|
|
}
|
2022-01-17 16:20:25 -05:00
|
|
|
|
2022-01-25 17:43:50 -05:00
|
|
|
def getMetadata() {
|
2022-06-07 19:58:31 -05:00
|
|
|
def build_id = System.getenv('GITHUB_RUN_NUMBER')
|
|
|
|
def workflow_id = System.getenv('GITHUB_WORKFLOW')
|
2022-01-17 16:20:25 -05:00
|
|
|
|
2022-06-07 19:58:31 -05:00
|
|
|
def metadata = libs.versions.minecraft.get()
|
2022-01-17 16:20:25 -05:00
|
|
|
|
2022-03-28 23:19:32 -05:00
|
|
|
// Release builds only
|
2022-06-07 19:58:31 -05:00
|
|
|
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) {
|
2022-01-17 16:20:25 -05:00
|
|
|
def head = grgit.head()
|
|
|
|
def id = head.abbreviatedId
|
|
|
|
|
|
|
|
// Flag the build if the build tree is not clean
|
|
|
|
if (!grgit.status().clean) {
|
2022-06-07 19:58:31 -05:00
|
|
|
id += '-dirty'
|
2022-01-17 16:20:25 -05:00
|
|
|
}
|
|
|
|
|
2022-01-25 17:43:50 -05:00
|
|
|
metadata += "-${id}"
|
|
|
|
}
|
|
|
|
|
|
|
|
return metadata
|
2022-01-17 16:20:25 -05:00
|
|
|
}
|