Demonstrate configureEach in run configs (#9594)

This commit is contained in:
Paint_Ninja 2023-06-27 12:57:08 +01:00 committed by GitHub
parent 3ea735a901
commit 7e52cbf56a

View file

@ -58,7 +58,8 @@ minecraft {
// Default run configurations. // Default run configurations.
// These can be tweaked, removed, or duplicated as needed. // These can be tweaked, removed, or duplicated as needed.
runs { runs {
client { // applies to all the run configs below
configureEach {
workingDirectory project.file('run') workingDirectory project.file('run')
// Recommended logging data for a userdev environment // Recommended logging data for a userdev environment
@ -73,9 +74,6 @@ minecraft {
// Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
property 'forge.logging.console.level', 'debug' property 'forge.logging.console.level', 'debug'
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
property 'forge.enabledGameTestNamespaces', mod_id
mods { mods {
"${mod_id}" { "${mod_id}" {
source sourceSets.main source sourceSets.main
@ -83,56 +81,29 @@ minecraft {
} }
} }
client {
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
property 'forge.enabledGameTestNamespaces', mod_id
}
server { server {
workingDirectory project.file('run')
property 'forge.logging.markers', 'REGISTRIES'
property 'forge.logging.console.level', 'debug'
property 'forge.enabledGameTestNamespaces', mod_id property 'forge.enabledGameTestNamespaces', mod_id
args '--nogui'
mods {
"${mod_id}" {
source sourceSets.main
}
}
} }
// This run config launches GameTestServer and runs all registered gametests, then exits. // This run config launches GameTestServer and runs all registered gametests, then exits.
// By default, the server will crash when no gametests are provided. // By default, the server will crash when no gametests are provided.
// The gametest system is also enabled by default for other run configs under the /test command. // The gametest system is also enabled by default for other run configs under the /test command.
gameTestServer { gameTestServer {
workingDirectory project.file('run')
property 'forge.logging.markers', 'REGISTRIES'
property 'forge.logging.console.level', 'debug'
property 'forge.enabledGameTestNamespaces', mod_id property 'forge.enabledGameTestNamespaces', mod_id
mods {
"${mod_id}" {
source sourceSets.main
}
}
} }
data { data {
workingDirectory project.file('run') // example of overriding the workingDirectory set in configureEach above
workingDirectory project.file('run-data')
property 'forge.logging.markers', 'REGISTRIES'
property 'forge.logging.console.level', 'debug'
// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources. // Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/') args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
mods {
"${mod_id}" {
source sourceSets.main
}
}
} }
} }
} }