Skip to content

Commit 940933c

Browse files
Merge branch 'main' into scala
2 parents 424e659 + 251d966 commit 940933c

7 files changed

Lines changed: 58 additions & 183 deletions

File tree

build.gradle

Lines changed: 49 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -5,48 +5,32 @@ plugins {
55
id 'maven-publish'
66
id 'com.gradleup.shadow' version '9.4.1'
77
id 'org.jetbrains.gradle.plugin.idea-ext' version '1.4.1'
8-
id 'xyz.wagyourtail.unimined' version '1.4.18-kappa'
8+
id 'xyz.wagyourtail.unimined' version '1.4.23-kappa'
99
id 'net.kyori.blossom' version '2.2.0'
1010
}
1111

1212
import org.jetbrains.gradle.ext.Gradle
1313

14-
apply from: 'gradle/scripts/helpers.gradle'
15-
16-
// Early Assertions
17-
assertProperty 'mod_version'
18-
assertProperty 'root_package'
19-
assertProperty 'mod_id'
20-
assertProperty 'mod_name'
21-
22-
assertSubProperties 'use_access_transformer', 'access_transformer_locations'
23-
assertSubProperties 'is_coremod', 'coremod_includes_mod', 'coremod_plugin_class_name'
24-
assertSubProperties 'use_asset_mover', 'asset_mover_version'
25-
26-
setDefaultProperty 'generate_sources_jar', true, false
27-
setDefaultProperty 'generate_javadocs_jar', true, false
28-
setDefaultProperty 'minecraft_username', true, 'Developer'
29-
setDefaultProperty 'extra_jvm_args', false, ''
14+
ext {
15+
//noinspection GroovyAssignabilityCheck
16+
access_transformer_locations = "${mod_id}_at.cfg"
17+
}
3018

31-
version = propertyString('mod_version')
32-
group = propertyString('root_package')
19+
version = mod_version
20+
group = root_package
3321

3422
base {
35-
archivesName = propertyString('mod_id') as String
36-
}
37-
38-
scala {
39-
scalaVersion = '3.8.2'
23+
archivesName = mod_id
4024
}
4125

