-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.gradle
172 lines (139 loc) · 4.43 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
plugins {
id 'eclipse'
id 'idea'
id 'java-library'
id 'net.neoforged.moddev' version '2.0.36-beta'
}
group = 'com.lovetropics.minigames'
base {
archivesName = 'LTMinigames'
}
ext.buildnumber = 0
project.buildnumber = System.getenv('BUILD_NUMBER') ?: 'custom'
if (System.getenv('GHA_RELEASE_WORKFLOW')) {
version = "${mod_version}"
} else if (System.getenv('GITHUB_RUN_NUMBER')) {
project.buildnumber = System.getenv('GITHUB_RUN_NUMBER')
version = "${mod_version}-${release_type}+${buildnumber}-gha"
} else {
project.buildnumber = System.getenv('BUILD_NUMBER') ?: 'custom'
version = "${mod_version}-${release_type}+${buildnumber}"
}
java.toolchain.languageVersion = JavaLanguageVersion.of(21)
sourceSets.main.resources {
srcDir 'src/generated/resources'
exclude 'testing/**'
}
sourceSets.test.resources {
srcDir 'src/generated/resources'
include 'testing/**'
include 'data/ltminigames/structures/**'
}
neoForge {
version = project.neo_version
parchment {
minecraftVersion = minecraft_version
mappingsVersion = parchment_version
}
addModdingDependenciesTo sourceSets.test
mods {
"${project.mod_id}" {
sourceSet sourceSets.main
}
"${project.mod_id}_test" {
sourceSet sourceSets.main
sourceSet sourceSets.test
}
}
runs {
client {
client()
loadedMods = [mods."${mod_id}"]
programArguments.addAll '--username', '"Dev###"'
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
}
server {
server()
loadedMods = [mods."${mod_id}"]
programArgument '--nogui'
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
}
gameTestServer {
type = "gameTestServer"
sourceSet = sourceSets.test
loadedMods = [mods."${mod_id}_test"]
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
}
data {
data()
loadedMods = [mods."${mod_id}_test"]
programArguments.addAll '--mod', project.mod_id, '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath()
}
configureEach {
logLevel = org.slf4j.event.Level.WARN
ideName = project.name + " - " + ideName.get()
}
}
}
configurations {
modImpl
implementation.extendsFrom(modImpl)
testImplementation.extendsFrom(modImpl)
modRuntime
runtimeOnly.extendsFrom(modRuntime)
testRuntimeOnly.extendsFrom(modRuntime)
modCompile
compileOnly.extendsFrom(modCompile)
testCompileOnly.extendsFrom(modCompile)
}
repositories {
maven { url = "https://maven.ithundxr.dev/snapshots/" }
maven { url = "https://maven.tterrag.com/" }
maven { url = "https://api.modrinth.com/maven" }
mavenLocal()
}
dependencies {
modRuntime 'org.lovetropics:Tropicraft:9.7.3-beta+2'
// TODO: HACK - We get Registrate at runtime through JarJar from Tropicraft. We should rather prefer to depend on the slim jar.
jarJar(modCompile("com.tterrag.registrate:Registrate:MC1.21-${registrate_version}")) {
version {
strictly "[MC1.21-${registrate_version},MC1.22)"
prefer "MC1.21-${registrate_version}"
}
}
jarJar(modImpl("com.lovetropics.lib:LTLib:$ltlib_version"))
modRuntime "com.lovetropics.extras:LTExtras:$ltextras_version"
testImplementation platform("org.junit:junit-bom:5.7.0")
testImplementation "org.junit.jupiter:junit-jupiter"
}
test {
useJUnitPlatform()
testLogging {
events "passed", "skipped", "failed"
}
}
tasks.register('sourceJar', Jar) {
dependsOn classes
archiveClassifier = 'sources'
from sourceSets.main.java
}
var generateModMetadata = tasks.register('generateModMetadata', ProcessResources) {
var replaceProperties = [
mod_version: mod_version,
]
inputs.properties replaceProperties
expand replaceProperties
from 'src/main/templates'
into 'build/generated/sources/modMetadata'
}
sourceSets.main.resources.srcDir generateModMetadata
neoForge.ideSyncTask generateModMetadata
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
}
idea {
module {
downloadSources = true
downloadJavadoc = true
}
}