-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
103 lines (83 loc) · 2.21 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
plugins {
alias(libs.plugins.fabric.loom)
alias(libs.plugins.grgit)
id "maven-publish"
}
archivesBaseName = project.archives_base_name
version = "${project.mod_version}${getMetadata()}"
group = project.maven_group
repositories {
maven {
name = "Quilt"
url = "https://maven.quiltmc.org/repository/release"
}
}
dependencies {
minecraft libs.minecraft
mappings variantOf(libs.quilt.mappings) { classifier "intermediary-v2" }
modImplementation libs.fabric.loader
modImplementation libs.fabric.api
}
loom {
accessWidenerPath.set file("src/main/resources/cauldron-dyeing.accesswidener")
}
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
}
java {
// Still required by IDEs such as Eclipse and Visual Studio Code
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
withSourcesJar()
}
jar {
from("LICENSE") {
rename { "${it}_${project.archivesBaseName}"}
}
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}
repositories {
maven {
url = System.getenv("MAVEN_URL")
credentials {
username = System.getenv("MAVEN_USERNAME")
password = System.getenv("MAVEN_PASSWORD")
}
}
}
}
def getMetadata() {
def build_id = System.getenv("GITHUB_RUN_NUMBER")
def workflow_id = System.getenv("GITHUB_WORKFLOW")
def metadata = ""
// 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 += "+git.${id}"
}
return metadata
}