Setup the API sub-project gradle dependencies

This commit is contained in:
James Seibel
2022-08-30 22:02:39 -05:00
parent f34be62af4
commit ef0d3b3957
3 changed files with 67 additions and 38 deletions
+55 -28
View File
@@ -140,21 +140,22 @@ architectury {
}
subprojects { p ->
if (p == project(":core")) {
// setup Architectury
if (p == project(":core") || p == project(":api") || p == project(":apiInterface") || p == project(":coreShared"))
{
apply plugin: "application"
apply plugin: "org.spongepowered.gradle.vanilla" // Provides minecraft libraries
apply plugin: "com.github.johnrengelman.shadow"
} else {
}
else
{
apply plugin: "com.github.johnrengelman.shadow"
if (p != project(":api")) { // Don't add loom to the api project
apply plugin: "dev.architectury.loom"
loom {
silentMojangMappingsLicense()
}
} else {
apply plugin: "java" // Apply the java plugin early to the api project
}
}
configurations {
@@ -165,33 +166,26 @@ subprojects { p ->
implementation.extendsFrom customModule
}
if (p == project(":core")) {
// Sets up minecraft for core
// Set up the minecraft non-dependency for core sub-projects
if (p == project(":core") || p == project(":api") || p == project(":apiInterface") || p == project(":coreShared"))
{
minecraft {
version("${rootProject.minecraft_version}")
}
// Sets the main standalone jar entrypoint
// Set the standalone jar entrypoint
// (This will point to a non-existent class in all sub-projects except "Core")
application {
mainClass.set('com.seibel.lod.core.JarMain')
}
}
dependencies {
// Sets up minecraft for projects other than core
if (p != project(":core") && p != project(":api")) {
minecraft "com.mojang:minecraft:${rootProject.minecraft_version}"
// The following line declares the mojmap mappings & parchment mappings
mappings loom.layered() {
// Mojmap mappings
officialMojangMappings()
// Parchment mappings (it adds parameter mappings & javadoc)
if (rootProject.minecraft_version != "1.19")
parchment("org.parchmentmc.data:parchment-${rootProject.minecraft_version}:${rootProject.parchment_version}@zip")
else // As 1.19 dosnt have parchment mappings yet, we use 1.18.2 mapping
parchment("org.parchmentmc.data:parchment-1.18.2:${rootProject.parchment_version}@zip")
}
}
//=====================//
// shared dependencies //
//=====================//
// Manifold
annotationProcessor "systems.manifold:manifold-preprocessor:${rootProject.manifold_version}"
@@ -219,8 +213,29 @@ subprojects { p ->
shadowMe "com.formdev:flatlaf-extras:${rootProject.flatlaf_version}"
shadowMe "com.formdev:svgSalamander:${rootProject.svgSalamander_version}"
// Add the core as a dependency
if (p != project(":core")) {
//==========================//
// conditional dependencies //
//==========================//
// Minecraft dependent sub-projects
if (p == project(":common") || p == project(":forge") || p == project(":fabric"))
{
// Add Minecraft
minecraft "com.mojang:minecraft:${rootProject.minecraft_version}"
// The following line declares the mojmap mappings & parchment mappings
mappings loom.layered() {
// Mojmap mappings
officialMojangMappings()
// Parchment mappings (it adds parameter mappings & javadoc)
if (rootProject.minecraft_version != "1.19")
parchment("org.parchmentmc.data:parchment-${rootProject.minecraft_version}:${rootProject.parchment_version}@zip")
else // As 1.19 doesn't have parchment mappings yet, we use 1.18.2 mapping
parchment("org.parchmentmc.data:parchment-1.18.2:${rootProject.parchment_version}@zip")
}
// Add core
customModule(project(":core")) {
// Remove Junit test libraries
exclude group: "org.junit.jupiter", module: "junit-jupiter"
@@ -229,15 +244,27 @@ subprojects { p ->
}
}
// Add the api as a dependency
if (p != project(":api") && p != project(":core")) {
customModule(project(":api")) {
// Add coreShared to sub-projects that need core objects
if (p == project(":core") || p == project(":apiInterface") || p == project(":api")) {
customModule(project(":coreShared")) {
// Remove Junit test libraries
exclude group: "org.junit.jupiter", module: "junit-jupiter"
exclude group: "org.junit.jupiter", module: "junit-jupiter-engine"
exclude group: "junit", module: "junit"
}
}
// Add apiInterface to core and the API
if (p == project(":core") || p == project(":api")) {
customModule(project(":apiInterface")) {
// Remove Junit test libraries
exclude group: "org.junit.jupiter", module: "junit-jupiter"
exclude group: "org.junit.jupiter", module: "junit-jupiter-engine"
exclude group: "junit", module: "junit"
}
}
}
// Allows the jar to run standalone
+4 -2
View File
@@ -8,17 +8,19 @@ pluginManagement {
}
}
// Minecraft dependent sub-projects
include("common")
include("fabric")
include("forge")
// Minecraft independent sub-projects
include("core")
project(":core").projectDir = file('coreSubProjects/core')
include("api")
project(":api").projectDir = file('coreSubProjects/api')
include("apiInterface")
project(":apiInterface").projectDir = file('coreSubProjects/apiInterface')
include("coreApiCommon")
project(":coreApiCommon").projectDir = file('coreSubProjects/coreApiCommon')
include("coreShared")
project(":coreShared").projectDir = file('coreSubProjects/coreShared')
rootProject.name = "DistantHorizons"