mirror of
https://github.com/ViaVersion/ViaForge.git
synced 2024-11-28 13:05:15 +01:00
Explain build script structure
This commit is contained in:
parent
98d1aea223
commit
7594239138
@ -2,19 +2,16 @@ plugins {
|
|||||||
id "groovy-gradle-plugin"
|
id "groovy-gradle-plugin"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Counterpart of settings.gradle file, sadly conventions can't use those defined repositories for some reason...
|
||||||
repositories {
|
repositories {
|
||||||
gradlePluginPortal()
|
gradlePluginPortal()
|
||||||
maven {
|
|
||||||
url = "https://repo.spongepowered.org/repository/maven-public/"
|
maven { url = "https://repo.spongepowered.org/repository/maven-public/" }
|
||||||
}
|
maven { url = "https://jitpack.io/" }
|
||||||
maven {
|
maven { url = "https://files.minecraftforge.net/maven" }
|
||||||
url = "https://jitpack.io/"
|
|
||||||
}
|
|
||||||
maven {
|
|
||||||
url = "https://files.minecraftforge.net/maven"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Counterpart of settings.gradle file, sadly conventions can't use those defined plugins for some reason...
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation "com.github.johnrengelman:shadow:7.1.2"
|
implementation "com.github.johnrengelman:shadow:7.1.2"
|
||||||
implementation "net.minecraftforge.gradle:ForgeGradle:5.+"
|
implementation "net.minecraftforge.gradle:ForgeGradle:5.+"
|
||||||
|
@ -2,11 +2,14 @@ plugins {
|
|||||||
id "java-library"
|
id "java-library"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We define the configuration here so we can use it across all conventions and platforms
|
||||||
|
// To define which projects/source files should be included in the jar
|
||||||
configurations {
|
configurations {
|
||||||
include
|
include
|
||||||
implementation.extendsFrom(include)
|
implementation.extendsFrom(include)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Repositories for the ViaVersion dependencies defined below
|
||||||
repositories {
|
repositories {
|
||||||
maven {
|
maven {
|
||||||
url = "https://repo.spongepowered.org/repository/maven-public"
|
url = "https://repo.spongepowered.org/repository/maven-public"
|
||||||
@ -16,6 +19,7 @@ repositories {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Including all required libraries for ViaVersion {for version numbers see gradle.properties}
|
||||||
dependencies {
|
dependencies {
|
||||||
include "com.viaversion:viaversion:${project.viaversion_version}"
|
include "com.viaversion:viaversion:${project.viaversion_version}"
|
||||||
include "com.viaversion:viabackwards:${project.viabackwards_version}"
|
include "com.viaversion:viabackwards:${project.viabackwards_version}"
|
||||||
|
@ -2,6 +2,8 @@ plugins {
|
|||||||
id "viaforge.shadow-conventions"
|
id "viaforge.shadow-conventions"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get rid of the services folder, since Forge 1.16+ would conflict with some of the ForgeDev Environment's services
|
||||||
|
// And since we don't need them for Mixins anyway, we can just exclude them from the shadowJar
|
||||||
shadowJar {
|
shadowJar {
|
||||||
exclude("META-INF/services/**")
|
exclude "META-INF/services/**"
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id "net.minecraftforge.gradle"
|
id "net.minecraftforge.gradle"
|
||||||
id "org.spongepowered.mixin"
|
id "org.spongepowered.mixin"
|
||||||
|
|
||||||
id "viaforge.shadow-conventions"
|
id "viaforge.shadow-conventions"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -15,8 +16,8 @@ minecraft {
|
|||||||
// mixin
|
// mixin
|
||||||
property "mixin.debug.export", "true"
|
property "mixin.debug.export", "true"
|
||||||
property "mixin.hotSwap", "true"
|
property "mixin.hotSwap", "true"
|
||||||
property "fml.coreMods.load", "de.florianmichael.viaforge.mixin.MixinLoader"
|
property "fml.coreMods.load", "de.florianmichael.viaforge.mixin.MixinLoader" // Only required for MC 1.12, but modern Forges skips this anyway
|
||||||
args '-mixin.config=' + 'mixins.' + project.getProperty('maven_name') + ".json"
|
args "-mixin.config=" + "mixins." + project.getProperty('maven_name') + ".json"
|
||||||
|
|
||||||
// source set
|
// source set
|
||||||
mods {
|
mods {
|
||||||
@ -33,12 +34,12 @@ sourceSets.main.resources {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
include "org.spongepowered:mixin:0.8.3"
|
include "org.spongepowered:mixin:${mixin_version}"
|
||||||
include "org.slf4j:slf4j-api:${project.slf4j_version}"
|
include "org.slf4j:slf4j-api:${slf4j_version}"
|
||||||
|
|
||||||
annotationProcessor "org.spongepowered:mixin:0.8.3:processor"
|
annotationProcessor "org.spongepowered:mixin:${mixin_version}:processor"
|
||||||
|
|
||||||
include project(":")
|
include project(":") // Include the base project, to get Common-ViaForge
|
||||||
}
|
}
|
||||||
|
|
||||||
mixin {
|
mixin {
|
||||||
@ -56,8 +57,8 @@ jar {
|
|||||||
"Implementation-Timestamp": new Date().format("yyyy-MM-dd"-"HH:mm:ssZ"),
|
"Implementation-Timestamp": new Date().format("yyyy-MM-dd"-"HH:mm:ssZ"),
|
||||||
"TweakClass": "org.spongepowered.asm.launch.MixinTweaker",
|
"TweakClass": "org.spongepowered.asm.launch.MixinTweaker",
|
||||||
"TweakOrder": "0",
|
"TweakOrder": "0",
|
||||||
"FMLCorePluginContainsFMLMod": "true",
|
"FMLCorePluginContainsFMLMod": "true", // Only required for MC 1.12, but modern Forges skips this anyway
|
||||||
"FMLCorePlugin": "de.florianmichael.viaforge.mixin.MixinLoader",
|
"FMLCorePlugin": "de.florianmichael.viaforge.mixin.MixinLoader", // Counterpart to the above
|
||||||
"MixinConfigs": "mixins.${maven_name}.json",
|
"MixinConfigs": "mixins.${maven_name}.json",
|
||||||
"ForceLoadAsMod": "true"
|
"ForceLoadAsMod": "true"
|
||||||
)
|
)
|
||||||
@ -66,9 +67,10 @@ jar {
|
|||||||
|
|
||||||
shadowJar {
|
shadowJar {
|
||||||
archiveFileName = jar.archiveFileName
|
archiveFileName = jar.archiveFileName
|
||||||
configurations = [project.configurations.include]
|
configurations = [project.configurations.include] // Include the dependencies from the include configuration
|
||||||
duplicatesStrategy DuplicatesStrategy.EXCLUDE
|
duplicatesStrategy DuplicatesStrategy.EXCLUDE
|
||||||
|
|
||||||
|
// Prevent conflicts with Forge's weird service loading
|
||||||
exclude("META-INF/maven/**")
|
exclude("META-INF/maven/**")
|
||||||
exclude("META-INF/versions/**")
|
exclude("META-INF/versions/**")
|
||||||
}
|
}
|
||||||
|
@ -3,4 +3,5 @@ plugins {
|
|||||||
id "viaforge.conflicting-conventions"
|
id "viaforge.conflicting-conventions"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Minecraft 1.17+ required Java 16/17 to compile
|
||||||
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
|
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
|
||||||
|
@ -1,14 +1,18 @@
|
|||||||
plugins {
|
plugins {
|
||||||
|
id "viaforge.base-conventions" // Include the base conventions, to get the dependencies
|
||||||
|
|
||||||
id "com.github.johnrengelman.shadow"
|
id "com.github.johnrengelman.shadow"
|
||||||
id "viaforge.base-conventions"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Define the jar output attributes for all platforms
|
||||||
archivesBaseName = project.maven_name
|
archivesBaseName = project.maven_name
|
||||||
version = maven_version + "-" + project.mc_version
|
version = maven_version + "-" + project.mc_version
|
||||||
group = maven_group
|
group = maven_group
|
||||||
|
|
||||||
compileJava.options.encoding = "UTF-8"
|
compileJava.options.encoding = "UTF-8"
|
||||||
|
|
||||||
|
// Replace the version in the mcmod.info and mods.toml files with the project version
|
||||||
|
// Since this depends on the platform version, we can't define it in the global scope :(
|
||||||
processResources {
|
processResources {
|
||||||
inputs.property "version", project.version
|
inputs.property "version", project.version
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ pluginManagement {
|
|||||||
maven { url = "https://files.minecraftforge.net/maven" }
|
maven { url = "https://files.minecraftforge.net/maven" }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If you update these versions, also update the versions in buildSrc/build.gradle
|
||||||
plugins {
|
plugins {
|
||||||
id "com.github.johnrengelman.shadow" version "7.1.2"
|
id "com.github.johnrengelman.shadow" version "7.1.2"
|
||||||
id "net.minecraftforge.gradle" version "5.+"
|
id "net.minecraftforge.gradle" version "5.+"
|
||||||
|
Loading…
Reference in New Issue
Block a user