142 lines
4.0 KiB
Groovy
142 lines
4.0 KiB
Groovy
plugins {
|
|
id 'java-library'
|
|
id 'maven-publish'
|
|
id 'net.neoforged.gradle.userdev' version '7.1.26'
|
|
}
|
|
|
|
version = mod_version
|
|
group = mod_group_id
|
|
|
|
base {
|
|
archivesName = 'warium-neoforge-1.21.1'
|
|
}
|
|
|
|
java.toolchain.languageVersion = JavaLanguageVersion.of(21)
|
|
|
|
sourceSets {
|
|
main {
|
|
java {
|
|
srcDir 'src/generated/java'
|
|
}
|
|
resources {
|
|
srcDir 'src/generated/resources'
|
|
exclude '**/*.bbmodel'
|
|
exclude 'src/generated/**/.cache'
|
|
}
|
|
}
|
|
}
|
|
|
|
repositories {
|
|
maven {
|
|
name = 'NeoForge'
|
|
url = 'https://maven.neoforged.net/releases'
|
|
}
|
|
flatDir {
|
|
dirs 'run/server/mods', 'ci/required-mods'
|
|
}
|
|
}
|
|
|
|
configurations {
|
|
runtimeClasspath.extendsFrom localRuntime
|
|
}
|
|
|
|
dependencies {
|
|
implementation "net.neoforged:neoforge:${neo_version}"
|
|
localRuntime fileTree(dir: 'run/server/mods', include: ['*.jar'])
|
|
localRuntime fileTree(dir: 'ci/required-mods', include: ['*.jar'])
|
|
}
|
|
|
|
runs {
|
|
configureEach {
|
|
systemProperty 'forge.logging.markers', 'REGISTRIES'
|
|
systemProperty 'forge.logging.console.level', 'debug'
|
|
workingDirectory project.layout.projectDirectory.dir('run').dir(name)
|
|
modSource project.sourceSets.main
|
|
}
|
|
|
|
client {
|
|
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
|
|
}
|
|
|
|
server {
|
|
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
|
|
argument '--nogui'
|
|
}
|
|
|
|
gameTestServer {
|
|
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
|
|
}
|
|
|
|
data {
|
|
arguments.addAll '--mod', project.mod_id, '--all',
|
|
'--output', file('src/generated/resources/').getAbsolutePath(),
|
|
'--existing', file('src/main/resources/').getAbsolutePath()
|
|
}
|
|
}
|
|
|
|
tasks.register('generatePortSources', Exec) {
|
|
group = 'warium port'
|
|
description = 'Downloads Warium 1.2.7, verifies it, extracts resources, and generates NeoForge registry stubs.'
|
|
commandLine 'python', 'tools/generate_port_sources.py'
|
|
}
|
|
|
|
tasks.register('decompileOriginal', Exec) {
|
|
group = 'warium port'
|
|
description = 'Downloads and decompiles the original Warium jar for manual porting work.'
|
|
commandLine 'python', 'tools/decompile_original.py'
|
|
}
|
|
|
|
tasks.register('checkRequiredIntegrations', Exec) {
|
|
group = 'verification'
|
|
description = 'Checks required Warium ecosystem integration availability.'
|
|
commandLine 'python', 'tools/check_required_integrations.py'
|
|
}
|
|
|
|
tasks.register('registryParity', Exec) {
|
|
group = 'verification'
|
|
description = 'Checks generated registry stubs against the original jar inventory.'
|
|
commandLine 'python', 'tools/registry_parity.py'
|
|
dependsOn tasks.named('generatePortSources')
|
|
}
|
|
|
|
compileJava.dependsOn tasks.named('generatePortSources')
|
|
processResources.dependsOn tasks.named('generatePortSources')
|
|
build.dependsOn tasks.named('registryParity')
|
|
|
|
tasks.withType(ProcessResources).configureEach {
|
|
var replaceProperties = [
|
|
minecraft_version : minecraft_version,
|
|
minecraft_version_range: minecraft_version_range,
|
|
neo_version : neo_version,
|
|
neo_version_range : neo_version_range,
|
|
loader_version_range : loader_version_range,
|
|
mod_id : mod_id,
|
|
mod_name : mod_name,
|
|
mod_license : mod_license,
|
|
mod_version : mod_version,
|
|
mod_authors : mod_authors,
|
|
mod_description : mod_description
|
|
]
|
|
inputs.properties replaceProperties
|
|
filesMatching(['META-INF/neoforge.mods.toml']) {
|
|
expand replaceProperties
|
|
}
|
|
}
|
|
|
|
tasks.withType(JavaCompile).configureEach {
|
|
options.encoding = 'UTF-8'
|
|
}
|
|
|
|
publishing {
|
|
publications {
|
|
register('mavenJava', MavenPublication) {
|
|
from components.java
|
|
}
|
|
}
|
|
repositories {
|
|
maven {
|
|
url "file://${project.projectDir}/repo"
|
|
}
|
|
}
|
|
}
|