2026-10-17 11:49:23 +09:00
|
|
|
plugins {
|
2026-10-18 20:33:45 +09:00
|
|
|
id 'base'
|
|
|
|
|
id 'net.neoforged.gradle.userdev' version '7.1.39' apply false
|
2026-10-17 11:49:23 +09:00
|
|
|
}
|
|
|
|
|
|
2026-10-18 20:33:45 +09:00
|
|
|
subprojects { mod ->
|
|
|
|
|
apply plugin: 'java-library'
|
|
|
|
|
apply plugin: 'checkstyle'
|
|
|
|
|
apply plugin: 'net.neoforged.gradle.userdev'
|
2026-10-17 11:49:23 +09:00
|
|
|
|
2026-10-18 20:33:45 +09:00
|
|
|
group = 'dev.quorate'
|
|
|
|
|
java {
|
|
|
|
|
toolchain.languageVersion = JavaLanguageVersion.of(25)
|
|
|
|
|
withSourcesJar()
|
|
|
|
|
}
|
|
|
|
|
repositories { mavenCentral() }
|
|
|
|
|
configurations { javafmt }
|
|
|
|
|
dependencies {
|
|
|
|
|
implementation 'net.neoforged:neoforge:21.1.250'
|
|
|
|
|
testImplementation 'org.junit.jupiter:junit-jupiter:5.11.4'
|
|
|
|
|
testRuntimeOnly 'org.junit.platform:junit-platform-launcher:1.11.4'
|
|
|
|
|
javafmt('com.google.googlejavaformat:google-java-format:1.37.0:all-deps') { transitive = false }
|
|
|
|
|
}
|
|
|
|
|
checkstyle {
|
|
|
|
|
toolVersion = '14.3.0'
|
|
|
|
|
configFile = rootProject.file('quality.xml')
|
|
|
|
|
}
|
2026-10-17 11:49:23 +09:00
|
|
|
|
2026-10-18 20:33:45 +09:00
|
|
|
def javaSources = fileTree('src') { include '**/*.java' }
|
|
|
|
|
['format': ['--replace'], 'formatCheck': ['--dry-run', '--set-exit-if-changed']].each { name, mode ->
|
|
|
|
|
tasks.register(name, JavaExec) {
|
|
|
|
|
inputs.files(javaSources).skipWhenEmpty()
|
|
|
|
|
javaLauncher = javaToolchains.launcherFor { languageVersion = JavaLanguageVersion.of(25) }
|
|
|
|
|
classpath = configurations.javafmt
|
|
|
|
|
mainClass = 'com.google.googlejavaformat.java.Main'
|
|
|
|
|
jvmArgs = ['api', 'code', 'file', 'parser', 'tree', 'util'].collect {
|
|
|
|
|
"--add-exports=jdk.compiler/com.sun.tools.javac.${it}=ALL-UNNAMED"
|
|
|
|
|
}
|
|
|
|
|
doFirst { args = ['--aosp'] + mode + javaSources.files.sort().collect { it.path } }
|
2026-10-17 11:49:23 +09:00
|
|
|
}
|
|
|
|
|
}
|
2026-10-18 20:33:45 +09:00
|
|
|
tasks.named('formatCheck') { mustRunAfter 'format' }
|
|
|
|
|
tasks.withType(Checkstyle).configureEach { mustRunAfter 'format' }
|
|
|
|
|
tasks.register('quality') { dependsOn 'formatCheck', 'checkstyleMain', 'checkstyleTest' }
|
|
|
|
|
tasks.named('check') { dependsOn 'quality' }
|
|
|
|
|
tasks.named('test') {
|
|
|
|
|
dependsOn 'quality'
|
|
|
|
|
useJUnitPlatform()
|
|
|
|
|
maxHeapSize = '512m'
|
|
|
|
|
jvmArgs '-XX:+UseZGC'
|
|
|
|
|
}
|
|
|
|
|
tasks.named('processResources') {
|
|
|
|
|
inputs.property 'version', provider { mod.version.toString() }
|
|
|
|
|
filesMatching('META-INF/neoforge.mods.toml') { expand version: mod.version.toString() }
|
|
|
|
|
}
|
|
|
|
|
tasks.withType(JavaCompile).matching { it.name in ['compileJava', 'compileTestJava', 'compileProbeJava'] }.configureEach {
|
2026-10-17 11:49:23 +09:00
|
|
|
options.encoding = 'UTF-8'
|
|
|
|
|
options.compilerArgs += ['-Xlint:all', '-Werror', '-proc:none']
|
|
|
|
|
mustRunAfter 'format'
|
|
|
|
|
}
|
2026-10-18 20:33:45 +09:00
|
|
|
tasks.withType(Jar).configureEach {
|
|
|
|
|
preserveFileTimestamps = false
|
|
|
|
|
reproducibleFileOrder = true
|
|
|
|
|
from(['LICENSE.md', 'COPYING', 'COPYING.LESSER', 'NOTICE.md'].collect { rootProject.file(it) }) { into 'META-INF' }
|
2026-10-17 11:49:23 +09:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-10-18 20:33:45 +09:00
|
|
|
['format', 'formatCheck', 'quality'].each { name ->
|
|
|
|
|
tasks.register(name) { dependsOn subprojects.collect { it.tasks.named(name) } }
|
|
|
|
|
}
|
|
|
|
|
['assemble', 'check'].each { name ->
|
|
|
|
|
tasks.named(name) { dependsOn subprojects.collect { it.tasks.named(name) } }
|
2026-10-17 11:49:23 +09:00
|
|
|
}
|