4226
java {
4327
toolchain {
4428
languageVersion = JavaLanguageVersion.of(25)
4529
}
46-
if (propertyBool('generate_sources_jar')) {
30+
if (generate_sources_jar.toBoolean()) {
4731
withSourcesJar()
4832
}
49-
if (propertyBool('generate_javadocs_jar')) {
33+
if (generate_javadocs_jar.toBoolean()) {
5034
withJavadocJar()
5135
}
5236
}
@@ -60,8 +44,9 @@ configurations {
6044
runtimeOnly.extendsFrom(modRuntimeOnly)
6145
}
6246

63-
String remapTaskName = propertyBool('enable_shadow') ? "remapShadowJar" : "remapJar"
47+
def remapTaskName = enable_shadow.toBoolean() ? "remapShadowJar" : "remapJar"
6448

49+
//noinspection GroovyAssignabilityCheck
6550
unimined.minecraft {
6651
version "1.12.2"
6752

@@ -70,38 +55,32 @@ unimined.minecraft {
7055
}
7156

7257
cleanroom {
73-
if (propertyBool('use_access_transformer')) {
74-
accessTransformer "${rootProject.projectDir}/src/main/resources/${propertyString('access_transformer_locations')}"
58+
if (use_access_transformer.toBoolean()) {
59+
accessTransformer "${rootProject.projectDir}/src/main/resources/$access_transformer_locations"
7560
}
76-
loader "0.5.12-alpha"
61+
loader "0.5.14-alpha"
7762
runs.all {
7863
args += ['--username', minecraft_username]
79-
def extraArgs = propertyString('extra_jvm_args')
64+
def extraArgs = extra_jvm_args
8065
if (extraArgs != null && !extraArgs.trim().isEmpty()) {
8166
jvmArgs += extraArgs.split { "\\s+" }.toList()
8267
}
83-
if (propertyBool('enable_foundation_debug')) {
68+
if (enable_foundation_debug.toBoolean()) {
8469
systemProperty("foundation.dump", "true")
8570
systemProperty("foundation.verbose", "true")
8671
}
87-
if (propertyBool('is_coremod')) {
88-
systemProperty("fml.coreMods.load", propertyString('coremod_plugin_class_name'))
72+
if (is_coremod.toBoolean()) {
73+
systemProperty("fml.coreMods.load", coremod_plugin_class_name)
8974
}
9075
return
9176
}
9277
}
9378

9479
defaultRemapJar = false
95-
96-
String jarTaskName = propertyBool('enable_shadow') ? "shadowJar" : "jar"
97-
98-
remap(tasks.named(jarTaskName).get()) {
99-
mixinRemap {
100-
enableBaseMixin()
101-
enableMixinExtra()
102-
disableRefmap()
103-
}
104-
}
80+
81+
String jarTaskName = enable_shadow.toBoolean() ? "shadowJar" : "jar"
82+
83+
remap(tasks.named(jarTaskName).get())
10584

10685
mods {
10786
remap(configurations.modCompileOnly)
@@ -110,10 +89,10 @@ unimined.minecraft {
11089
}
11190

11291
dependencies {
113-
if (propertyBool('use_asset_mover')) {
114-
implementation "com.cleanroommc:assetmover:${propertyString('asset_mover_version')}"
92+
if (use_asset_mover.toBoolean()) {
93+
implementation "com.cleanroommc:assetmover:${asset_mover_version}"
11594
}
116-
if (propertyBool('enable_junit_testing')) {
95+
if (enable_junit_testing.toBoolean()) {
11796
testImplementation 'org.junit.jupiter:junit-jupiter:6.0.3'
11897
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
11998
}
@@ -129,21 +108,21 @@ sourceSets {
129108
main {
130109
blossom {
131110
scalaSources {
132-
property('mod_id', propertyString('mod_id'))
133-
property('mod_name', propertyString('mod_name'))
134-
property('mod_version', propertyString('mod_version'))
111+
property('mod_id', mod_id)
112+
property('mod_name', mod_name)
113+
property('mod_version', mod_version)
135114
property('package', "${root_package}.${mod_id}")
136115
}
137116
resources {
138-
property('mod_id', propertyString('mod_id'))
139-
property('mod_name', propertyString('mod_name'))
140-
property('mod_version', propertyString('mod_version'))
141-
property('mod_description', propertyString('mod_description'))
142-
property('mod_authors', propertyStringList('mod_authors', ',').collect {it.strip()}.join('", "'))
143-
property('mod_credits', propertyString('mod_credits'))
144-
property('mod_url', propertyString('mod_url'))
145-
property('mod_update_json', propertyString('mod_update_json'))
146-
property('mod_logo_path', propertyString('mod_logo_path'))
117+
property('mod_id', mod_id)
118+
property('mod_name', mod_name)
119+
property('mod_version', mod_version)
120+
property('mod_description', mod_description)
121+
property('mod_authors', mod_authors.toString().split(',').findAll { !it.isBlank() }.collect { "\"${it.strip()}\"" }.join(', '))
122+
property('mod_credits', mod_credits)
123+
property('mod_url', mod_url)
124+
property('mod_update_json', mod_update_json)
125+
property('mod_logo_path', mod_logo_path)
147126
}
148127
}
149128
}
@@ -170,20 +149,20 @@ idea {
170149
afterEvaluate {
171150
javacAdditionalOptions = '-encoding utf8'
172151
moduleJavacAdditionalOptions = [
173-
(project.name + '.main'): tasks.compileJava.options.compilerArgs.collect { '"' + it + '"' }.join(' ')
152+
(project.name + '.main'): tasks.compileJava.options.compilerArgs.collect { "\"${it}\"" }.join(' ')
174153
]
175154
}
176155
}
177156
}
178157
}
179158
}
180159

181-
if (!propertyBool('enable_shadow')) {
160+
if (!enable_shadow.toBoolean()) {
182161
shadowJar.enabled = false
183162
}
184163

185164
compileJava {
186-
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_21
165+
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_25
187166
}
188167

189168
jar {
@@ -202,14 +181,14 @@ jar {
202181
attribute_map['ContainedDeps'] = configurations.contain.collect { it.name }.join(' ')
203182
attribute_map['NonModDeps'] = true
204183
}
205-
if (propertyBool('is_coremod')) {
206-
attribute_map['FMLCorePlugin'] = propertyString('coremod_plugin_class_name')
207-
if (propertyBool('coremod_includes_mod')) {
184+
if (is_coremod.toBoolean()) {
185+
attribute_map['FMLCorePlugin'] = coremod_plugin_class_name
186+
if (coremod_includes_mod.toBoolean()) {
208187
attribute_map['FMLCorePluginContainsFMLMod'] = true
209188
}
210189
}
211-
if (propertyBool('use_access_transformer')) {
212-
attribute_map['FMLAT'] = propertyString('access_transformer_locations')
190+
if (use_access_transformer.toBoolean()) {
191+
attribute_map['FMLAT'] = access_transformer_locations
213192
}
214193
attributes(attribute_map)
215194
}
@@ -219,6 +198,7 @@ jar {
219198

220199

221200
shadowJar {
201+
//noinspection GroovyAssignabilityCheck,GroovyAccessibility
222202
configurations = [project.configurations.shadow]
223203
archiveClassifier = "shadow"
224204
}
@@ -234,15 +214,15 @@ tasks.named(remapTaskName).configure {
234214
}
235215

236216
compileTestJava {
237-
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_21
217+
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_25
238218
}
239219

240220
test {
241221
useJUnitPlatform()
242222
javaLauncher.set(javaToolchains.launcherFor {
243223
languageVersion = JavaLanguageVersion.of(25)
244224
})
245-
if (propertyBool('show_testing_output')) {
225+
if (show_testing_output.toBoolean()) {
246226
testLogging {
247227
showStandardStreams = true
248228
}

gradle.properties

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ maven_url =
5858
# If multiple locations are stated, use spaces as the delimiter
5959
# WARNING: Use MCP name in AT file. Unimined will remap it to srg name when building.
6060
use_access_transformer = true
61-
access_transformer_locations = ${mod_id}_at.cfg
6261

6362
# Coremods
6463
# The most powerful way to change java classes at runtime, it is however very primitive with little documentation.

gradle/scripts/dependencies.gradle

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
apply from: 'gradle/scripts/helpers.gradle'
2-
31
repositories {
42
// Other repositories described by default:
53
// CleanroomMC: https://maven.cleanroommc.com
@@ -25,7 +23,7 @@ repositories {
2523

2624
dependencies {
2725
compileOnly "com.cleanroommc:sponge-mixin:0.20.13+mixin.0.8.7"
28-
if (propertyBool('enable_lwjglx')) {
26+
if (enable_lwjglx.toBoolean()) {
2927
compileOnly "com.cleanroommc:lwjglx:1.0.0"
3028
}
3129

gradle/scripts/extra.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// You may write any gradle buildscript component in this file
22
// This file is automatically applied after build.gradle + dependencies.gradle is ran
33

4-
// If you wish to use the default helper methods, uncomment the line below
5-
// apply from: 'gradle/scripts/helpers.gradle'
4+
// Helper methods (assertProperty, assertSubProperties, setDefaultProperty) are
5+
// defined directly in build.gradle's script scope and exported via ext.

gradle/scripts/helpers.gradle

Lines changed: 0 additions & 96 deletions
This file was deleted.

gradle/scripts/publishing.gradle

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,17 @@
1-
apply from: 'gradle/scripts/helpers.gradle'
2-
3-
setDefaultProperty('publish_to_maven', true, false)
4-
5-
if (propertyBool('publish_to_maven')) {
6-
assertProperty('maven_name')
7-
assertProperty('maven_url')
1+
if (publish_to_maven.toBoolean()) {
82
publishing {
93
repositories {
104
maven {
11-
name propertyString('maven_name').replaceAll("\\s", "")
12-
url propertyString('maven_url')
5+
name = maven_name.replaceAll("\\s", "")
6+
url = maven_url
137
credentials(PasswordCredentials)
148
}
159
}
1610
publications {
1711
mavenJava(MavenPublication) {
1812
from components.java // Publish with standard artifacts
19-
setGroupId(propertyString('root_package'))// Publish with root package as maven group
20-
setArtifactId(propertyString('mod_id')) // Publish artifacts with mod id as the artifact id
13+
setGroupId(root_package)// Publish with root package as maven group
14+
setArtifactId(mod_id) // Publish artifacts with mod id as the artifact id
2115

2216
// Custom artifact:
2317
// If you want to publish a different artifact to the one outputted when building normally

0 commit comments

Comments
 (0)