-
Notifications
You must be signed in to change notification settings - Fork 15
/
build.gradle
175 lines (154 loc) · 5.58 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
buildscript {
dependencies {
classpath "de.guntram.mcmod:crowdin-translate:${project.crowdin_translate_version}"
}
repositories {
maven {
name = "CrowdinTranslate"
url = "https://minecraft.guntram.de/maven/"
}
}
}
plugins {
id "fabric-loom" version "0.12-SNAPSHOT"
id "org.ajoberstar.grgit" version "4.1.0"
}
apply plugin: "de.guntram.mcmod.crowdin-translate"
crowdintranslate.crowdinProjectname = "sync-fabric"
crowdintranslate.minecraftProjectName = "sync"
crowdintranslate.verbose = true
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
String loaderDependencyVersion = project.loader_version.split(/\+/)[0]
String minecraftDependencyVersion = project.minecraft_version.split(/[+ -]/)[0]
group = project.maven_group
version = "${project.mod_version}${getVersionMetadata()}" as Object
archivesBaseName = "${project.archives_base_name}-mc${minecraftDependencyVersion}"
loom {
accessWidenerPath = file("src/main/resources/sync.accesswidener")
}
repositories {
maven {
name = "TerraformersMC"
url = "https://maven.terraformersmc.com/"
}
maven {
name = "Ladysnake Libs"
url = "https://ladysnake.jfrog.io/artifactory/mods"
}
maven {
name = "Cloth Config"
url = "https://maven.shedaniel.me/"
content {
includeGroup "me.shedaniel.cloth"
}
}
maven {
name = "Nexus OSS Repository"
url = "https://oss.sonatype.org/content/repositories/snapshots"
}
maven {
name = "Modrinth"
url = "https://api.modrinth.com/maven"
content {
includeGroup "maven.modrinth"
}
}
maven {
name = "CrowdinTranslate"
url = "https://minecraft.guntram.de/maven/"
}
maven {
name = "JitPack"
url = "https://jitpack.io"
content {
includeGroupByRegex "(io|com)\\.github\\..*"
}
}
maven {
url = "https://maven.jamieswhiteshirt.com/libs-release/"
content {
includeGroup "com.jamieswhiteshirt"
}
}
maven {
url = "https://maven.cafeteria.dev"
content {
includeGroup "net.adriantodt.fabricmc"
}
}
}
// To change the versions see the gradle.properties file
dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
modImplementation(include("de.guntram.mcmod:crowdin-translate:${project.crowdin_translate_version}"))
modImplementation(include("teamreborn:energy:${project.tr_energy_version}"))
modImplementation(include("io.github.ladysnake:satin:${project.satin_version}"))
modImplementation(include("maven.modrinth:smart-recipes:${project.smartrecipes_version}"))
modImplementation "me.shedaniel.cloth:cloth-config-fabric:${project.cloth_version}"
modImplementation "com.terraformersmc:modmenu:${project.modmenu_version}"
modCompileOnly "dev.emi:trinkets:${project.trinkets_version}"
modCompileOnly("io.github.ladysnake:requiem-api:${project.requiem_version}", { transitive false })
modCompileOnly "maven.modrinth:origins:${project.origins_version}"
modCompileOnly "com.github.apace100:apoli:${project.apoli_version}"
modCompileOnly "maven.modrinth:haema:${project.haema_version}"
}
processResources {
filesMatching("fabric.mod.json") {
expand([
"version": version,
"fabric": ">=${loaderDependencyVersion}",
"minecraft": ">=${minecraftDependencyVersion}",
"smart_recipes": project.smartrecipes_version,
"satin_api": project.satin_version,
"crowdin_translate": project.crowdin_translate_version,
"team_reborn_energy": project.tr_energy_version,
"cloth_config": ">=${project.cloth_version}",
"modmenu": ">=${project.modmenu_version}",
"trinkets": ">=${project.trinkets_version}",
"requiem": ">=${project.requiem_version}",
"origins": ">=${project.origins_version}",
"haema": ">=${project.haema_version}",
])
}
}
tasks.withType(JavaCompile).configureEach {
// Ensure that the encoding is set to UTF-8, no matter what the system default is
// this fixes some edge cases with special characters not displaying correctly
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
// If Javadoc is generated, this must be specified in that task too.
it.options.encoding = "UTF-8"
it.options.release.set(17)
}
java {
withSourcesJar()
}
jar {
from "LICENSE.md"
}
@SuppressWarnings("GrMethodMayBeStatic") // It cannot
String getVersionMetadata() {
// Release builds don't require additional metadata
String ref = System.getenv("GITHUB_REF")
if (ref != null && ref.startsWith("refs/tags/")) {
return ""
}
// GitHub CI builds only
String build_id = System.getenv("GITHUB_RUN_NUMBER")
if (build_id != null && build_id.length() != 0) {
return "+build.${build_id}"
}
if (grgit != null && grgit.head() != null) {
def id = grgit.head().abbreviatedId
// Flag the build if the build tree is not clean
if (!grgit.status().clean) {
id += "-dirty"
}
return "+rev.${id}"
}
// No tracking information could be found about the build
return "+unknown"
}