273 lines
7.9 KiB
Groovy
273 lines
7.9 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.10-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 {
|
|
//propertyBool('use_access_transformer')
|
|
if (true) {
|
|
accessTransformer "${rootProject.projectDir}/cleanroom/src/main/resources/1_12_2_distanthorizons_at.cfg"
|
|
}
|
|
loader "0.4.4-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()
|
|
}
|
|
|
|
println "Classpath size BEFORE: ${classpath.files.size()}"
|
|
|
|
classpath = classpath.filter { file ->
|
|
def remove =
|
|
file.path.contains("DistantHorizons-common") ||
|
|
file.path.contains("DistantHorizons-core") ||
|
|
file.path.contains("DistantHorizons-api")
|
|
|
|
if (remove) {
|
|
println "Removing from classpath: $file"
|
|
}
|
|
|
|
return !remove
|
|
}
|
|
|
|
println "Classpath size AFTER: ${classpath.files.size()}"
|
|
|
|
def extraPath = [
|
|
sourceSets.main.output.classesDirs.asPath,
|
|
sourceSets.main.output.resourcesDir.absolutePath,
|
|
rootProject.project(':common').sourceSets.main.output.classesDirs.asPath,
|
|
rootProject.project(':core').sourceSets.main.output.classesDirs.asPath,
|
|
rootProject.project(':api').sourceSets.main.output.classesDirs.asPath,
|
|
].join(File.pathSeparator)
|
|
|
|
jvmArgs -= ("-Dcrl.dev.extrapath=")
|
|
jvmArgs += ("-Dcrl.dev.extrapath=${extraPath}")
|
|
|
|
if (false) {
|
|
systemProperty("foundation.dump", "true")
|
|
systemProperty("foundation.verbose", "true")
|
|
}
|
|
//propertyBool('is_coremod')
|
|
if (true) {
|
|
//coremod_plugin_class_name
|
|
//forge for now bcs it will crash but correct is .cleanroom
|
|
systemProperty("fml.coreMods.load", "com.seibel.distanthorizons.cleanroom.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 {
|
|
compileOnly "com.cleanroommc:sponge-mixin:0.20.12+mixin.0.8.7"
|
|
}
|
|
|
|
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 {
|
|
archiveClassifier = 'dev'
|
|
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
|
if (configurations.contain.size() > 0) {
|
|
into('/') {
|
|
from configurations.contain
|
|
}
|
|
}
|
|
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'] = "com.seibel.distanthorizons.cleanroom.DistantHorizonsLoadingPlugin"
|
|
//coremod_includes_mod
|
|
if (true) {
|
|
attribute_map['FMLCorePluginContainsFMLMod'] = true
|
|
}
|
|
}
|
|
//propertyBool('use_access_transformer')
|
|
if (true) {
|
|
attribute_map['FMLAT'] = "1_12_2_distanthorizons_at.cfg"
|
|
}
|
|
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)
|
|
})
|
|
//propertyBool('show_testing_output')
|
|
if (false) {
|
|
testLogging {
|
|
showStandardStreams = true
|
|
}
|
|
}
|
|
}
|
|
|
|
tasks.withType(JavaCompile).configureEach {
|
|
options.encoding = 'UTF-8'
|
|
} |