Setup multi module project

This commit is contained in:
FlorianMichael 2023-10-20 09:40:46 +02:00
parent 58099058a5
commit 5e40ef4111
No known key found for this signature in database
GPG Key ID: C2FB87E71C425126
22 changed files with 140 additions and 159 deletions

View File

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

View File

@ -23,7 +23,7 @@ No
## For developers
### How does it work?
![](images/via-expl.png)
![](.github/images/via-expl.png)
### Project Structure
All ViaForge versions from Minecraft version 1.12 onwards are on the `master` branch. <br>

View File

@ -1,3 +1,45 @@
plugins {
id "java"
id "com.github.johnrengelman.shadow" version "7.0.0"
}
subprojects {
apply plugin: "com.github.johnrengelman.shadow"
archivesBaseName = "ViaForge-" + project.maven_name
version = maven_version + project.mc_version
group = maven_group
configurations {
library
implementation.extendsFrom(library)
}
repositories {
maven {
url = "https://repo.spongepowered.org/repository/maven-public"
}
maven {
url = "https://repo.viaversion.com"
}
}
dependencies {
library "com.viaversion:viaversion:${project.viaversion_version}"
library "com.viaversion:viabackwards:${project.viabackwards_version}"
library "com.viaversion:viarewind-universal:${project.viarewind_version}"
library "org.yaml:snakeyaml:${project.snake_yml_version}"
library "net.raphimc:ViaLoader:${project.vialoader_version}"
}
shadowJar {
archiveFileName = jar.archiveFileName
compileJava.options.encoding = "UTF-8"
exclude "native-binaries/*"
configurations = [project.configurations.compileClasspath]
}
jar.dependsOn("shadowJar")
}

View File

@ -1,20 +1,19 @@
# java
# Gradle Properties
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false
# forge
mod_id=viaforge
mod_name=ViaForge
mod_version=3.4.3
mod_base_package=de.florianmichael
# Project Details
maven_name=viaforge
maven_version=3.4.3
maven_group=de.florianmichael
# via-version
# ViaVersion
vialoader_version=2.2.9
viaversion_version=4.8.0
viabackwards_version=4.8.0
viarewind_version=3.0.0
snake_yml_version=2.0
# libs
# Misc Libraries
slf4j_version=2.0.7
mixin_version=0.8.3

View File

@ -1,148 +0,0 @@
buildscript {
repositories {
mavenCentral()
gradlePluginPortal()
maven { url = "https://maven.minecraftforge.net/" }
maven { url = "https://repo.spongepowered.org/repository/maven-public/" }
maven { url = "https://jitpack.io/" }
maven { url = "https://files.minecraftforge.net/maven" }
maven { url = "https://plugins.gradle.org/m2" }
}
dependencies {
classpath "net.minecraftforge.gradle:ForgeGradle:5.1.+"
classpath "org.spongepowered:mixingradle:0.7-SNAPSHOT"
classpath "com.github.johnrengelman:shadow:7.0.0"
}
}
apply plugin: "net.minecraftforge.gradle"
apply plugin: "org.spongepowered.mixin"
apply plugin: "com.github.johnrengelman.shadow"
apply plugin: "java"
version = "1.12.2-${mod_version}"
group = "${mod_base_package}.${mod_id}"
archivesBaseName = mod_id
java.toolchain.languageVersion = JavaLanguageVersion.of(8)
compileJava.options.encoding = "UTF-8"
minecraft {
mappings channel: "stable", version: "39-1.12"
runs {
client {
workingDirectory project.file("run")
property 'forge.logging.markers', 'REGISTRIES'
property "forge.logging.console.level", "debug"
// mixin
property 'mixin.debug.export', 'true'
property "mixin.hotSwap", "true"
property "fml.coreMods.load", "de.florianmichael.viaforge.mixin.MixinLoader"
if (project.hasProperty('mc_uuid'))
args '--uuid', project.getProperty('mc_uuid')
if (project.hasProperty('mc_username'))
args '--username', project.getProperty('mc_username')
if (project.hasProperty('mc_accessToken'))
args '--accessToken', project.getProperty('mc_accessToken')
args '-mixin.config=' + 'mixins.' + project.getProperty('mod_id') + '.json'
mods {
"${mod_id}" {
source sourceSets.main
}
}
}
}
}
sourceSets.main.resources {
srcDir "src/generated/resources"
}
repositories {
maven {
url = "https://repo.spongepowered.org/repository/maven-public"
}
maven {
url = "https://repo.viaversion.com"
}
}
configurations {
include
implementation.extendsFrom(include)
}
def viaLibs = [
"com.viaversion:viaversion:${project.viaversion_version}",
"com.viaversion:viabackwards:${project.viabackwards_version}",
"com.viaversion:viarewind-universal:${project.viarewind_version}",
"org.yaml:snakeyaml:${project.snake_yml_version}",
"net.raphimc:ViaLoader:${project.vialoader_version}",
"org.slf4j:slf4j-api:${project.slf4j_version}"
]
dependencies {
minecraft "net.minecraftforge:forge:1.12.2-14.23.5.2859"
include "org.spongepowered:mixin:${mixin_version}"
for (final def via in viaLibs) {
include(via)
}
annotationProcessor "org.spongepowered:mixin:${mixin_version}:processor"
annotationProcessor "org.spongepowered:mixin:${mixin_version}:processor"
}
mixin {
add sourceSets.main, "mixins.${mod_id}.refmap.json"
}
jar {
manifest.attributes(
"Specification-Title": "viaforge",
"Specification-Vendor": "viaforge",
"Specification-Version": "1",
"Implementation-Title": project.name,
"Implementation-Version": "${archiveVersion}",
"Implementation-Vendor" :"viaforge",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd"-"HH:mm:ssZ"),
"TweakClass": "org.spongepowered.asm.launch.MixinTweaker",
"TweakOrder": "0",
"FMLCorePluginContainsFMLMod": "true",
"FMLCorePlugin": "de.florianmichael.viaforge.mixin.MixinLoader",
"MixinConfigs": "mixins.${mod_id}.json",
"ForceLoadAsMod": "true"
)
enabled = false
}
shadowJar {
archiveFileName = jar.archiveFileName
compileJava.options.encoding = "UTF-8"
exclude "native-binaries/*"
dependencies {
for (final def lib in viaLibs) {
include(dependency(lib))
}
include(dependency("org.spongepowered:mixin:${mixin_version}"))
}
}
reobf {
shadowJar {}
}
jar.dependsOn("shadowJar")

