diff --git a/Readme.md b/Readme.md index 852b4a264..5a20074ac 100644 --- a/Readme.md +++ b/Readme.md @@ -105,7 +105,7 @@ Prerequisites: From the File Explorer: 1. Download and extract the project zip -2. Download the core from https://gitlab.com/jeseibel/distant-horizons-core and extract into a folder called `core` +2. Download the core from https://gitlab.com/jeseibel/distant-horizons-core and extract into a folder called `coreSubProjects` 3. Open a terminal emulator in the project folder (On Windows you can type `cmd` in the title bar) 4. Run the commands: `./gradlew assemble` 5. The compiled jar file will be in the folder `Merged` diff --git a/build.gradle b/build.gradle index 44953b775..2b4c899fd 100644 --- a/build.gradle +++ b/build.gradle @@ -117,9 +117,6 @@ subprojects { p -> shadowMe // have implemented dependencies automatically embedded in the final jar implementation.extendsFrom(shadowMe) - - customModule - implementation.extendsFrom(customModule) if (isMinecraftSubProject) { // Shadow common @@ -185,25 +182,65 @@ subprojects { p -> // Add core if (isMinecraftSubProject) { - implementation(project(":core")) { + shadowMe(project(":core")) { // 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" + // Removed dependencies + transitive false } } // Add the api if (p != project(":api")) { - implementation(project(":api")) { + shadowMe(project(":api")) { // 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" + // Removed dependencies + transitive false } } + + // Add common + if (isMinecraftSubProject && p != project(":common")) { + // Common +// implementation project(":common") + + common(project(path: ":common")) { transitive false } + shadowCommon(project(path: ":common")) { transitive false } + } } + + shadowJar { + configurations = [project.configurations.shadowMe] + if (isMinecraftSubProject && p != project(":common")) { + configurations.push(project.configurations.shadowCommon) // Shadow the common subproject + + relocate "com.seibel.lod.common", "loaderCommon.${p.name}.com.seibel.lod.common" // Move the loader files to a different location + } + + // Compression + relocate 'org.tukaani', 'distanthorizons.libraries.tukaani' + + // NightConfig (includes Toml & Json) + relocate 'com.electronwill.nightconfig', 'distanthorizons.libraries.electronwill.nightconfig' + + // Theming + relocate 'com.formdev.flatlaf', 'distanthorizons.libraries.formdev.flatlaf' + + // SVG + relocate 'com.kitfox.svg', 'distanthorizons.libraries.kitfox.svg' + + mergeServiceFiles() + } + // Using jar.finalizedBy(shadowJar) causes issues so we do this scuffed bypass + jar.dependsOn(shadowJar) + + // Adds the standalone jar's entrypoint jar { from "LICENSE.txt" @@ -351,15 +388,17 @@ allprojects { p -> } } - // Fix forge version numbering system as it is weird - // For whatever reason forge uses [1.18, 1.18.1, 1.18.2) instead of the standard ["1.18", "1.18.1", "1.18.2"] which make more sense - def compatible_forgemc_versions = "${compatible_minecraft_versions}".replaceAll("\"", "").replaceAll("]", ",)") -// System.out.println(compatible_forgemc_versions) // Put stuff from gradle.properties into the mod info processResources { def resourceTargets = ["fabric.mod.json", "quilt.mod.json", "META-INF/mods.toml"] // Location of where to inject the properties def intoTargets = ["$buildDir/resources/main/"] // Location of the built resources folder + + // Fix forge version numbering system as it is weird + // For whatever reason forge uses [1.18, 1.18.1, 1.18.2) instead of the standard ["1.18", "1.18.1", "1.18.2"] which make more sense + def compatible_forgemc_versions = "${compatible_minecraft_versions}".replaceAll("\"", "").replaceAll("]", ",)") +// println compatible_forgemc_versions + def replaceProperties = [ version : mod_version, mod_name : mod_readable_name, @@ -377,7 +416,7 @@ allprojects { p -> // The left side is what gets replaced in the mod info and the right side is where to get it from in the gradle.properties inputs.properties replaceProperties - replaceProperties.put 'project', project + replaceProperties.put "project", project filesMatching(resourceTargets) { expand replaceProperties } @@ -412,7 +451,7 @@ allprojects { p -> options.compilerArgs += ['-Xplugin:Manifold'] } else { options.release = 8; // Core & Api should use Java 8 no matter what - //options.release = rootProject.java_version as Integer // But if minecraft + //options.release = rootProject.java_version as Integer // But if you want to test some stuff, then this can be enabled } options.encoding = "UTF-8" } diff --git a/coreSubProjects b/coreSubProjects index 42d3e38da..70369fa46 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 42d3e38daa8b2cf83a7ec7003764bef9da9564f2 +Subproject commit 70369fa468cb50934a780094ea3f5052cf2f333d diff --git a/fabric/build.gradle b/fabric/build.gradle index 8bdd83992..1fb524eaa 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -48,9 +48,6 @@ dependencies { // Fabric loader modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}" - // Common - implementation project(":common") - // Architectury API // if (minecraft_version == "1.16.5") { // addModJar("me.shedaniel:architectury-fabric:${rootProject.architectury_version}") @@ -110,35 +107,8 @@ dependencies { transitive(false) } */ - - - common(project(path: ":common")) { transitive false } - shadowCommon(project(path: ":common")) { transitive false } -// shadowCommon(project(path: ":common"), configuration: "transformProductionFabric") { transitive false } // FIXME - // TODO: These exist in the main build.gradle so fix shadow there - shadowMe(project(path: ":core")) { transitive false } - shadowMe(project(path: ":api")) { transitive false } } -//shadowJar { -// configurations = [project.configurations.shadowCommon, project.configurations.shadowMe, project.configurations.customModule] -// relocate 'com.seibel.lod.common', 'loaderCommon.fabric.com.seibel.lod.common' -// -// // Compression -// relocate 'org.tukaani', 'distanthorizons.libraries.tukaani' -// -// // NightConfig (includes Toml & Json) -// relocate 'com.electronwill.nightconfig', 'distanthorizons.libraries.electronwill.nightconfig' -// -// // Theming -// relocate 'com.formdev.flatlaf', 'distanthorizons.libraries.formdev.flatlaf' -// -// // SVG -// relocate 'com.kitfox.svg', 'distanthorizons.libraries.kitfox.svg' -// -// mergeServiceFiles() -//} - task deleteResources(type: Delete) { delete file("build/resources/main") @@ -184,4 +154,4 @@ publishing { repositories { // Add repositories to publish to here. } -} +} \ No newline at end of file diff --git a/forge/build.gradle b/forge/build.gradle index 88088b157..5f48ec634 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -130,11 +130,6 @@ dependencies { // if (System.getProperty("idea.sync.active") != "true") { // annotationProcessor "org.spongepowered:mixin:0.8.4:processor" // } - - common(project(path: ":common")) { transitive false } - shadowCommon(project(path: ":common")) { transitive false } - shadowMe(project(path: ":core")) { transitive false } - shadowMe(project(path: ":api")) { transitive false } } processResources { @@ -142,27 +137,6 @@ processResources { dependsOn(copyAccessWidener) } -shadowJar { - exclude "architectury.common.json" - - configurations = [project.configurations.shadowCommon, project.configurations.shadowMe, project.configurations.customModule] - relocate "om.seibel.lod.common", "loaderCommon.forge.com.seibel.lod.common" - - // Compression - relocate "org.tukaani", "distanthorizons.libraries.tukaani" - - // NightConfig (includes Toml & Json) - relocate "com.electronwill.nightconfig", "distanthorizons.libraries.electronwill.nightconfig" - - // Theming - relocate "com.formdev.flatlaf", "distanthorizons.libraries.formdev.flatlaf" - - // svg - relocate "com.kitfox.svg", "distanthorizons.libraries.kitfox.svg" - - mergeServiceFiles() -} - //remapJar { // input.set shadowJar.archiveFile // dependsOn shadowJar diff --git a/settings.gradle b/settings.gradle index deb699eec..113429683 100644 --- a/settings.gradle +++ b/settings.gradle @@ -77,10 +77,10 @@ include("common") // Enables or disables the subprojects depending on whats in the version.properties if (gradle.builds_for.contains("fabric")) include("fabric") -//if (gradle.builds_for.contains("quilt")) -// include("quilt") // Just put this here for once we need it ;) +if (gradle.builds_for.contains("quilt")) + include("quilt") // Just put this here for once we need it ;) //if (gradle.builds_for.contains("forge")) -// include("forge") +// include("forge") // FIXME: Find some time to fix forge rootProject.name = "DistantHorizons"