-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support neoforge platform, move to using architectury (#125)
* rebase * split fabric/neoforge specific code * more progress * dependency configuration * exclude more junk * neo, you make me go insane * neoforge seems to work! * some minor cleanup, add neoforge command module * mixin config plugin shenanigans * fix language strings loading * some cleanup, yeet Jenkinsfile * proper repository declaration using plugin, target jitpack branch * oops * address reviews * Update for 1.21 * some minor fixes * Fix modrinth task, add floodgate version command mixin to disable version checking, update to loom 1.7, update cloud, update floodgate core to not use my branch * oops * what on earth is going on now * neoforge works again!!!!!!!!! * Address review, dont rely on locals in mixin * modrinth version/name changes, similar to geyser * Update README.md Co-authored-by: Konicai <71294714+Konicai@users.noreply.github.com> * Improve handling of PayloadRegistrar this took years off my life * address review * Move blossom version declaration to libs.versions.toml * remove unused versions from catalogue * Only run modrinth task if successful & on Geyser repo * cleanup & fix gh actions building/archiving * run and uses are different steps --------- Co-authored-by: Konicai <71294714+Konicai@users.noreply.github.com>
- Loading branch information
1 parent
4502fd2
commit 0ef0659
Showing
76 changed files
with
1,507 additions
and
586 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,11 @@ | ||
# Floodgate-Fabric | ||
Fabric port of the hybrid mode plugin to allow for connections from Geyser to join online mode servers. | ||
# Floodgate-Modded | ||
Fabric and NeoForge ports of the hybrid mode plugin to allow for connections from Geyser to join online mode servers. | ||
|
||
Download: https://ci.opencollab.dev/job/GeyserMC/job/Floodgate-Fabric/job/master/ | ||
Hybrid mode mod to allow for connections from Geyser to join online mode servers. | ||
Geyser is an open collaboration project by CubeCraft Games. | ||
|
||
See the Floodgate section in the GeyserMC Wiki for more info about what Floodgate is, how you setup Floodgate and known issues/caveats. | ||
Additionally, it includes a more in-depth look into how Floodgate works and the Floodgate API. | ||
|
||
Wiki: https://wiki.geysermc.org/floodgate/ | ||
Download: https://modrinth.com/mod/floodgate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
plugins { | ||
`kotlin-dsl` | ||
} | ||
|
||
repositories { | ||
gradlePluginPortal() | ||
mavenCentral() | ||
maven("https://maven.architectury.dev/") | ||
maven("https://maven.fabricmc.net/") | ||
maven("https://maven.neoforged.net/releases/") | ||
} | ||
|
||
dependencies { | ||
// Used to access version catalogue from the convention plugins | ||
// this is OK as long as the same version catalog is used in the main build and build-logic | ||
// see https://github.com/gradle/gradle/issues/15383#issuecomment-779893192 | ||
implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location)) | ||
implementation(libs.indra) | ||
implementation(libs.shadow) | ||
implementation(libs.architectury.plugin) | ||
implementation(libs.architectury.loom) | ||
implementation(libs.minotaur) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
@file:Suppress("UnstableApiUsage") | ||
|
||
dependencyResolutionManagement { | ||
versionCatalogs { | ||
create("libs") { | ||
from(files("../gradle/libs.versions.toml")) | ||
} | ||
} | ||
} | ||
|
||
rootProject.name = "build-logic" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import org.gradle.accessors.dm.LibrariesForLibs | ||
import org.gradle.api.Project | ||
import org.gradle.kotlin.dsl.getByType | ||
|
||
val Project.libs: LibrariesForLibs | ||
get() = rootProject.extensions.getByType() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import org.gradle.api.Project | ||
import org.gradle.api.artifacts.MinimalExternalModuleDependency | ||
import org.gradle.api.artifacts.ProjectDependency | ||
import org.gradle.api.provider.Provider | ||
|
||
val providedDependencies = mutableMapOf<String, MutableSet<String>>() | ||
|
||
fun Project.provided(pattern: String, name: String, excludedOn: Int = 0b110) { | ||
providedDependencies.getOrPut(project.name) { mutableSetOf() } | ||
.add("${calcExclusion(pattern, 0b100, excludedOn)}:${calcExclusion(name, 0b10, excludedOn)}") | ||
} | ||
|
||
fun Project.provided(dependency: ProjectDependency) = | ||
provided(dependency.group!!, dependency.name) | ||
|
||
fun Project.provided(dependency: MinimalExternalModuleDependency) = | ||
provided(dependency.module.group, dependency.module.name) | ||
|
||
fun Project.provided(provider: Provider<MinimalExternalModuleDependency>) = | ||
provided(provider.get()) | ||
|
||
fun getProvidedDependenciesForProject(projectName: String): MutableSet<String> { | ||
return providedDependencies.getOrDefault(projectName, emptySet()).toMutableSet() | ||
} | ||
|
||
private fun calcExclusion(section: String, bit: Int, excludedOn: Int): String = | ||
if (excludedOn and bit > 0) section else "" | ||
|
||
fun projectVersion(project: Project): String = | ||
project.version.toString().replace("SNAPSHOT", "b" + buildNumber()) | ||
|
||
fun versionName(project: Project): String = | ||
"Floodgate-" + project.name.replaceFirstChar { it.uppercase() } + "-" + projectVersion(project) | ||
|
||
fun buildNumber(): Int = | ||
(System.getenv("GITHUB_RUN_NUMBER"))?.let { Integer.parseInt(it) } ?: -1 |
37 changes: 37 additions & 0 deletions
37
build-logic/src/main/kotlin/floodgate-modded.base-conventions.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
plugins { | ||
`java-library` | ||
id("net.kyori.indra") | ||
} | ||
|
||
dependencies { | ||
compileOnly("org.checkerframework", "checker-qual", "3.19.0") | ||
} | ||
|
||
indra { | ||
github("GeyserMC", "floodgate-modded") { | ||
ci(true) | ||
issues(true) | ||
scm(true) | ||
} | ||
mitLicense() | ||
|
||
javaVersions { | ||
target(21) | ||
} | ||
} | ||
|
||
tasks { | ||
processResources { | ||
filesMatching(listOf("fabric.mod.json", "META-INF/neoforge.mods.toml")) { | ||
expand( | ||
"id" to "floodgate", | ||
"name" to "Floodgate", | ||
"version" to project.version, | ||
"description" to project.description, | ||
"url" to "https://geysermc.org", | ||
"author" to "GeyserMC", | ||
"minecraft_version" to libs.versions.minecraft.version.get() | ||
) | ||
} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
build-logic/src/main/kotlin/floodgate-modded.build-logic.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
repositories { | ||
// mavenLocal() | ||
mavenCentral() | ||
maven("https://maven.fabricmc.net/") | ||
maven("https://maven.neoforged.net/releases") | ||
maven("https://repo.opencollab.dev/main/") | ||
maven("https://jitpack.io") { | ||
content { | ||
includeGroupByRegex("com.github.*") | ||
} | ||
} | ||
maven("https://oss.sonatype.org/content/repositories/snapshots/") | ||
maven("https://s01.oss.sonatype.org/content/repositories/snapshots/") | ||
} |
134 changes: 134 additions & 0 deletions
134
build-logic/src/main/kotlin/floodgate-modded.platform-conventions.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
import net.fabricmc.loom.task.RemapJarTask | ||
|
||
plugins { | ||
id("floodgate-modded.publish-conventions") | ||
id("architectury-plugin") | ||
id("dev.architectury.loom") | ||
id("com.modrinth.minotaur") | ||
} | ||
|
||
// These are all provided by Minecraft/server platforms | ||
provided("com.google.code.gson", "gson") | ||
provided("org.slf4j", ".*") | ||
provided("com.google.guava", "guava") | ||
provided("org.ow2.asm", "asm") | ||
provided("com.nukkitx.fastutil", ".*") | ||
|
||
// these we just don't want to include | ||
provided("org.checkerframework", ".*") | ||
provided("com.google.errorprone", ".*") | ||
provided("com.github.spotbugs", "spotbugs-annotations") | ||
provided("com.google.code.findbugs", ".*") | ||
|
||
// cloud-fabric/cloud-neoforge jij's all cloud depends already | ||
provided("org.incendo", ".*") | ||
provided("io.leangen.geantyref", "geantyref") | ||
|
||
architectury { | ||
minecraft = libs.versions.minecraft.version.get() | ||
} | ||
|
||
loom { | ||
silentMojangMappingsLicense() | ||
} | ||
|
||
configurations { | ||
create("includeTransitive").isTransitive = true | ||
} | ||
|
||
dependencies { | ||
minecraft(libs.minecraft) | ||
mappings(loom.officialMojangMappings()) | ||
|
||
// These are under our own namespace | ||
shadow(libs.floodgate.api) { isTransitive = false } | ||
shadow(libs.floodgate.core) { isTransitive = false } | ||
|
||
// Requires relocation | ||
shadow(libs.bstats) { isTransitive = false } | ||
|
||
// Shadow & relocate these since the (indirectly) depend on quite old dependencies | ||
shadow(libs.guice) { isTransitive = false } | ||
shadow(libs.configutils) { | ||
exclude("org.checkerframework") | ||
exclude("com.google.errorprone") | ||
exclude("com.github.spotbugs") | ||
exclude("com.nukkitx.fastutil") | ||
} | ||
|
||
} | ||
|
||
tasks { | ||
sourcesJar { | ||
archiveClassifier.set("sources") | ||
from(sourceSets.main.get().allSource) | ||
} | ||
|
||
shadowJar { | ||
// Mirrors the example fabric project, otherwise tons of dependencies are shaded that shouldn't be | ||
configurations = listOf(project.configurations.shadow.get()) | ||
|
||
// Relocate these | ||
relocate("org.bstats", "org.geysermc.floodgate.shadow.bstats") | ||
relocate("com.google.inject", "org.geysermc.floodgate.shadow.google.inject") | ||
relocate("org.yaml", "org.geysermc.floodgate.shadow.org.yaml") | ||
|
||
// The remapped shadowJar is the final desired mod jar | ||
archiveVersion.set(project.version.toString()) | ||
archiveClassifier.set("shaded") | ||
} | ||
|
||
remapJar { | ||
dependsOn(shadowJar) | ||
inputFile.set(shadowJar.get().archiveFile) | ||
archiveClassifier.set("") | ||
archiveVersion.set("") | ||
} | ||
|
||
register("remapModrinthJar", RemapJarTask::class) { | ||
dependsOn(shadowJar) | ||
inputFile.set(shadowJar.get().archiveFile) | ||
archiveVersion.set(versionName(project)) | ||
archiveClassifier.set("") | ||
} | ||
|
||
// Readme sync | ||
modrinth.get().dependsOn(tasks.modrinthSyncBody) | ||
} | ||
|
||
afterEvaluate { | ||
val providedDependencies = getProvidedDependenciesForProject(project.name) | ||
|
||
// These are shaded, no need to JiJ them | ||
configurations["shadow"].resolvedConfiguration.resolvedArtifacts.forEach {shadowed -> | ||
val string = "${shadowed.moduleVersion.id.group}:${shadowed.moduleVersion.id.name}" | ||
println("Not including shadowed dependency: $string") | ||
providedDependencies.add(string) | ||
} | ||
|
||
configurations["includeTransitive"].resolvedConfiguration.resolvedArtifacts.forEach { dep -> | ||
if (!providedDependencies.contains("${dep.moduleVersion.id.group}:${dep.moduleVersion.id.name}") | ||
and !providedDependencies.contains("${dep.moduleVersion.id.group}:.*")) { | ||
println("Including dependency via JiJ: ${dep.id}") | ||
dependencies.add("include", dep.moduleVersion.id.toString()) | ||
} else { | ||
println("Not including ${dep.id} for ${project.name}!") | ||
} | ||
} | ||
} | ||
|
||
modrinth { | ||
token.set(System.getenv("MODRINTH_TOKEN")) // Even though this is the default value, apparently this prevents GitHub Actions caching the token? | ||
projectId.set("bWrNNfkb") | ||
versionName.set(versionName(project)) | ||
versionNumber.set(projectVersion(project)) | ||
versionType.set("release") | ||
changelog.set("A changelog can be found at https://github.com/GeyserMC/Floodgate-Modded/commits") | ||
|
||
syncBodyFrom.set(rootProject.file("README.md").readText()) | ||
|
||
uploadFile.set(tasks.getByPath("remapModrinthJar")) | ||
gameVersions.add(libs.minecraft.get().version as String) | ||
gameVersions.add("1.21.1") | ||
failSilently.set(false) | ||
} |
15 changes: 15 additions & 0 deletions
15
build-logic/src/main/kotlin/floodgate-modded.publish-conventions.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
plugins { | ||
id("floodgate-modded.shadow-conventions") | ||
id("net.kyori.indra.publishing") | ||
} | ||
|
||
indra { | ||
publishSnapshotsTo("geysermc", "https://repo.opencollab.dev/maven-snapshots") | ||
publishReleasesTo("geysermc", "https://repo.opencollab.dev/maven-releases") | ||
} | ||
|
||
publishing { | ||
// skip shadow jar from publishing. Workaround for https://github.com/johnrengelman/shadow/issues/651 | ||
val javaComponent = project.components["java"] as AdhocComponentWithVariants | ||
javaComponent.withVariantsFromConfiguration(configurations["shadowRuntimeElements"]) { skip() } | ||
} |
37 changes: 37 additions & 0 deletions
37
build-logic/src/main/kotlin/floodgate-modded.shadow-conventions.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar | ||
|
||
plugins { | ||
id("floodgate-modded.base-conventions") | ||
id("com.github.johnrengelman.shadow") | ||
} | ||
|
||
tasks { | ||
named<Jar>("jar") { | ||
archiveClassifier.set("unshaded") | ||
from(project.rootProject.file("LICENSE")) | ||
} | ||
val shadowJar = named<ShadowJar>("shadowJar") { | ||
archiveBaseName.set(project.name) | ||
archiveVersion.set("") | ||
archiveClassifier.set("") | ||
|
||
val sJar: ShadowJar = this | ||
|
||
doFirst { | ||
providedDependencies[project.name]?.forEach { string -> | ||
sJar.dependencies { | ||
println("Excluding $string from ${project.name}") | ||
exclude(dependency(string)) | ||
} | ||
} | ||
|
||
sJar.dependencies { | ||
exclude(dependency("org.checkerframework:checker-qual:.*")) | ||
exclude(dependency("org.jetbrains:annotations:.*")) | ||
} | ||
} | ||
} | ||
named("build") { | ||
dependsOn(shadowJar) | ||
} | ||
} |
Oops, something went wrong.