cauldron-dyeing/build.gradle

112 lines
2.4 KiB
Groovy
Raw 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-08-18 21:34:23 -05:00
id "maven-publish"
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 {
2022-08-18 21:34:23 -05:00
name = "Modrinth"
url = "https://api.modrinth.com/maven"
2022-01-04 12:23:14 -05:00
content {
2022-08-18 21:34:23 -05:00
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
}
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 {
2022-08-18 21:34:23 -05:00
inputs.property "version", project.version
filteringCharset "UTF-8"
2022-01-04 12:23:14 -05:00
2022-08-18 21:34:23 -05:00
filesMatching("fabric.mod.json") {
expand "version": project.version
2022-01-04 12:23:14 -05:00
}
}
tasks.withType(JavaCompile) {
2022-08-18 21:34:23 -05:00
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 {
2022-08-18 21:34:23 -05:00
from("LICENSE") {
2022-01-04 12:23:14 -05:00
rename { "${it}_${project.archivesBaseName}"}
}
}
2022-08-18 21:34:23 -05:00
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}
repositories {
maven {
2022-08-19 11:33:45 -05:00
url = System.getenv("MAVEN_URL")
2022-08-18 21:34:23 -05:00
credentials {
2022-08-19 11:33:45 -05:00
username = System.getenv("MAVEN_USERNAME")
password = System.getenv("MAVEN_PASSWORD")
2022-08-18 21:34:23 -05:00
}
}
}
}
def getMetadata() {
2022-08-18 21:34:23 -05:00
def build_id = System.getenv("GITHUB_RUN_NUMBER")
def workflow_id = System.getenv("GITHUB_WORKFLOW")
2022-08-18 21:34:23 -05:00
def metadata = ""
2022-03-28 23:19:32 -05:00
// Release builds only
2022-08-18 21:34:23 -05:00
if (workflow_id == "build-release") {
2022-03-28 23:19:32 -05:00
return metadata
}
if (build_id != null) {
2022-08-18 21:34:23 -05:00
metadata += "build.${build_id}"
2022-03-28 23:19:32 -05:00
} 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) {
2022-08-18 21:34:23 -05:00
id += "-dirty"
}
2022-08-18 21:34:23 -05:00
metadata += "${id}"
}
return metadata
}