Attempt to move over to Unimined
This commit is contained in:
+42
-55
@@ -13,13 +13,8 @@ plugins {
|
||||
// // Provides mc libraries to core
|
||||
// id "org.spongepowered.gradle.vanilla" version '0.2.1-SNAPSHOT' apply false
|
||||
|
||||
// Architectury is used here only as a replacement for forge's own loom
|
||||
// id "dev.architectury.loom" version "1.4-SNAPSHOT" apply false
|
||||
id "fabric-loom" version "1.4-SNAPSHOT" apply false
|
||||
|
||||
id 'net.minecraftforge.gradle' version '[6.0.16,6.2)' apply false
|
||||
id 'org.spongepowered.mixin' version '0.7.+' apply false
|
||||
id 'org.parchmentmc.librarian.forgegradle' version '1.+' apply false
|
||||
// Use unimined which is our one in all solution to minecraft loaders
|
||||
id "xyz.wagyourtail.unimined" version "1.2.0-SNAPSHOT" apply false
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -114,18 +109,30 @@ subprojects { p ->
|
||||
if (p == project(":core"))
|
||||
apply plugin: "application"
|
||||
// apply plugin: "org.spongepowered.gradle.vanilla" // Provides minecraft libraries
|
||||
|
||||
if (p != project(":common") && isMinecraftSubProject) {
|
||||
apply plugin: "xyz.wagyourtail.unimined"
|
||||
|
||||
// Apply forge's loom
|
||||
if (
|
||||
(findProject(":forge") && p == project(":forge")) ||
|
||||
(findProject(":neoforge") && p == project(":neoforge"))
|
||||
) {
|
||||
// apply plugin: 'net.minecraftforge.gradle'
|
||||
// apply plugin: 'org.spongepowered.mixin'
|
||||
// apply plugin: 'org.parchmentmc.librarian.forgegradle'
|
||||
unimined.minecraft(sourceSets.main, true) {
|
||||
version minecraft_version
|
||||
|
||||
/* The code below creates the access transformer file */
|
||||
new AWToAT().remap(project(":common").file("src/main/resources/${accessWidenerVersion}.distanthorizons.accesswidener"), accessWidenerVersion)
|
||||
def parchmentVersionParts = parchment_version.split(":")
|
||||
mappings {
|
||||
mojmap()
|
||||
parchment(parchmentVersionParts[0], parchmentVersionParts[1])
|
||||
devNamespace "mojmap"
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
source(project(":common").sourceSets.main.allSource)
|
||||
source(project(":api").sourceSets.main.allSource)
|
||||
source(project(":core").sourceSets.main.allSource)
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType(GenerateModuleMetadata) {
|
||||
enabled = false
|
||||
}
|
||||
|
||||
|
||||
@@ -138,52 +145,33 @@ subprojects { p ->
|
||||
// set up custom configurations (configurations are a way to handle dependencies)
|
||||
configurations {
|
||||
// extends the shadowJar configuration
|
||||
shadowMe
|
||||
shadowMe // Configuration that contains coreProjects
|
||||
shade // Configuration that doesn't contain coreProjects
|
||||
|
||||
// have implemented dependencies automatically embedded in the final jar
|
||||
implementation.extendsFrom(shadowMe)
|
||||
implementation.extendsFrom(shade)
|
||||
|
||||
// Add shaded libraries very early in the classpath (excluding coreProjects as that's added in a different way)
|
||||
minecraftLibraries.extendsFrom(shade)
|
||||
|
||||
// Configuration fpr core & api
|
||||
coreProjects
|
||||
shadowMe.extendsFrom(coreProjects)
|
||||
|
||||
|
||||
// FIXME this additional configuration is necessary because forge
|
||||
// needs forgeRuntimeLibrary, although adding it to shadowMe
|
||||
// causes runtime issues where the libraries aren't properly added
|
||||
forgeShadowMe
|
||||
// this should match shadowMe pretty closely
|
||||
implementation.extendsFrom(forgeShadowMe)
|
||||
shadowMe.extendsFrom(forgeShadowMe)
|
||||
runtimeOnly.extendsFrom(forgeShadowMe)
|
||||
|
||||
|
||||
if (isMinecraftSubProject && p != project(":common")) {
|
||||
// Shadow common
|
||||
common
|
||||
shadowCommon // Don't use shadow from the shadow plugin because we don't want IDEA to index this.
|
||||
compileClasspath.extendsFrom common
|
||||
runtimeClasspath.extendsFrom common
|
||||
if (findProject(":forge"))
|
||||
developmentForge.extendsFrom common
|
||||
implementation.extendsFrom common
|
||||
if (findProject(":neoforge"))
|
||||
developmentNeoForge.extendsFrom common
|
||||
implementation.extendsFrom common
|
||||
compileClasspath.extendsFrom coreProjects
|
||||
runtimeClasspath.extendsFrom coreProjects
|
||||
if (findProject(":forge"))
|
||||
developmentForge.extendsFrom coreProjects
|
||||
implementation.extendsFrom coreProjects
|
||||
if (findProject(":neoforge"))
|
||||
developmentNeoForge.extendsFrom coreProjects
|
||||
implementation.extendsFrom coreProjects
|
||||
implementation.extendsFrom common
|
||||
implementation.extendsFrom coreProjects
|
||||
|
||||
if (findProject(":fabricLike") && p != project(":fabricLike")) {
|
||||
// Shadow fabricLike
|
||||
fabricLike
|
||||
shadowFabricLike
|
||||
compileClasspath.extendsFrom fabricLike
|
||||
runtimeClasspath.extendsFrom fabricLike
|
||||
implementation.extendsFrom fabricLike
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -202,7 +190,6 @@ subprojects { p ->
|
||||
// shared dependencies //
|
||||
//=====================//
|
||||
|
||||
|
||||
// Manifold
|
||||
if (isMinecraftSubProject) {
|
||||
annotationProcessor("systems.manifold:manifold-preprocessor:${rootProject.manifold_version}")
|
||||
@@ -223,24 +210,24 @@ subprojects { p ->
|
||||
implementation("junit:junit:4.13")
|
||||
|
||||
// Compression
|
||||
forgeShadowMe("org.lz4:lz4-java:${rootProject.lz4_version}")
|
||||
shade("org.lz4:lz4-java:${rootProject.lz4_version}")
|
||||
|
||||
// Sqlite Database
|
||||
forgeShadowMe("org.xerial:sqlite-jdbc:${rootProject.sqlite_jdbc_version}")
|
||||
shade("org.xerial:sqlite-jdbc:${rootProject.sqlite_jdbc_version}")
|
||||
|
||||
// NightConfig (includes Toml & Json)
|
||||
forgeShadowMe("com.electronwill.night-config:toml:${rootProject.nightconfig_version}")
|
||||
forgeShadowMe("com.electronwill.night-config:json:${rootProject.nightconfig_version}")
|
||||
shade("com.electronwill.night-config:toml:${rootProject.nightconfig_version}")
|
||||
shade("com.electronwill.night-config:json:${rootProject.nightconfig_version}")
|
||||
|
||||
// SVG (not needed atm)
|
||||
// forgeShadowMe("com.formdev:svgSalamander:${rootProject.svgSalamander_version}")
|
||||
// shade("com.formdev:svgSalamander:${rootProject.svgSalamander_version}")
|
||||
|
||||
// Netty
|
||||
// Breaks 1.16.5
|
||||
//forgeShadowMe("io.netty:netty-all:${rootProject.netty_version}")
|
||||
//shade("io.netty:netty-all:${rootProject.netty_version}")
|
||||
|
||||
// Remember, for lwjgl dependencies that arent included in Minecraft, you need to also need to add it to the ShadowJar thing
|
||||
forgeShadowMe("org.lwjgl:lwjgl-jawt:${rootProject.lwjgl_version}") {
|
||||
shade("org.lwjgl:lwjgl-jawt:${rootProject.lwjgl_version}") {
|
||||
exclude group: "org.lwjgl", module: "lwjgl" // This module is imported by Minecraft so exclude it
|
||||
}
|
||||
|
||||
@@ -291,7 +278,7 @@ subprojects { p ->
|
||||
|
||||
|
||||
shadowJar {
|
||||
configurations = [project.configurations.shadowMe]
|
||||
configurations = [project.configurations.shadowMe, project.configurations.shade]
|
||||
if (isMinecraftSubProject && p != project(":common")) {
|
||||
configurations.push(project.configurations.shadowCommon) // Shadow the common subproject
|
||||
relocate "com.seibel.distanthorizons.common", "loaderCommon.${p.name}.com.seibel.distanthorizons.common" // Move the loader files to a different location
|
||||
|
||||
Reference in New Issue
Block a user