Skip to content

Commit 3f5fac1

Browse files
Merge branch 'main' into mixin
2 parents dc4139f + c9113db commit 3f5fac1

7 files changed

Lines changed: 54 additions & 170 deletions

File tree

build.gradle

Lines changed: 45 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -4,45 +4,32 @@ plugins {
44
id 'maven-publish'
55
id 'com.gradleup.shadow' version '9.4.1'
66
id 'org.jetbrains.gradle.plugin.idea-ext' version '1.4.1'
7-
id 'xyz.wagyourtail.unimined' version '1.4.18-kappa'
7+
id 'xyz.wagyourtail.unimined' version '1.4.23-kappa'
88
id 'net.kyori.blossom' version '2.2.0'
99
}
1010

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

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

30-
version = propertyString('mod_version')
31-
group = propertyString('root_package')
18+
version = mod_version
19+
group = root_package
3220

3321
base {
34-
archivesName = propertyString('mod_id')
22+
archivesName = mod_id
3523
}
3624

37-
3825
java {
3926
toolchain {
4027
languageVersion = JavaLanguageVersion.of(25)
4128
}
42-
if (propertyBool('generate_sources_jar')) {
29+
if (generate_sources_jar.toBoolean()) {
4330
withSourcesJar()
4431
}
45-
if (propertyBool('generate_javadocs_jar')) {
32+
if (generate_javadocs_jar.toBoolean()) {
4633
withJavadocJar()
4734
}
4835
}
@@ -56,8 +43,9 @@ configurations {
5643
runtimeOnly.extendsFrom(modRuntimeOnly)
5744
}
5845

59-
String remapTaskName = propertyBool('enable_shadow') ? "remapShadowJar" : "remapJar"
46+
def remapTaskName = enable_shadow.toBoolean() ? "remapShadowJar" : "remapJar"
6047

48+
//noinspection GroovyAssignabilityCheck
6149
unimined.minecraft {
6250
version "1.12.2"
6351

@@ -66,31 +54,31 @@ unimined.minecraft {
6654
}
6755

6856
cleanroom {
69-
if (propertyBool('use_access_transformer')) {
70-
accessTransformer "${rootProject.projectDir}/src/main/resources/${propertyString('access_transformer_locations')}"
57+
if (use_access_transformer.toBoolean()) {
58+
accessTransformer "${rootProject.projectDir}/src/main/resources/$access_transformer_locations"
7159
}
7260
loader "0.5.12-alpha"
7361
runs.all {
7462
systemProperty("crl.dev.mixin", "${mod_id}.default.mixin.json,${mod_id}.mod.mixin.json")
7563
args += ['--username', minecraft_username]
76-
def extraArgs = propertyString('extra_jvm_args')
64+
def extraArgs = extra_jvm_args
7765
if (extraArgs != null && !extraArgs.trim().isEmpty()) {
7866
jvmArgs += extraArgs.split { "\\s+" }.toList()
7967
}
80-
if (propertyBool('enable_foundation_debug')) {
68+
if (enable_foundation_debug.toBoolean()) {
8169
systemProperty("foundation.dump", "true")
8270
systemProperty("foundation.verbose", "true")
8371
}
84-
if (propertyBool('is_coremod')) {
85-
systemProperty("fml.coreMods.load", propertyString('coremod_plugin_class_name'))
72+
if (is_coremod.toBoolean()) {
73+
systemProperty("fml.coreMods.load", coremod_plugin_class_name)
8674
}
8775
return
8876
}
8977
}
9078

9179
defaultRemapJar = false
9280

93-
String jarTaskName = propertyBool('enable_shadow') ? "shadowJar" : "jar"
81+
String jarTaskName = enable_shadow.toBoolean() ? "shadowJar" : "jar"
9482

9583
remap(tasks.named(jarTaskName).get()) {
9684
mixinRemap {
@@ -106,10 +94,10 @@ unimined.minecraft {
10694
}
10795

10896
dependencies {
109-
if (propertyBool('use_asset_mover')) {
110-
implementation "com.cleanroommc:assetmover:${propertyString('asset_mover_version')}"
97+
if (use_asset_mover.toBoolean()) {
98+
implementation "com.cleanroommc:assetmover:${asset_mover_version}"
11199
}
112-
if (propertyBool('enable_junit_testing')) {
100+
if (enable_junit_testing.toBoolean()) {
113101
testImplementation 'org.junit.jupiter:junit-jupiter:6.0.3'
114102
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
115103
}
@@ -125,21 +113,21 @@ sourceSets {
125113
main {
126114
blossom {
127115
javaSources {
128-
property('mod_id', propertyString('mod_id'))
129-
property('mod_name', propertyString('mod_name'))
130-
property('mod_version', propertyString('mod_version'))
116+
property('mod_id', mod_id)
117+
property('mod_name', mod_name)
118+
property('mod_version', mod_version)
131119
property('package', "${root_package}.${mod_id}")
132120
}
133121
resources {
134-
property('mod_id', propertyString('mod_id'))
135-
property('mod_name', propertyString('mod_name'))
136-
property('mod_version', propertyString('mod_version'))
137-
property('mod_description', propertyString('mod_description'))
138-
property('mod_authors', propertyStringList('mod_authors', ',').collect {it.strip()}.join('", "'))
139-
property('mod_credits', propertyString('mod_credits'))
140-
property('mod_url', propertyString('mod_url'))
141-
property('mod_update_json', propertyString('mod_update_json'))
142-
property('mod_logo_path', propertyString('mod_logo_path'))
122+
property('mod_id', mod_id)
123+
property('mod_name', mod_name)
124+
property('mod_version', mod_version)
125+
property('mod_description', mod_description)
126+
property('mod_authors', mod_authors.toString().split(',').findAll { !it.isBlank() }.collect { "\"${it.strip()}\"" }.join(', '))
127+
property('mod_credits', mod_credits)
128+
property('mod_url', mod_url)
129+
property('mod_update_json', mod_update_json)
130+
property('mod_logo_path', mod_logo_path)
143131
}
144132
}
145133
}
@@ -166,20 +154,20 @@ idea {
166154
afterEvaluate {
167155
javacAdditionalOptions = '-encoding utf8'
168156
moduleJavacAdditionalOptions = [
169-
(project.name + '.main'): tasks.compileJava.options.compilerArgs.collect { '"' + it + '"' }.join(' ')
157+
(project.name + '.main'): tasks.compileJava.options.compilerArgs.collect { "\"${it}\"" }.join(' ')
170158
]
171159
}
172160
}
173161
}
174162
}
175163
}
176164

177-
if (!propertyBool('enable_shadow')) {
165+
if (!enable_shadow.toBoolean()) {
178166
shadowJar.enabled = false
179167
}
180168

181169
compileJava {
182-
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_21
170+
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_25
183171
}
184172

185173
jar {
@@ -199,14 +187,14 @@ jar {
199187
attribute_map['ContainedDeps'] = configurations.contain.collect { it.name }.join(' ')
200188
attribute_map['NonModDeps'] = true
201189
}
202-
if (propertyBool('is_coremod')) {
203-
attribute_map['FMLCorePlugin'] = propertyString('coremod_plugin_class_name')
204-
if (propertyBool('coremod_includes_mod')) {
190+
if (is_coremod.toBoolean()) {
191+
attribute_map['FMLCorePlugin'] = coremod_plugin_class_name
192+
if (coremod_includes_mod.toBoolean()) {
205193
attribute_map['FMLCorePluginContainsFMLMod'] = true
206194
}
207195
}
208-
if (propertyBool('use_access_transformer')) {
209-
attribute_map['FMLAT'] = propertyString('access_transformer_locations')
196+
if (use_access_transformer.toBoolean()) {
197+
attribute_map['FMLAT'] = access_transformer_locations
210198
}
211199
attributes(attribute_map)
212200
}
@@ -216,6 +204,7 @@ jar {
216204

217205

218206
shadowJar {
207+
//noinspection GroovyAssignabilityCheck,GroovyAccessibility
219208
configurations = [project.configurations.shadow]
220209
archiveClassifier = "shadow"
221210
}
@@ -231,15 +220,15 @@ tasks.named(remapTaskName).configure {
231220
}
232221

233222
compileTestJava {
234-
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_21
223+
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_25
235224
}
236225

237226
test {
238227
useJUnitPlatform()
239228
javaLauncher.set(javaToolchains.launcherFor {
240229
languageVersion = JavaLanguageVersion.of(25)
241230
})
242-
if (propertyBool('show_testing_output')) {
231+
if (show_testing_output.toBoolean()) {
243232
testLogging {
244233
showStandardStreams = true
245234
}

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
@@ -21,7 +19,7 @@ repositories {
2119

2220
dependencies {
2321
compileOnly "com.cleanroommc:sponge-mixin:0.20.13+mixin.0.8.7"
24-
if (propertyBool('enable_lwjglx')) {
22+
if (enable_lwjglx.toBoolean()) {
2523
compileOnly "com.cleanroommc:lwjglx:1.0.0"
2624
}
2725
modImplementation 'curse.maven:hei-557549:6187146' // Use for mod Mixin example

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

src/main/resource-templates/mcmod.info

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"version": "{{ mod_version }}",
55
"mcversion": "1.12.2",
66
"description": "{{ mod_description }}",
7-
"authorList": ["{{ mod_authors }}"],
7+
"authorList": [{{ mod_authors }}],
88
"credits": "{{ mod_credits }}",
99
"url": "{{ mod_url }}",
1010
"updateJSON": "{{ mod_update_json }}",

0 commit comments

Comments
 (0)