-
-
Notifications
You must be signed in to change notification settings - Fork 18
/
build.gradle
210 lines (182 loc) · 5.75 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
200
201
202
203
204
205
206
207
208
209
210
import net.raphimc.viabedrock.generator.EnumGeneratorTask
plugins {
id "java-library"
id "maven-publish"
id "signing"
id "org.jetbrains.gradle.plugin.idea-ext" version "1.1.9"
id "net.raphimc.class-token-replacer" version "1.1.3"
}
base {
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
compileJava.options.encoding = compileTestJava.options.encoding = javadoc.options.encoding = "UTF-8"
group = project.maven_group ?: rootProject.maven_group
archivesName = project.maven_name ?: rootProject.maven_name
version = project.maven_version ?: rootProject.maven_version
}
configurations {
testImplementation.extendsFrom compileOnly
}
repositories {
mavenCentral()
maven {
name = "ViaVersion"
url = "https://repo.viaversion.com"
}
maven {
name = "Lenni0451"
url = "https://maven.lenni0451.net/everything"
}
maven {
name = "Minecraft Libraries"
url = "https://libraries.minecraft.net"
content {
includeGroup "com.mojang"
}
}
maven {
name = "Jitpack"
url = "https://jitpack.io"
content {
includeGroup "com.github.Oryxel"
}
}
}
dependencies {
compileOnly "com.viaversion:viaversion-common:5.1.2-SNAPSHOT"
compileOnly "org.yaml:snakeyaml:2.3"
compileOnly "com.google.guava:guava:33.3.1-jre"
compileOnly "io.netty:netty-handler:4.1.115.Final"
compileOnly "com.google.code.gson:gson:2.11.0"
api("io.netty:netty-codec-http:4.1.115.Final") {
transitive = false
}
api "io.jsonwebtoken:jjwt-impl:0.12.6"
api("io.jsonwebtoken:jjwt-gson:0.12.6") {
exclude group: "com.google.code.gson", module: "gson"
}
api("net.lenni0451.mcstructs-bedrock:text:1.2.1") {
exclude group: "com.google.code.gson", module: "gson"
}
api("net.lenni0451.mcstructs-bedrock:forms:1.2.1") {
exclude group: "com.google.code.gson", module: "gson"
}
api "com.vdurmont:semver4j:3.1.0"
api "com.mojang:brigadier:1.0.18"
api "org.lz4:lz4-pure-java:1.8.0"
api("com.github.Oryxel:CubeConverter:5ae1e90e4f") {
transitive = false
}
}
sourceSets {
main {
classTokenReplacer {
property("\${version}", project.version)
property("\${impl_version}", "git-${project.name}-${project.version}:${project.latestCommitHash().get()}")
}
}
}
java {
withSourcesJar()
}
jar {
from("LICENSE") {
rename { "${it}_${project.name ?: rootProject.name}" }
}
}
artifacts {
archives sourcesJar
}
publishing {
repositories {
maven {
name = "reposilite"
url = "https://maven.lenni0451.net/" + (project.maven_version.endsWith("SNAPSHOT") ? "snapshots" : "releases")
credentials(PasswordCredentials)
authentication {
basic(BasicAuthentication)
}
}
}
publications {
maven(MavenPublication) {
groupId = project.maven_group
artifactId = project.maven_name
version = project.maven_version
from components.java
pom {
name = "ViaBedrock"
description = "ViaVersion addon to add support for Minecraft: Bedrock Edition servers"
url = "https://github.com/RaphiMC/ViaBedrock"
licenses {
license {
name = "GPL-3.0 License"
url = "https://github.com/RaphiMC/ViaBedrock/blob/main/LICENSE"
}
}
developers {
developer {
id = "RK_01"
}
}
scm {
connection = "scm:git:git://github.com/RaphiMC/ViaBedrock.git"
developerConnection = "scm:git:ssh://github.com/RaphiMC/ViaBedrock.git"
url = "https://github.com/RaphiMC/ViaBedrock.git"
}
}
}
}
}
signing {
setRequired(false)
sign configurations.archives
sign publishing.publications.maven
}
project.tasks.withType(PublishToMavenRepository).forEach {
it.dependsOn(project.tasks.withType(Sign))
}
def enumSourceDir = layout.buildDirectory.dir("generated/enums/main/java")
def enumGeneratorTask = tasks.register("enumGeneratorTask", EnumGeneratorTask) {
commitHash = "fbae8fb6cd53a578e564a2b1f77f80e5842337b1" // https://github.com/Mojang/bedrock-protocol-docs
outputDirectory = enumSourceDir
}
tasks.compileJava.dependsOn(enumGeneratorTask)
tasks.sourcesJar.dependsOn(enumGeneratorTask)
sourceSets.main.java.srcDir(enumSourceDir)
idea {
module {
["run"].each {
excludeDirs << file("$it")
}
}
project.settings {
taskTriggers {
afterSync enumGeneratorTask
}
}
}
tasks.register("runViaProxy", JavaExec) {
dependsOn tasks.jar
def viaProxyConfiguration = configurations.create("viaProxy")
viaProxyConfiguration.dependencies.add(dependencies.create("net.raphimc:ViaProxy:3.3.5-SNAPSHOT") {
transitive = false
})
mainClass = "net.raphimc.viaproxy.ViaProxy"
classpath = viaProxyConfiguration
workingDir = file("run")
jvmArgs = ["-DskipUpdateCheck"]
doFirst {
def jarsDir = file("$workingDir/jars")
jarsDir.mkdirs()
file("$jarsDir/${project.name}.jar").bytes = tasks.jar.archiveFile.get().asFile.bytes
}
doLast {
file("$workingDir/jars/${project.name}.jar").delete()
file("$workingDir/logs").deleteDir()
}
}
Provider<String> latestCommitHash() {
return providers.exec {
commandLine = ["git", "rev-parse", "--short", "HEAD"]
}.standardOutput.getAsText().map(String::trim)
}