Skip to content

Commit 744a49b

Browse files
Switch to unimied & minimal packed libs
1 parent d112f59 commit 744a49b

File tree

13 files changed

+466
-257
lines changed

13 files changed

+466
-257
lines changed

build.gradle

Lines changed: 164 additions & 208 deletions
Large diffs are not rendered by default.

gradle.properties

Lines changed: 62 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,71 @@
1-
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
2-
# This is required to provide enough memory for the Minecraft decompilation process.
1+
# Gradle Properties
32
org.gradle.jvmargs = -Xmx3G
43

4+
# Compilation Options
5+
generate_sources_jar = true
6+
generate_javadocs_jar = false
7+
8+
# Testing
9+
enable_junit_testing = false
10+
show_testing_output = false
11+
512
# Mod Information
6-
mod_version = 3.6.3
7-
maven_group = com.cleanroommc
8-
archives_base_name = scalar
13+
# HIGHLY RECOMMEND complying with SemVer for mod_version: https://semver.org/
14+
mod_version = 3.6.4
15+
root_package = com.cleanroommc
916
mod_id = scalar
17+
mod_name = Scalar
18+
19+
# Mod Metadata (Optional)
20+
mod_description = Scala language adapter, ships Scala 3.x
21+
mod_url = https://github.com/CleanroomMC/Scalar
22+
mod_update_json =
23+
# Delimit authors with commas
24+
mod_authors = kappa_maintainer
25+
mod_credits = CleanroomMC
26+
mod_logo_path =
1027

11-
# If any properties changes below this line, run `gradlew setupDecompWorkspace` and refresh gradle again to ensure everything is working correctly.
28+
# Run Configurations
29+
# If multiple arguments/tweak classes are stated, use spaces as the delimiter
30+
minecraft_username = Developer
31+
extra_jvm_args =
1232

13-
# Boilerplate Options
14-
use_mixins = false
15-
use_coremod = true
16-
use_assetmover = false
33+
# Maven Publishing (Provide secret: MAVEN_USER, MAVEN_PASS)
34+
publish_to_maven = false
35+
# Good for debugging artifacts before uploading to remote maven
36+
# GitHub actions won't run if this is true, test this by running the task `publishToMavenLocal`
37+
publish_to_local_maven = false
38+
maven_name = outlands
39+
maven_url = https://maven.outlands.top/releases
1740

18-
# Access Transformer files should be in the root of `resources` folder and with the filename formatted as: `{archives_base_name}_at.cfg`
41+
# Publishing
42+
# release_type can only be: release, beta or alpha (applies to CurseForge / Modrinth)
43+
release_type = release
44+
publish_with_changelog = ${{ it.file('CHANGELOG.md').exists() }}
45+
46+
# If any properties changes below this line, refresh gradle again to ensure everything is working correctly.
47+
48+
# Access Transformers
49+
# A way to change visibility of Minecraft's classes, methods and fields
50+
# An example access transformer file is given in the path: `src/main/resources/example_at.cfg`
51+
# AT files should be in the root of src/main/resources with the filename formatted as: `mod_id_at.cfg`
52+
# Use the property `access_transformer_locations` to state custom AT files if you aren't using the default `mod_id_at.cfg` location
53+
# If multiple locations are stated, use spaces as the delimiter
54+
# WARNING: Use MCP name in AT file. Unimined will remap it to srg name when building.
1955
use_access_transformer = false
56+
access_transformer_locations = ${mod_id}_at.cfg
57+
58+
# Coremods
59+
# The most powerful way to change java classes at runtime, it is however very primitive with little documentation.
60+
# Only make a coremod if you are absolutely sure of what you are doing
61+
# Change the property `coremod_includes_mod` to false if your coremod doesn't have a @Mod annotation
62+
# You MUST state a class name for `coremod_plugin_class_name` if you are making a coremod, the class should implement `IFMLLoadingPlugin`
63+
is_coremod = true
64+
coremod_includes_mod = false
65+
coremod_plugin_class_name =com.cleanroommc.scalar.ScalarLoadingPlugin
2066

21-
# Coremod Arguments
22-
include_mod = false
23-
coremod_plugin_class_name = com.cleanroommc.scalar.ScalarLoadingPlugin
67+
# AssetMover
68+
# Convenient way to allow downloading of assets from official vanilla Minecraft servers, CurseForge, or any direct links
69+
# Documentation: https://github.com/CleanroomMC/AssetMover
70+
use_asset_mover = false
71+
asset_mover_version = 2.5

