Rework buildscript
This commit is contained in:
135
build.gradle
135
build.gradle
@@ -1,37 +1,28 @@
|
||||
import org.gradle.plugins.ide.eclipse.model.AccessRule
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
maven {
|
||||
url = 'https://files.minecraftforge.net/maven'
|
||||
}
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
|
||||
}
|
||||
plugins {
|
||||
id 'java'
|
||||
id 'eclipse'
|
||||
id 'net.minecraftforge.gradle' version '5.1.+'
|
||||
}
|
||||
|
||||
apply plugin: 'net.minecraftforge.gradle'
|
||||
apply plugin: 'eclipse'
|
||||
|
||||
version = "${minecraft_version}-${version}"
|
||||
archivesBaseName = 'WorldHandler'
|
||||
version = "${minecraft_version}-${mod_version}"
|
||||
archivesBaseName = project.name
|
||||
|
||||
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
|
||||
println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + ' (' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch'))
|
||||
|
||||
minecraft {
|
||||
// The mappings can be changed at any time, and must be in the following format.
|
||||
// The mappings can be changed at any time and must be in the following format.
|
||||
// Channel: Version:
|
||||
// snapshot YYYYMMDD Snapshot are built nightly.
|
||||
// stable # Stables are built at the discretion of the MCP team.
|
||||
// official MCVersion Official field/method names from Mojang mapping files
|
||||
// official MCVersion Official field/method names from Mojang mapping files
|
||||
// parchment YYYY.MM.DD-MCVersion Open community-sourced parameter names and javadocs layered on top of official
|
||||
//
|
||||
// You must be aware of the Mojang license when using the 'official' mappings.
|
||||
// You must be aware of the Mojang license when using the 'official' or 'parchment' mappings.
|
||||
// See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md
|
||||
//
|
||||
// Use non-default mappings at your own risk. they may not always work.
|
||||
// Parchment is an unofficial project maintained by ParchmentMC, separate from MinecraftForge
|
||||
// Additional setup is needed to use their mappings: https://github.com/ParchmentMC/Parchment/wiki/Getting-Started
|
||||
//
|
||||
// Use non-default mappings at your own risk. They may not always work.
|
||||
// Simply re-run your setup task after changing the mappings to update your workspace.
|
||||
mappings channel: 'official', version: minecraft_version
|
||||
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
|
||||
@@ -41,14 +32,23 @@ minecraft {
|
||||
runs {
|
||||
client {
|
||||
workingDirectory project.file('run')
|
||||
taskName 'WorldHandler Client'
|
||||
taskName project.name + ' Client'
|
||||
|
||||
// Recommended logging data for a userdev environment
|
||||
// property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
|
||||
// The markers can be added/remove as needed separated by commas.
|
||||
// "SCAN": For mods scan.
|
||||
// "REGISTRIES": For firing of registry events.
|
||||
// "REGISTRYDUMP": For getting the contents of all registries.
|
||||
// property 'forge.logging.markers', 'REGISTRIES'
|
||||
|
||||
// Recommended logging level for the console
|
||||
// You can set various levels here.
|
||||
// Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
|
||||
// property 'forge.logging.console.level', 'debug'
|
||||
|
||||
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
|
||||
// property 'forge.enabledGameTestNamespaces', "${mod_id}"
|
||||
|
||||
mods {
|
||||
worldhandler {
|
||||
source sourceSets.main
|
||||
@@ -58,13 +58,29 @@ minecraft {
|
||||
|
||||
server {
|
||||
workingDirectory project.file('run')
|
||||
taskName 'WorldHandler Server'
|
||||
taskName project.name + ' Server'
|
||||
|
||||
// Recommended logging data for a userdev environment
|
||||
// property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
|
||||
|
||||
// Recommended logging level for the console
|
||||
// property 'forge.logging.markers', 'REGISTRIES'
|
||||
// property 'forge.logging.console.level', 'debug'
|
||||
// property 'forge.enabledGameTestNamespaces', 'examplemod'
|
||||
|
||||
mods {
|
||||
worldhandler {
|
||||
source sourceSets.main
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// This run config launches GameTestServer and runs all registered gametests, then exits.
|
||||
// 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.
|
||||
gameTestServer {
|
||||
workingDirectory project.file('run')
|
||||
taskName project.name + ' GameTestServer'
|
||||
|
||||
// property 'forge.logging.markers', 'REGISTRIES'
|
||||
// property 'forge.logging.console.level', 'debug'
|
||||
// property 'forge.enabledGameTestNamespaces', 'examplemod'
|
||||
|
||||
mods {
|
||||
worldhandler {
|
||||
@@ -75,15 +91,12 @@ minecraft {
|
||||
|
||||
data {
|
||||
workingDirectory project.file('run')
|
||||
taskName 'WorldHandler Data'
|
||||
taskName project.name + ' Data'
|
||||
|
||||
// Recommended logging data for a userdev environment
|
||||
// property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
|
||||
|
||||
// Recommended logging level for the console
|
||||
// property 'forge.logging.markers', 'REGISTRIES'
|
||||
// property 'forge.logging.console.level', 'debug'
|
||||
|
||||
args '--mod', 'worldhandler', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
|
||||
args '--mod', 'examplemod', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
|
||||
|
||||
mods {
|
||||
worldhandler {
|
||||
@@ -94,14 +107,18 @@ minecraft {
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets.main.resources {
|
||||
srcDir 'src/generated/resources'
|
||||
}
|
||||
|
||||
repositories {
|
||||
// Put repositories for dependencies here
|
||||
// ForgeGradle automatically adds the Forge maven and Maven Central for you
|
||||
|
||||
// If you have mod jar dependencies in ./libs, you can declare them as a repository like so:
|
||||
// flatDir {
|
||||
// dir 'libs'
|
||||
// }
|
||||
// ForgeGradle automatically adds the Forge maven and Maven Central for you
|
||||
|
||||
// If you have mod jar dependencies in ./libs, you can declare them as a repository like so:
|
||||
// flatDir {
|
||||
// dir 'libs'
|
||||
// }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@@ -110,19 +127,13 @@ dependencies {
|
||||
// The userdev artifact is a special name and will get all sorts of transformations applied to it.
|
||||
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
|
||||
|
||||
// You may put jars on which you depend on in ./libs or you may define them like so..
|
||||
// compile "some.group:artifact:version:classifier"
|
||||
// compile "some.group:artifact:version"
|
||||
// Real mod deobf dependency examples - these get remapped to your current mappings
|
||||
// compileOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}:api") // Adds JEI API as a compile dependency
|
||||
// runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}") // Adds the full JEI mod as a runtime dependency
|
||||
// implementation fg.deobf("com.tterrag.registrate:Registrate:MC${mc_version}-${registrate_version}") // Adds registrate as a dependency
|
||||
|
||||
// Real examples
|
||||
// compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env
|
||||
// compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env
|
||||
|
||||
// The 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime.
|
||||
// provided 'com.mod-buildcraft:buildcraft:6.0.8:dev'
|
||||
|
||||
// These dependencies get remapped to your current MCP mappings
|
||||
// deobf 'com.mod-buildcraft:buildcraft:6.0.8:dev'
|
||||
// Examples using mod jars from ./libs
|
||||
// implementation fg.deobf("blank:coolmod-${mc_version}:${coolmod_version}")
|
||||
|
||||
// For more info...
|
||||
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
|
||||
@@ -136,7 +147,7 @@ jar {
|
||||
"Specification-Vendor": "Exopandora",
|
||||
"Specification-Version": "1",
|
||||
"Implementation-Title": project.name,
|
||||
"Implementation-Version": "${version}",
|
||||
"Implementation-Version": project.jar.archiveVersion,
|
||||
"Implementation-Vendor": "Exopandora",
|
||||
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
|
||||
"Main-Class": "exopandora.worldhandler.Main"
|
||||
@@ -145,7 +156,17 @@ jar {
|
||||
}
|
||||
|
||||
processResources {
|
||||
filesMatching(['mods.toml']) {
|
||||
expand project.properties
|
||||
outputs.upToDateWhen {
|
||||
false
|
||||
}
|
||||
|
||||
from sourceSets.main.resources
|
||||
|
||||
filesMatching(['META-INF/mods.toml']) {
|
||||
expand project.properties
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
options.encoding = 'UTF-8'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user