Files
distant-horizons-sharded/cleanroom/build.gradle
T
Vojtěch Šokala 1d0d67d215 1.12.2 buildscript
2026-02-20 15:00:13 +01:00

233 lines
6.5 KiB
Groovy

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'
}