gradle/scripts/dependencies.gradle

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
apply from: 'gradle/scripts/helpers.gradle'
2+
3+
repositories {
4+
// Other repositories described by default:
5+
// CleanroomMC: https://maven.cleanroommc.com
6+
maven {
7+
name 'CurseMaven'
8+
url 'https://cursemaven.com'
9+
}
10+
maven {
11+
name 'Modrinth'
12+
url 'https://api.modrinth.com/maven'
13+
}
14+
mavenLocal() // Must be last for caching to work
15+
}
16+
17+
dependencies {
18+
implementation "com.cleanroommc:sponge-mixin:0.20.10+mixin.0.8.7"
19+
compileOnly "com.cleanroommc:lwjglx:1.0.0"
20+
21+
22+
contain "org.scala-lang:scala3-library_3:${mod_version}"
23+
contain 'org.scala-lang:scala-library:2.13.16'
24+
// Example - Dependency descriptor:
25+
// 'com.google.code.gson:gson:2.8.6' << group: com.google.code.gson, name:gson, version:2.8.6
26+
// 'group:name:version:classifier' where classifier is optional
27+
28+
// Example - Deobfuscating dependencies:
29+
// rfg.deobf('curse.maven:had-enough-items-557549:4543375')
30+
// By wrapping a dependency descriptor in rfg.deobf() method call, the dependency is queued for deobfuscation
31+
// When deobfuscating, RFG respects the mapping_channel + mapping_version stated in gradle.properties
32+
33+
// Example - CurseMaven dependencies:
34+
// 'curse.maven:had-enough-items-557549:4543375' << had-enough-items = project slug, 557549 = project id, 4543375 = file id
35+
// Full documentation: https://cursemaven.com/
36+
37+
// Example - Modrinth dependencies:
38+
// 'maven.modrinth:jei:4.16.1.1000' << jei = project name, 4.16.1.1000 = file version
39+
// Full documentation: https://docs.modrinth.com/docs/tutorials/maven/
40+
41+
// Common dependency types (configuration):
42+
// implementation = dependency available at both compile time and runtime
43+
// runtimeOnly = runtime dependency
44+
// compileOnly = compile time dependency
45+
// annotationProcessor = annotation processing dependencies
46+
// contain = bundle dependency jars into final artifact, will extract them in mod loading. Please only do this to non-mod dependencies.
47+
// shadow = bundle dependencies into shadow output artifact (relocation configurable in shadowJar task)
48+
49+
// Transitive dependencies:
50+
// (Dependencies that your dependency depends on)
51+
// If you wish to exclude transitive dependencies in the described dependencies
52+
// Use a closure as such:
53+
// implementation ('com.google.code.gson:gson:2.8.6') {
54+
// transitive = false
55+
// }
56+
}

gradle/scripts/extra.gradle

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// You may write any gradle buildscript component in this file
2+
// This file is automatically applied after build.gradle + dependencies.gradle is ran
3+
4+
// If you wish to use the default helper methods, uncomment the line below
5+
// apply from: 'gradle/scripts/helpers.gradle'

