-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathbuild.gradle
More file actions
230 lines (202 loc) · 6.33 KB
/
Copy pathbuild.gradle
File metadata and controls
230 lines (202 loc) · 6.33 KB
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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
plugins {
id 'java'
id 'java-library'
id 'maven-publish'
id 'com.gradleup.shadow' version '9.5.1'
id 'org.jetbrains.gradle.plugin.idea-ext' version '1.4.1'
id 'xyz.wagyourtail.unimined' version '1.4.36-kappa'
id 'net.kyori.blossom' version '2.2.0'
}
import org.jetbrains.gradle.ext.Gradle
ext {
//noinspection GroovyAssignabilityCheck
access_transformer_locations = "${mod_id}_at.cfg"
}
version = mod_version
group = root_package
base {
archivesName = mod_id
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(25)
}
if (generate_sources_jar.toBoolean()) {
withSourcesJar()
}
if (generate_javadocs_jar.toBoolean()) {
withJavadocJar()
}
}
configurations {
contain
implementation.extendsFrom(contain)
modCompileOnly
compileOnly.extendsFrom(modCompileOnly)
modRuntimeOnly
runtimeOnly.extendsFrom(modRuntimeOnly)
}
def remapTaskName = enable_shadow.toBoolean() ? "remapShadowJar" : "remapJar"
//noinspection GroovyAssignabilityCheck
unimined.minecraft {
version "1.12.2"
mappings {
mcp("stable", "39-1.12")
}
cleanroom {
if (use_access_transformer.toBoolean()) {
accessTransformer "${rootProject.projectDir}/src/main/resources/$access_transformer_locations"
}
loader "0.6.10-alpha"
runs.all {
args += ['--username', minecraft_username]
def extraArgs = extra_jvm_args
if (extraArgs != null && !extraArgs.trim().isEmpty()) {
jvmArgs += extraArgs.split { "\\s+" }.toList()
}
if (enable_foundation_debug.toBoolean()) {
systemProperty("foundation.dump", "true")
systemProperty("foundation.verbose", "true")
}
if (is_coremod.toBoolean()) {
systemProperty("fml.coreMods.load", coremod_plugin_class_name)
}
return
}
}
defaultRemapJar = false
String jarTaskName = enable_shadow.toBoolean() ? "shadowJar" : "jar"
remap(tasks.named(jarTaskName).get())
mods {
remap(configurations.modCompileOnly)
remap(configurations.modRuntimeOnly)
}
}
dependencies {
if (use_asset_mover.toBoolean()) {
implementation "com.cleanroommc:assetmover:${asset_mover_version}"
}
if (enable_junit_testing.toBoolean()) {
testImplementation 'org.junit.jupiter:junit-jupiter:6.0.3'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}
}
apply from: 'gradle/scripts/dependencies.gradle'
processResources {
rename '(.+_at.cfg)', 'META-INF/$1'
}
sourceSets {
main {
blossom {
javaSources {
property('mod_id', mod_id)
property('mod_name', mod_name)
property('mod_version', mod_version)
property('package', "${root_package}.${mod_id}")
}
resources {
property('mod_id', mod_id)
property('mod_name', mod_name)
property('mod_version', mod_version)
property('mod_description', mod_description)
property('mod_authors', mod_authors.toString().split(',').findAll { !it.isBlank() }.collect { "\"${it.strip()}\"" }.join(', '))
property('mod_credits', mod_credits)
property('mod_url', mod_url)
property('mod_update_json', mod_update_json)
property('mod_logo_path', mod_logo_path)
property('mod_issue_tracker', mod_issue_tracker)
}
}
}
}
idea {
module {
inheritOutputDirs = true
}
project {
settings {
runConfigurations {
'1. Build'(Gradle) {
taskNames = ["build"]
}
'2. Run Client'(Gradle) {
taskNames = ["runClient"]
}
'3. Run Server'(Gradle) {
taskNames = ["runServer"]
}
}
compiler.javac {
afterEvaluate {
javacAdditionalOptions = '-encoding utf8'
moduleJavacAdditionalOptions = [
(project.name + '.main'): tasks.compileJava.options.compilerArgs.collect { "\"${it}\"" }.join(' ')
]
}
}
taskTriggers {
beforeSync tasks.named("genSources")
}
}
}
}
if (!enable_shadow.toBoolean()) {
shadowJar.enabled = false
}
compileJava {
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_25
}
jar {
archiveClassifier = 'dev'
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
if (configurations.contain.size() > 0) {
into('/') {
from configurations.contain
}
}
doFirst {
manifest {
def attribute_map = [:]
attribute_map['ModType'] = "CRL"
if (configurations.contain.size() > 0) {
attribute_map['ContainedDeps'] = configurations.contain.collect { it.name }.join(' ')
attribute_map['NonModDeps'] = true
}
if (is_coremod.toBoolean()) {
attribute_map['FMLCorePlugin'] = coremod_plugin_class_name
if (coremod_includes_mod.toBoolean()) {
attribute_map['FMLCorePluginContainsFMLMod'] = true
}
}
if (use_access_transformer.toBoolean()) {
attribute_map['FMLAT'] = access_transformer_locations
}
attributes(attribute_map)
}
}
finalizedBy(tasks.named(remapTaskName).get())
}
shadowJar {
//noinspection GroovyAssignabilityCheck,GroovyAccessibility
configurations = [project.configurations.shadow]
archiveClassifier = "shadow"
}
compileTestJava {
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_25
}
test {
useJUnitPlatform()
javaLauncher.set(javaToolchains.launcherFor {
languageVersion = JavaLanguageVersion.of(25)
})
if (show_testing_output.toBoolean()) {
testLogging {
showStandardStreams = true
}
}
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
}
apply from: 'gradle/scripts/publishing.gradle'
apply from: 'gradle/scripts/extra.gradle'