View File

@ -1,3 +1,16 @@
rootProject.name = "ViaForge"
include 'mc1122'
pluginManagement {
repositories {
mavenCentral()
gradlePluginPortal()
maven { url = "https://maven.minecraftforge.net/" }
maven { url = "https://repo.spongepowered.org/repository/maven-public/" }
maven { url = "https://jitpack.io/" }
maven { url = "https://files.minecraftforge.net/maven" }
maven { url = "https://plugins.gradle.org/m2" }
}
}
rootProject.name = "ViaForge"
include "viaforge-mc112"

View File

@ -0,0 +1,73 @@
plugins {
id "net.minecraftforge.gradle" version "5.1.+"
id "org.spongepowered.mixin" version "0.7-SNAPSHOT"
}
java.toolchain.languageVersion = JavaLanguageVersion.of(8)
compileJava.options.encoding = "UTF-8"
minecraft {
mappings channel: "stable", version: "39-1.12"
runs {
client {
workingDirectory project.file("run")
property 'forge.logging.markers', 'REGISTRIES'
property "forge.logging.console.level", "debug"
// mixin
property 'mixin.debug.export', 'true'
property "mixin.hotSwap", "true"
property "fml.coreMods.load", "de.florianmichael.viaforge.mixin.MixinLoader"
args '-mixin.config=' + 'mixins.' + project.getProperty('maven_name') + '.json'
mods {
"ViaForge" {
source sourceSets.main
}
}
}
}
}
sourceSets.main.resources {
srcDir "src/generated/resources"
}
dependencies {
minecraft "net.minecraftforge:forge:1.12.2-14.23.5.2859"
library "org.spongepowered:mixin:${mixin_version}"
library "org.slf4j:slf4j-api:${project.slf4j_version}"
annotationProcessor "org.spongepowered:mixin:${mixin_version}:processor"
}
mixin {
add sourceSets.main, "mixins.${maven_name}.refmap.json"
}
jar {
manifest.attributes(
"Specification-Title": "viaforge",
"Specification-Vendor": "viaforge",
"Specification-Version": "1",
"Implementation-Title": project.name,
"Implementation-Version": "${archiveVersion}",
"Implementation-Vendor" :"viaforge",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd"-"HH:mm:ssZ"),
"TweakClass": "org.spongepowered.asm.launch.MixinTweaker",
"TweakOrder": "0",
"FMLCorePluginContainsFMLMod": "true",
"FMLCorePlugin": "de.florianmichael.viaforge.mixin.MixinLoader",
"MixinConfigs": "mixins.${maven_name}.json",
"ForceLoadAsMod": "true"
)
enabled = false
}
reobf {
shadowJar {}
}

View File

@ -0,0 +1,2 @@
maven_name=viaforge-mc112
mc_version=1.12.2