forked from pcal43/fastback
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
186 lines (154 loc) · 6.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
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
plugins {
id 'fabric-loom' version '1.0-SNAPSHOT'
id 'maven-publish'
id "com.modrinth.minotaur" version "2.+"
id "com.matthewprenger.cursegradle" version "1.4.0"
}
apply plugin: 'com.matthewprenger.cursegradle'
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
archivesBaseName = project.archives_base_name
version = project.mod_version
group = project.maven_group
repositories {
// https://docs.gradle.org/current/userguide/declaring_repositories.html
maven { url 'https://maven.nucleoid.xyz' }
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
}
configurations {
// configuration that holds jars to include in the jar
extraLibs
}
project.ext.versions = [
jgit : '6.2.0.202206071550-r',
apache_sshd : '2.8.0',
JavaEWAH : '1.1.13',
fabric_permissions : '0.2-SNAPSHOT',
server_translations : '[1.4.17+1.19.2]',
junit_jupiter : '5.8.2',
eddsa : '0.3.0',
test_log4j : '2.16.0',
packet_tweaker : '0.3.0+1.18.2'
]
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}"
// JGit
include implementation("org.eclipse.jgit:org.eclipse.jgit:${versions.jgit}") { transitive = false }
include runtimeOnly("com.googlecode.javaewah:JavaEWAH:${versions.JavaEWAH}") { transitive = false }
include runtimeOnly("org.eclipse.jgit:org.eclipse.jgit.ssh.apache:${versions.jgit}") { transitive = false }
include runtimeOnly("org.apache.sshd:sshd-core:${versions.apache_sshd}") { transitive = false }
// See note below on 'stripSshdFileSystem'
include runtimeOnly(files("${buildDir}/sshd-common-${versions.apache_sshd}+no-fs.jar"))
include("org.apache.sshd:sshd-common:${versions.apache_sshd}") { transitive = false }
// Enable ed25519 support in apache_sshd
// https://github.com/apache/mina-sshd/blob/dfa109b7b535d64e8ee395ddd0419e7696fb24ee/docs/dependencies.md
include runtimeOnly("net.i2p.crypto:eddsa:${versions.eddsa}") { transitive = false }
// https://github.com/lucko/fabric-permissions-api
include modImplementation("fr.catcore:server-translations-api:${versions.server_translations}") { transitive = false }
include modRuntimeOnly("xyz.nucleoid:packet-tweaker:${versions.packet_tweaker}") { transitive = false }
// https://github.com/lucko/fabric-permissions-api
include modImplementation("me.lucko:fabric-permissions-api:${versions.fabric_permissions}") { transitive = false }
// JUnit
testImplementation "org.junit.jupiter:junit-jupiter-api:${versions.junit_jupiter}"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${versions.junit_jupiter}"
testRuntimeOnly "org.apache.logging.log4j:log4j-core:${versions.test_log4j}"
}
test {
useJUnitPlatform()
}
processResources {
inputs.property "version", project.version
filesMatching("fabric.mod.json") {
expand "version": project.version
}
// localizations need to be under data for server-translations-api
copy {
from "$projectDir/src/main/resources/assets/fastback/lang"
into "$buildDir/resources/main/data/fastback/lang"
}
}
sourceSets.test {
resources.srcDirs = ["src/test/resources"]
}
tasks.withType(JavaCompile).configureEach {
// Minecraft 1.18 (1.18-pre2) upwards uses Java 17.
it.options.release = 17
}
java {
// 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}"}
}
}
// https://github.com/modrinth/minotaur
modrinth {
token = System.getenv("MODRINTH_TOKEN")
projectId = "fastback"
versionNumber = project.mod_version
versionType = "beta"
uploadFile = remapJar
changelog = "<p><a href='https://github.com/pcal43/fastback/releases/tag/${project.mod_version}'>https://github.com/pcal43/fastback/releases/tag/${project.mod_version}</a></p>"
gameVersions = ["1.19.2"]
loaders = ["fabric"]
dependencies {
required.project "fabric-api"
}
}
curseforge {
apiKey = System.getenv("CURSEFORGE_TOKEN") ?: 'CURSEFORGE_TOKEN NOT_SET'
project {
id = "667417"
releaseType = "release"
changelog = "https://github.com/pcal43/fastback/releases/tag/${project.mod_version}"
changelogType = "markdown"
mod_version = project.mod_version
releaseType = "beta"
addGameVersion ((String) project.minecraft_version)
addGameVersion "Fabric"
mainArtifact(remapJar)
afterEvaluate {
uploadTask.dependsOn("remapJar")
}
}
options {
forgeGradleIntegration = false
}
}
/**
* Workaround for running in Intellij.
*
* The issue seems to be that that jar has a FileSystemProvider that gets picked up because it's on the IJ path; in
* the uberjar, it's ignored because its in the uberjar. It registers a RootedFileSystem, the ctor of which tries
* to create an slf4j logger, and that blows up for reasons that are not entirely clear (looks like classloading
* shenanigans of some sort).
*
* The workaround here makes a copy of sshd-common-x.x.x.jar and strips out the FileSystemProvider. The modified
* jar is used on the classpath in Intellij; the original jar is still used in the final shipping product. See
* dependency declarations above.
*/
tasks.register('stripSshdFileSystem') {
doLast {
mkdir "$buildDir"
copy {
from "${gradle.gradleUserHomeDir}/caches/fabric-loom/temp/modprocessing/sshd-common-${versions.apache_sshd}.jar"
into "$buildDir/"
rename { String fileName ->
fileName.replace("sshd-common-${versions.apache_sshd}.jar", "sshd-common-${versions.apache_sshd}+no-fs.jar")
}
}
exec {
workingDir "${buildDir}"
executable 'zip'
args '-d', "sshd-common-${versions.apache_sshd}+no-fs.jar", 'META-INF/services/java.nio.file.spi.FileSystemProvider'
}
}
}
classes { finalizedBy stripSshdFileSystem }