1.12.2 buildscript

This commit is contained in:
Vojtěch Šokala
2026-02-20 15:00:13 +01:00
parent 2866aefb90
commit 1d0d67d215
8 changed files with 425 additions and 10 deletions
+11 -3
View File
@@ -8,6 +8,17 @@ import org.apache.tools.zip.ZipOutputStream
import java.util.function.Function
import java.util.function.Predicate
buildscript {
configurations.configureEach {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == "org.apache.commons" && details.requested.name == "commons-compress") {
details.useVersion("1.28.0")
details.because("Needed because of Cleanroom. net.minecraftforge:DiffPatch:2.0.7 from dev.architectury.loom pulls ancient commons-compress 1.18")
}
}
}
}
plugins {
id "java"
@@ -25,7 +36,6 @@ plugins {
id "dev.architectury.loom" version "1.13-SNAPSHOT" apply false
}
/**
* Creates the list of preprocessors to use.
*
@@ -596,8 +606,6 @@ allprojects { p ->
// VanillaGradle and Mixins in common
maven { url "https://repo.spongepowered.org/maven/" }
// Canvas mod
maven { url "https://maven.vram.io/" }
// ModMenu mod
maven { url "https://maven.terraformersmc.com/" }
+233
View File
@@ -0,0 +1,233 @@
plugins {
id 'java'
id 'java-library'
id 'maven-publish'
id 'com.gradleup.shadow' version '9.2.2'
id 'xyz.wagyourtail.unimined' version '1.4.9-kappa'
id 'net.kyori.blossom' version '2.1.0'
}
apply from: 'gradle/scripts/helpers.gradle'
// Early Assertions
assertProperty 'mod_version'
assertProperty 'maven_group'
assertProperty 'mod_id'
assertProperty 'mod_name'
version = propertyString('mod_version')
group = propertyString('maven_group')
//base {
// archivesName.set(propertyString('mod_id'))
//}
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(21))
}
//propertyBool('generate_sources_jar')
if (true) {
withSourcesJar()
}
//propertyBool('generate_javadocs_jar')
if (false) {
withJavadocJar()
}
}
configurations {
embed
contain
implementation.extendsFrom(embed)
implementation.extendsFrom(contain)
modCompileOnly
compileOnly.extendsFrom(modCompileOnly)
modRuntimeOnly
runtimeOnly.extendsFrom(modRuntimeOnly)
}
unimined.minecraft {
version "1.12.2"
mappings {
mcp("stable", "39-1.12")
}
cleanroom {
loader "0.3.31-alpha"
runs.auth.username = "Developer"
runs.all {
systemProperty("crl.dev.mixin", "${mod_id}.default.mixin.json,${mod_id}.mod.mixin.json")
def extraArgs = ''
if (extraArgs != null && !extraArgs.trim().isEmpty()) {
jvmArgs += extraArgs.split { "\\s+" }.toList()
}
if (propertyBool('enable_foundation_debug')) {
systemProperty("foundation.dump", "true")
systemProperty("foundation.verbose", "true")
}
//propertyBool('is_coremod')
if (true) {
//coremod_plugin_class_name
systemProperty("fml.coreMods.load", propertyString('com.seibel.distanthorizons.forge.DistantHorizonsLoadingPlugin'))
}
return
}
}
defaultRemapJar = false
if (propertyBool('enable_shadow')) {
remap(tasks.shadowJar) {
mixinRemap {
enableBaseMixin()
enableMixinExtra()
disableRefmap()
}
}
} else {
remap(tasks.jar) {
mixinRemap {
enableBaseMixin()
enableMixinExtra()
disableRefmap()
}
}
}
mods {
remap(configurations.modCompileOnly)
remap(configurations.modRuntimeOnly)
}
}
dependencies {
//propertyBool('enable_junit_testing')
if (true) {
testImplementation 'org.junit.jupiter:junit-jupiter:5.7.1'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}
}
processResources {
inputs.property 'mod_id', propertyString('mod_id')
inputs.property 'mod_name', propertyString('mod_name')
inputs.property 'mod_version', propertyString('mod_version')
inputs.property 'mod_description', propertyString('mod_description')
inputs.property 'mod_authors', "${propertyStringList('mod_authors', ',').join(', ')}"
inputs.property 'mod_credits', propertyString('mod_credits')
inputs.property 'mod_url', propertyString('mod_url')
inputs.property 'mod_update_json', propertyString('mod_update_json')
inputs.property 'mod_logo_path', propertyString('mod_logo_path')
def filterList = ['mcmod.info', 'pack.mcmeta']
filesMatching(filterList) { fcd ->
fcd.expand(
'mod_id': propertyString('mod_id'),
'mod_name': propertyString('mod_name'),
'mod_version': propertyString('mod_version'),
'mod_description': propertyString('mod_description'),
'mod_authors': "${propertyStringList('mod_authors', ',').join(', ')}",
'mod_credits': propertyString('mod_credits'),
'mod_url': propertyString('mod_url'),
'mod_update_json': propertyString('mod_update_json'),
'mod_logo_path': propertyString('mod_logo_path'),
)
}
rename '(.+_at.cfg)', 'META-INF/$1'
}
sourceSets {
main {
blossom {
javaSources {
property('mod_id', propertyString('mod_id'))
property('mod_name', propertyString('mod_name'))
property('mod_version', propertyString('mod_version'))
property('package', "${maven_group}.${mod_id}")
}
}
}
}
if (!propertyBool('enable_shadow')) {
shadowJar.enabled = false
}
jar {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
if (configurations.contain.size() > 0) {
into('/') {
from configurations.contain
}
}
doFirst {
manifest {
def attribute_map = [:]
attribute_map['ModType'] = "CRL"
attribute_map['MixinConfigs'] = "${mod_id}.default.mixin.json,${mod_id}.mod.mixin.json"
if (configurations.contain.size() > 0) {
attribute_map['ContainedDeps'] = configurations.contain.collect { it.name }.join(' ')
attribute_map['NonModDeps'] = true
}
//propertyBool('is_coremod')
if (true) {
//coremod_plugin_class_name
attribute_map['FMLCorePlugin'] = propertyString('com.seibel.distanthorizons.cleanroom.DistantHorizonsLoadingPlugin')
//coremod_includes_mod
if (true) {
attribute_map['FMLCorePluginContainsFMLMod'] = true
}
}
if (propertyBool('use_access_transformer')) {
attribute_map['FMLAT'] = propertyString('access_transformer_locations')
}
attributes(attribute_map)
}
}
if (propertyBool('enable_shadow')) {
finalizedBy(tasks.named("remapShadowJar"))
} else {
finalizedBy(tasks.named("remapJar"))
}
}
shadowJar {
configurations = [project.configurations.shadow]
archiveClassifier = "shadow"
}
remapJar {
doFirst {
logging.captureStandardOutput LogLevel.INFO
}
doLast {
logging.captureStandardOutput LogLevel.QUIET
}
}
compileTestJava {
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_21
}
test {
useJUnitPlatform()
javaLauncher.set(javaToolchains.launcherFor {
languageVersion = JavaLanguageVersion.of(21)
})
if (propertyBool('show_testing_output')) {
testLogging {
showStandardStreams = true
}
}
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
}
+96
View File
@@ -0,0 +1,96 @@
import groovy.text.SimpleTemplateEngine
import org.codehaus.groovy.runtime.MethodClosure
ext.propertyString = this.&propertyString as MethodClosure
ext.propertyBool = this.&propertyBool as MethodClosure
ext.propertyStringList = this.&propertyStringList as MethodClosure
ext.interpolate = this.&interpolate as MethodClosure
ext.assertProperty = this.&assertProperty as MethodClosure
ext.assertSubProperties = this.&assertSubProperties as MethodClosure
ext.setDefaultProperty = this.&setDefaultProperty as MethodClosure
ext.assertEnvironmentVariable = this.&assertEnvironmentVariable as MethodClosure
String propertyString(String key) {
return $property(key).toString()
}
boolean propertyBool(String key) {
return propertyString(key).toBoolean()
}
Collection<String> propertyStringList(String key) {
return propertyStringList(key, ' ')
}
Collection<String> propertyStringList(String key, String delimit) {
return propertyString(key).split(delimit).findAll { !it.isEmpty() }
}
private Object $property(String key) {
def value = project.findProperty(key)
if (value instanceof String) {
return interpolate(value)
}
return value
}
String interpolate(String value) {
if (value.startsWith('${{') && value.endsWith('}}')) {
value = value.substring(3, value.length() - 2)
Binding newBinding = new Binding(this.binding.getVariables())
newBinding.setProperty('it', this)
return new GroovyShell(this.getClass().getClassLoader(), newBinding).evaluate(value)
}
if (value.contains('${')) {
return new SimpleTemplateEngine().createTemplate(value).make(project.properties).toString()
}
return value
}
void assertProperty(String propertyName) {
def property = property(propertyName)
if (property == null) {
throw new GradleException("Property ${propertyName} is not defined!")
}
if (property.isEmpty()) {
throw new GradleException("Property ${propertyName} is empty!")
}
}
void assertSubProperties(String propertyName, String... subPropertyNames) {
assertProperty(propertyName)
if (propertyBool(propertyName)) {
for (String subPropertyName : subPropertyNames) {
assertProperty(subPropertyName)
}
}
}
void setDefaultProperty(String propertyName, boolean warn, defaultValue) {
def property = property(propertyName)
def exists = true
if (property == null) {
exists = false
if (warn) {
project.logger.log(LogLevel.WARN, "Property ${propertyName} is not defined!")
}
} else if (property.isEmpty()) {
exists = false
if (warn) {
project.logger.log(LogLevel.WARN, "Property ${propertyName} is empty!")
}
}
if (!exists) {
project.setProperty(propertyName, defaultValue.toString())
}
}
void assertEnvironmentVariable(String propertyName) {
def property = System.getenv(propertyName)
if (property == null) {
throw new GradleException("System Environment Variable $propertyName is not defined!")
}
if (property.isEmpty()) {
throw new GradleException("Property $propertyName is empty!")
}
}
+7 -5
View File
@@ -10,13 +10,15 @@ buildscript {
}
}
plugins {
id "org.spongepowered.gradle.vanilla" version "0.2.1-SNAPSHOT"
if (rootProject.minecraft_version != "1.12.2") {
apply plugin: "org.spongepowered.gradle.vanilla" version "0.2.1-SNAPSHOT"
}
minecraft {
accessWideners(project(":common").file("src/main/resources/${accessWidenerVersion}.distanthorizons.accesswidener"))
version(rootProject.minecraft_version)
if (rootProject.minecraft_version != "1.12.2") {
minecraft {
accessWideners(project(":common").file("src/main/resources/${accessWidenerVersion}.distanthorizons.accesswidener"))
version(rootProject.minecraft_version)
}
}
dependencies {
@@ -43,7 +43,10 @@ public class VersionConstants implements IVersionConstants
// it can't load client classes when running as a dedicated server,
// which was how we were dynamically accessing the MC version string
#if MC_VER == MC_1_16_5
#if MC_VER == MC_1_12_2
return "1.12.2";
#elif MC_VER == MC_1_16_5
return "1.16.5";
#elif MC_VER == MC_1_17_1
+2 -1
View File
@@ -9,6 +9,7 @@ mod_version=2.4.6-b-dev
api_version=5.1.0
maven_group=com.seibel.distanthorizons
mod_readable_name=Distant Horizons
mod_id=distanthorizons
mod_description=This mod generates and renders simplified terrain beyond the normal view distance at a low performance cost. Allowing you to see much farther without turning your game into a slideshow.
# Note: In forge's mods.toml this is hard coded because Architectury throws an error with setting it as a variable
mod_authors=["James Seibel", "Leonardo Amato", "Cola", "coolGi", "Ran", "Leetom", "pshsh"]
@@ -51,7 +52,7 @@ versionStr=
# This defines what MC version Intellij will use for the preprocessor
# and what version is used automatically by build and run commands
mcVer=1.21.11
mcVer=1.12.2
# Defines the maximum amount of memory Minecraft is allowed when run in a development environment
#minecraftMemoryJavaArg="-Xmx4G"
+9
View File
@@ -32,6 +32,15 @@ pluginManagement {
name "ParchmentMC"
url "https://maven.parchmentmc.org"
}
maven {
url = "https://maven.wagyourtail.xyz/releases"
}
maven {
url = "https://maven.outlands.top/releases"
}
maven {
url = "https://maven.wagyourtail.xyz/snapshots"
}
mavenCentral()
gradlePluginPortal()
+63
View File
@@ -0,0 +1,63 @@
# 1.12.2 version
java_version=21
minecraft_version=1.12.2
parchment_version=
compatible_minecraft_versions=["1.12.2"]
accessWidenerVersion=
builds_for=cleanroom
embed_joml=true
# Netty
netty_version=4.2.9.Final
# LWJGL
lwjgl_version=3.3.6
# Fabric loader
fabric_loader_version=
fabric_api_version=
# Fabric mod versions
modmenu_version=
starlight_version_fabric=
phosphor_version_fabric=
lithium_version=
sodium_version=
iris_version=
bclib_version=
immersive_portals_version=
canvas_version=
# iris - needs 1.7.4+ to support the DH API
fabric_incompatibility_list={ "iris": "*" }
fabric_recommend_list={}
# Fabric mod run
# 0 = Don't enable and don't run
# 1 = Can be referenced in code but doesn't run
# 2 = Can be referenced in code and runs in client
enable_mod_menu=0
enable_starlight=0
enable_phosphor=0
enable_lithium=0
enable_sodium=0
enable_iris=0
# not available via github, use curse.maven if necessary
enable_bclib=0
enable_immersive_portals=0
enable_canvas=0
# Forge loader
forge_version=
# Neo not used but the variable still needs to be defined to make gradle happy
neoforge_version_range=[*,)
# Forge mod versions
terraforged_version=
# Forge mod run
# 0 = Don't enable and don't run
# 1 = Can be referenced in code but doesn't run
# 2 = Can be referenced in code and runs in client
enable_starlight_forge=0
enable_terraforged=0
enable_terrafirmacraft=0