mirror of
https://github.com/neoforged/NeoForge
synced 2026-08-20 08:23:13 -04:00
139 lines
4.4 KiB
Groovy
139 lines
4.4 KiB
Groovy
plugins {
|
|
id 'java'
|
|
id 'net.neoforged.licenser'
|
|
id 'neoforge.formatting-conventions'
|
|
}
|
|
|
|
apply plugin : net.neoforged.neodev.NeoDevExtraPlugin
|
|
|
|
evaluationDependsOn(":neoforge")
|
|
|
|
def neoforgeProject = project(':neoforge')
|
|
|
|
sourceSets {
|
|
main {
|
|
resources {
|
|
srcDir file('src/generated/resources')
|
|
}
|
|
}
|
|
junit {}
|
|
}
|
|
|
|
dependencies {
|
|
implementation(project(':neoforge')) {
|
|
capabilities {
|
|
requireFeature('client')
|
|
}
|
|
}
|
|
implementation(project(':testframework'))
|
|
|
|
junitImplementation(platform("org.junit:junit-bom:${project.jupiter_api_version}"))
|
|
junitImplementation "org.junit.jupiter:junit-jupiter"
|
|
junitImplementation "org.junit.jupiter:junit-jupiter-params"
|
|
junitRuntimeOnly "org.junit.platform:junit-platform-launcher"
|
|
|
|
junitImplementation("org.assertj:assertj-core:${project.assertj_core}")
|
|
junitImplementation "net.neoforged.fancymodloader:junit-fml:${project.fancy_mod_loader_version}"
|
|
junitImplementation(project(':neoforge')) {
|
|
capabilities {
|
|
requireFeature('client')
|
|
}
|
|
}
|
|
junitImplementation(project(':testframework'))
|
|
|
|
compileOnly "org.jetbrains:annotations:${project.jetbrains_annotations_version}"
|
|
}
|
|
|
|
// Select runtimeElements rather than universalJar from the neoforge project
|
|
// (transitive dependency of the NeoForge client sourceset)
|
|
sourceSets.each {
|
|
configurations.named(it.runtimeClasspathConfigurationName) {
|
|
attributes {
|
|
attribute(Attribute.of("net.neoforged.neoforge.includes-minecraft", Boolean), true)
|
|
}
|
|
}
|
|
}
|
|
|
|
junitTest {
|
|
useJUnitPlatform()
|
|
classpath = sourceSets.junit.output + sourceSets.junit.runtimeClasspath
|
|
testClassesDirs = sourceSets.junit.output.classesDirs
|
|
outputs.upToDateWhen { false }
|
|
exclude("**/mixin/**")
|
|
}
|
|
|
|
neoDev {
|
|
mods {
|
|
neotests {
|
|
sourceSet sourceSets.main
|
|
}
|
|
testframework {
|
|
sourceSet project(":testframework").sourceSets.main
|
|
}
|
|
junit {
|
|
sourceSet sourceSets.junit
|
|
}
|
|
coremods {
|
|
sourceSet project(':neoforge-coremods').sourceSets.main
|
|
}
|
|
}
|
|
|
|
runs {
|
|
configureEach {
|
|
gameDirectory = layout.projectDir.dir("run/$name")
|
|
systemProperty("terminal.ansi", "true")
|
|
|
|
// This property allows the test framework to find source files and correctly annotate test failures in action runs
|
|
systemProperty('net.neoforged.testframework.sourceFileRoots', project.file('src/main/java').toPath().toAbsolutePath().toString())
|
|
}
|
|
client {
|
|
client()
|
|
}
|
|
server {
|
|
server()
|
|
}
|
|
gameTestServer {
|
|
type = "gameTestServer"
|
|
systemProperty("eventbus.checkTypesOnDispatch", "true")
|
|
}
|
|
data {
|
|
clientData()
|
|
|
|
programArguments.addAll '--flat', '--all', '--validate',
|
|
'--mod', 'data_gen_test',
|
|
'--mod', 'global_loot_test',
|
|
'--mod', 'scaffolding_test',
|
|
'--mod', 'custom_tag_types_test',
|
|
'--mod', 'new_model_loader_test',
|
|
'--mod', 'remove_tag_datagen_test',
|
|
'--mod', 'tag_based_tool_types',
|
|
'--mod', 'custom_transformtype_test',
|
|
'--mod', 'data_pack_registries_test',
|
|
'--mod', 'biome_modifiers_test',
|
|
'--mod', 'structure_modifiers_test',
|
|
'--mod', 'custom_preset_editor_test',
|
|
'--mod', 'custom_predicate_test',
|
|
'--mod', 'emissive_elements_test',
|
|
'--mod', 'neotests',
|
|
'--existing', project.file("src/main/resources").absolutePath,
|
|
'--output', project.file("src/generated/resources").absolutePath
|
|
}
|
|
}
|
|
|
|
runs.configureEach {
|
|
// Add NeoForge and Minecraft (both under the "minecraft" mod), and exclude junit.
|
|
loadedMods = [neoforgeProject.joinedMod, mods.neotests, mods.testframework, mods.coremods]
|
|
|
|
gameDirectory.set project.file("runs/${it.name}") as File
|
|
}
|
|
}
|
|
|
|
neoDevTest {
|
|
loadedMods = [ neoforgeProject.joinedMod, neoDev.mods.testframework, neoDev.mods.coremods, neoDev.mods.junit ]
|
|
}
|
|
|
|
license {
|
|
header = rootProject.file('codeformat/HEADER.txt')
|
|
skipExistingHeaders = true
|
|
include '**/*.java'
|
|
}
|