Update build system
This commit is contained in:
parent
b005eeb0fc
commit
6cec3dcbbc
8 changed files with 172 additions and 67 deletions
88
build.gradle
88
build.gradle
|
@ -2,7 +2,8 @@ plugins {
|
|||
id 'eclipse'
|
||||
id 'idea'
|
||||
id 'maven-publish'
|
||||
id 'net.minecraftforge.gradle' version '5.1+'
|
||||
id 'java-library'
|
||||
id 'net.minecraftforge.gradle' version '[6.0,6.2)'
|
||||
id 'org.parchmentmc.librarian.forgegradle' version '1.+'
|
||||
}
|
||||
|
||||
|
@ -13,6 +14,17 @@ base {
|
|||
archivesName = mod_id
|
||||
}
|
||||
|
||||
java {
|
||||
|
||||
withSourcesJar()
|
||||
withJavadocJar()
|
||||
}
|
||||
|
||||
configurations {
|
||||
provided
|
||||
compile.extendsFrom(provided)
|
||||
}
|
||||
|
||||
// Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17.
|
||||
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
|
||||
|
||||
|
@ -27,11 +39,11 @@ minecraft {
|
|||
// See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md
|
||||
//
|
||||
// Parchment is an unofficial project maintained by ParchmentMC, separate from MinecraftForge
|
||||
// Additional setup is needed to use their mappings: https://parchmentmc.org/docs/getting-started
|
||||
// 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: mapping_channel, version: mapping_version
|
||||
mappings channel: mapping_channel, version: "${parchment_version}-${minecraft_version}"
|
||||
|
||||
// When true, this property will have all Eclipse/IntelliJ IDEA run configurations run the "prepareX" task for the given run configuration before launching the game.
|
||||
// In most cases, it is not necessary to enable.
|
||||
|
@ -41,6 +53,7 @@ minecraft {
|
|||
// This property allows configuring Gradle's ProcessResources task(s) to run on IDE output locations before launching the game.
|
||||
// It is REQUIRED to be set to true for this template to function.
|
||||
// See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html
|
||||
copyIdeResources = true
|
||||
|
||||
// When true, this property will add the folder name of all declared run configurations to generated IDE run configurations.
|
||||
// The folder name can be set on a run configuration using the "folderName" property.
|
||||
|
@ -74,6 +87,9 @@ minecraft {
|
|||
// 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 {
|
||||
"${mod_id}" {
|
||||
source sourceSets.main
|
||||
|
@ -88,7 +104,7 @@ minecraft {
|
|||
|
||||
server {
|
||||
property 'forge.enabledGameTestNamespaces', mod_id
|
||||
//args '--nogui'
|
||||
args '--nogui'
|
||||
}
|
||||
|
||||
// This run config launches GameTestServer and runs all registered gametests, then exits.
|
||||
|
@ -112,18 +128,7 @@ 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.
|
||||
// See https://docs.gradle.org/current/userguide/declaring_repositories.html#sub:flat_dir_resolver
|
||||
// flatDir {
|
||||
// dir 'libs'
|
||||
// }
|
||||
maven {
|
||||
name = "Aria's Creations Caches"
|
||||
url = "https://maven.zontreck.com/repository/internal"
|
||||
}
|
||||
mavenCentral()
|
||||
// Put repositories for dependencies here
|
||||
// ForgeGradle automatically adds the Forge maven and Maven Central for you
|
||||
|
||||
|
@ -139,8 +144,9 @@ repositories {
|
|||
|
||||
maven {
|
||||
name = "zontreck Maven"
|
||||
url = "https://maven.zontreck.com/repository/zontreck"
|
||||
url = "https://git.zontreck.com/api/packages/MinecraftMods/maven"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
@ -151,7 +157,8 @@ dependencies {
|
|||
// then special handling is done to allow a setup of a vanilla dependency without the use of an external repository.
|
||||
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
|
||||
|
||||
implementation fg.deobf("dev.zontreck:LibZontreckMod:${libzontreck}")
|
||||
provided "dev.zontreck:LibZontreck:${libzontreck}"
|
||||
|
||||
// Example mod dependency with JEI - using fg.deobf() ensures the dependency is remapped to your development mappings
|
||||
// The JEI API is declared for compile time use, while the full JEI artifact is used at runtime
|
||||
// compileOnly fg.deobf("mezz.jei:jei-${mc_version}-common-api:${jei_version}")
|
||||
|
@ -168,9 +175,33 @@ dependencies {
|
|||
// http://www.gradle.org/docs/current/userguide/dependency_management.html
|
||||
}
|
||||
|
||||
// This block of code expands all declared replace properties in the specified resource targets.
|
||||
// A missing property will result in an error. Properties are expanded using ${} Groovy notation.
|
||||
// When "copyIdeResources" is enabled, this will also run before the game launches in IDE environments.
|
||||
// See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html
|
||||
tasks.named('processResources', ProcessResources).configure {
|
||||
var replaceProperties = [
|
||||
minecraft_version: minecraft_version, minecraft_version_range: minecraft_version_range,
|
||||
forge_version: forge_version, forge_version_range: forge_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, libzontreck_id: libzontreck_id, libzontreck_range: libzontreck_range
|
||||
]
|
||||
inputs.properties replaceProperties
|
||||
|
||||
filesMatching(['META-INF/mods.toml', 'pack.mcmeta']) {
|
||||
expand replaceProperties + [project: project]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Example for how to get properties into the manifest for reading at runtime.
|
||||
tasks.named('jar', Jar).configure {
|
||||
from {
|
||||
configurations.provided.asFileTree.collect{zipTree(it)}
|
||||
}
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
|
||||
manifest {
|
||||
attributes([
|
||||
'Specification-Title' : mod_id,
|
||||
|
@ -192,20 +223,33 @@ tasks.named('jar', Jar).configure {
|
|||
// dependsOn 'reobfJar'
|
||||
// }
|
||||
|
||||
// Example configuration to allow publishing using the maven-publish plugin
|
||||
|
||||
def MAVEN_PASSWORD = "AriasCreationsMavenPassword"
|
||||
def MAVEN_USER = "AriasCreationsMavenUser"
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
register('mavenJava', MavenPublication) {
|
||||
mavenJava(MavenPublication) {
|
||||
artifact jar
|
||||
artifact sourcesJar
|
||||
artifact javadocJar
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
url "file://${project.projectDir}/mcmodsrepo"
|
||||
url = "https://git.zontreck.com/api/packages/MinecraftMods/maven"
|
||||
name = "ariascreations"
|
||||
|
||||
credentials {
|
||||
username = project.findProperty(MAVEN_USER)
|
||||
password = project.findProperty(MAVEN_PASSWORD)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue