-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
199 lines (160 loc) · 5.05 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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
plugins {
id 'fabric-loom' version '1.0-SNAPSHOT'
id 'com.github.johnrengelman.shadow' version '7.1.2'
id 'com.matthewprenger.cursegradle' version "1.4.0"
id 'maven-publish'
}
group = projectGroup
archivesBaseName = projectArchiveBaseName
version = projectBaseVersion
repositories {
maven {
name = 'velocity'
url = 'https://nexus.velocitypowered.com/repository/maven-public/'
}
//maven {
// name = 'TerraformersMC Archive'
// url = 'https://raw.githubusercontent.com/TerraformersMC/Archive/main/releases/'
//}
maven {
name = 'modmenu'
url = 'https://maven.terraformersmc.com/releases/'
}
maven { url "https://maven.shedaniel.me/" }
}
dependencies {
// To change the versions see the gradle.properties file
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}"
implementation "com.google.zxing:javase:${project.zxing_version}"
shadow "com.google.zxing:javase:${project.zxing_version}"
shadow "com.google.zxing:core:${project.zxing_version}"
modImplementation include("com.velocitypowered:velocity-brigadier:${project.velocity_version}")
modImplementation("me.shedaniel.cloth:cloth-config-fabric:${project.clothconfig_version}") {
exclude(group: "net.fabricmc.fabric-api")
exclude module: "modmenu"
}
modImplementation("com.terraformersmc:modmenu:${project.modmenu_version}") {
exclude(group: "net.fabricmc.fabric-api")
}
modCompileOnly "com.google.code.findbugs:annotations:${project.findbugs_version}"
annotationProcessor "com.google.code.findbugs:annotations:${project.findbugs_version}"
}
loom {
mixin.defaultRefmapName = "${project.group}.${project.archivesBaseName}"
splitEnvironmentSourceSets()
mods {
modid {
sourceSet sourceSets.main
sourceSet sourceSets.client
}
}
}
compileJava {
options.compilerArgs << '-Xlint:deprecation'
}
// Contains curse token, maven user and password.
if (rootProject.file('private.gradle').exists()) {
apply from: 'private.gradle'
}
processResources {
inputs.property "version", project.version
filesMatching("fabric.mod.json") {
expand "version": project.version
}
}
String parseChangelog(String path) {
def file = new File(path)
if (!file.exists())
return '(no changelog)'
def changelog = ""
def end = false
file.eachLine {
if (end || it == null)
return
if (!it.startsWith('==='))
changelog += "$it\n"
else
end = true
}
return changelog
}
String getReleaseType() {
if (projectBaseVersion.contains('alpha'))
return 'alpha'
else if (projectBaseVersion.contains('beta'))
return 'beta'
return 'release'
}
def curseReleaseType = getReleaseType()
def ENV = System.getenv()
tasks.curseforge.enabled = !projectBaseVersion.contains('SNAPSHOT') && project.hasProperty('curse_api_key') && project.hasProperty('curseProjectId') && project.hasProperty('curseGameVersion')
curseforge {
if(project.hasProperty('curse_api_key')) apiKey = curse_api_key
project {
id = curseProjectId
changelog = parseChangelog('changelog.txt')
releaseType = curseReleaseType
addGameVersion curseGameVersion
addGameVersion 'Fabric'
addGameVersion 'Java 17'
mainArtifact(remapJar) {
displayName = "[$mcVersionFull] $projectName-${project.version}"
}
relations {
requiredDependency 'fabric-api'
embeddedLibrary 'auto-config-updated-api'
embeddedLibrary 'cloth-config'
optionalDependency 'modmenu'
}
}
options {
forgeGradleIntegration = false
}
}
afterEvaluate {
// Manually set dependsOn because curseforge doesn't set one.
tasks."curseforge$curseProjectId".dependsOn remapJar
}
tasks.withType(JavaExec).configureEach {
javaLauncher = javaToolchains.launcherFor {
languageVersion = JavaLanguageVersion.of(17)
}
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this line, sources will not be generated.
withSourcesJar()
}
jar {
from("LICENSE") {
rename { "${it}_${project.archivesBaseName}"}
}
}
shadowJar {
destinationDirectory = file("${buildDir}/tmp/allJar")
configurations = [project.configurations.shadow]
from sourceSets.client.output
from sourceSets.main.output
relocate 'com.google.zxing', 'de.rangun.pandacrossing.shadowed.com.google.zxing'
//Exclude META-INF entries of shaded deps
exclude 'META-INF/**'
from('.') {
include 'LICENSE.md'
include 'licenses/**'
}
minimize()
}
prepareRemapJar {
dependsOn shadowJar
}
remapJar{
input.set shadowJar.archiveFile.get()
}
assemble.dependsOn shadowJar