gradle/scripts/helpers.gradle

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
import groovy.text.SimpleTemplateEngine
2+
import org.codehaus.groovy.runtime.MethodClosure
3+
4+
ext.propertyString = this.&propertyString as MethodClosure
5+
ext.propertyBool = this.&propertyBool as MethodClosure
6+
ext.propertyStringList = this.&propertyStringList as MethodClosure
7+
ext.interpolate = this.&interpolate as MethodClosure
8+
ext.assertProperty = this.&assertProperty as MethodClosure
9+
ext.assertSubProperties = this.&assertSubProperties as MethodClosure
10+
ext.setDefaultProperty = this.&setDefaultProperty as MethodClosure
11+
ext.assertEnvironmentVariable = this.&assertEnvironmentVariable as MethodClosure
12+
13+
String propertyString(String key) {
14+
return $property(key).toString()
15+
}
16+
17+
boolean propertyBool(String key) {
18+
return propertyString(key).toBoolean()
19+
}
20+
21+
Collection<String> propertyStringList(String key) {
22+
return propertyStringList(key, ' ')
23+
}
24+
25+
Collection<String> propertyStringList(String key, String delimit) {
26+
return propertyString(key).split(delimit).findAll { !it.isEmpty() }
27+
}
28+
29+
private Object $property(String key) {
30+
def value = project.findProperty(key)
31+
if (value instanceof String) {
32+
return interpolate(value)
33+
}
34+
return value
35+
}
36+
37+
String interpolate(String value) {
38+
if (value.startsWith('${{') && value.endsWith('}}')) {
39+
value = value.substring(3, value.length() - 2)
40+
Binding newBinding = new Binding(this.binding.getVariables())
41+
newBinding.setProperty('it', this)
42+
return new GroovyShell(this.getClass().getClassLoader(), newBinding).evaluate(value)
43+
}
44+
if (value.contains('${')) {
45+
return new SimpleTemplateEngine().createTemplate(value).make(project.properties).toString()
46+
}
47+
return value
48+
}
49+
50+
void assertProperty(String propertyName) {
51+
def property = property(propertyName)
52+
if (property == null) {
53+
throw new GradleException("Property ${propertyName} is not defined!")
54+
}
55+
if (property.isEmpty()) {
56+
throw new GradleException("Property ${propertyName} is empty!")
57+
}
58+
}
59+
60+
void assertSubProperties(String propertyName, String... subPropertyNames) {
61+
assertProperty(propertyName)
62+
if (propertyBool(propertyName)) {
63+
for (String subPropertyName : subPropertyNames) {
64+
assertProperty(subPropertyName)
65+
}
66+
}
67+
}
68+
69+
void setDefaultProperty(String propertyName, boolean warn, defaultValue) {
70+
def property = property(propertyName)
71+
def exists = true
72+
if (property == null) {
73+
exists = false
74+
if (warn) {
75+
project.logger.log(LogLevel.WARN, "Property ${propertyName} is not defined!")
76+
}
77+
} else if (property.isEmpty()) {
78+
exists = false
79+
if (warn) {
80+
project.logger.log(LogLevel.WARN, "Property ${propertyName} is empty!")
81+
}
82+
}
83+
if (!exists) {
84+
project.setProperty(propertyName, defaultValue.toString())
85+
}
86+
}
87+
88+
void assertEnvironmentVariable(String propertyName) {
89+
def property = System.getenv(propertyName)
90+
if (property == null) {
91+
throw new GradleException("System Environment Variable $propertyName is not defined!")
92+
}
93+
if (property.isEmpty()) {
94+
throw new GradleException("Property $propertyName is empty!")
95+
}
96+
}

gradle/scripts/publishing.gradle

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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')
8+
publishing {
9+
repositories {
10+
maven {
11+
name propertyString('maven_name').replaceAll("\\s", "")
12+
url propertyString('maven_url')
13+
credentials(PasswordCredentials)
14+
}
15+
}
16+
publications {
17+
mavenJava(MavenPublication) {
18+
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
21+
22+
// Custom artifact:
23+
// If you want to publish a different artifact to the one outputted when building normally
24+
// Create a different gradle task (Jar task), in extra.gradle
25+
// Remove the 'from components.java' line above
26+
// Add this line (change the task name):
27+
// artifacts task_name
28+
}
29+
}
30+
}
31+
}

gradle/wrapper/gradle-wrapper.jar

-17.9 KB
Binary file not shown.
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
44
networkTimeout=10000
5+
validateDistributionUrl=true
56
zipStoreBase=GRADLE_USER_HOME
67
zipStorePath=wrapper/dists

settings.gradle

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,32 @@
11
pluginManagement {
22
repositories {
3+
mavenCentral()
4+
maven {
5+
url = "https://maven.neoforged.net/releases"
6+
}
37
maven {
4-
// RetroFuturaGradle
5-
name 'GTNH Maven'
6-
url 'https://nexus.gtnewhorizons.com/repository/public/'
7-
mavenContent {
8-
includeGroup 'com.gtnewhorizons'
9-
includeGroup 'com.gtnewhorizons.retrofuturagradle'
8+
url = "https://maven.minecraftforge.net/"
9+
}
10+
maven {
11+
url = "https://maven.fabricmc.net/"
12+
}
13+
maven {
14+
url = "https://maven.wagyourtail.xyz/releases"
15+
}
16+
maven {
17+
url = "https://maven.wagyourtail.xyz/snapshots"
18+
}
19+
gradlePluginPortal() {
20+
content {
21+
excludeGroup("org.apache.logging.log4j")
1022
}
1123
}
12-
gradlePluginPortal()
13-
mavenCentral()
14-
mavenLocal()
1524
}
1625
}
1726

1827
plugins {
1928
// Automatic toolchain provisioning
20-
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.4.0'
29+
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.9.0'
2130
}
2231

2332
// Due to an IntelliJ bug, this has to be done

src/main/java/com/cleanroommc/scalar/ScalarModContainer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
public class ScalarModContainer extends DummyModContainer {
77
public ScalarModContainer() {
88
super(new ModMetadata(){{
9-
modId = Tags.MOD_ID;
10-
version = Tags.MOD_VERSION;
9+
modId = Reference.MOD_ID;
10+
version = Reference.VERSION;
1111
name = "Scalar";
1212
}});
1313
}

0 commit comments

Comments
 (0)