restructure the project
Some checks failed
Publish to snapshot maven / build (push) Failing after 33s

This commit is contained in:
moehreag 2024-06-11 03:12:54 +02:00
parent 4ce6722ae1
commit 9389a86aa5
49 changed files with 211 additions and 65 deletions

View file

@ -1,42 +1,57 @@
plugins { plugins {
java `java-library`
`maven-publish` `maven-publish`
id("dev.frogmc.phytotelma") version "0.0.1-SNAPSHOT" id("dev.frogmc.phytotelma") version libs.versions.phytotelma
id("io.freefair.lombok") version "8.+" id("io.freefair.lombok") version libs.versions.lombok
} }
group = "dev.frogmc" group = "dev.frogmc"
version = "0.0.1-SNAPSHOT" version = "0.0.1-SNAPSHOT"
repositories { subprojects {
if (!project.projectDir.resolve("src/main/resources/frog.mod.toml").exists()) {
return@subprojects
}
project.group = "dev.frogmc.froglib"
project.version = rootProject.version
} }
dependencies { allprojects {
if (!project.projectDir.resolve("src/main/resources/frog.mod.toml").exists()) {
return@allprojects
}
} apply(plugin = "java-library")
apply(plugin = "dev.frogmc.phytotelma")
apply(plugin = "maven-publish")
apply(plugin = "io.freefair.lombok")
phytotelma {
loader(project.libs.versions.frogloader)
minecraft(project.libs.versions.minecraft)
}
tasks.processResources { phytotelma {
loader(rootProject.libs.versions.frogloader)
minecraft(rootProject.libs.versions.minecraft)
}
tasks.processResources {
inputs.property("version", version) inputs.property("version", version)
inputs.property("game_version", libs.versions.minecraft.get())
filesMatching("frog.mod.toml") { filesMatching("frog.mod.toml") {
expand("version" to version) expand("version" to version,
"game_version" to libs.versions.minecraft.get())
}
} }
}
tasks.runClient { tasks.runClient {
classpath(sourceSets.test.get().runtimeClasspath) classpath(sourceSets.test.get().runtimeClasspath)
} }
publishing { publishing {
publications { publications {
create<MavenPublication>("mavenJava") { create<MavenPublication>("mavenJava") {
artifactId = "frogloader" artifactId = project.name
from(components["java"]) from(components["java"])
} }
} }
@ -60,4 +75,20 @@ publishing {
} }
} }
} }
}
} }
evaluationDependsOnChildren()
dependencies {
project.subprojects.filter {
it.projectDir.resolve("src/main/resources/frog.mod.toml").exists()
}.forEach {
project.tasks.jar {
dependsOn(it.tasks.jar)
}
implementation(it)
include(it)
}
}

View file

@ -2,3 +2,6 @@
minecraft = "1.20.6" minecraft = "1.20.6"
frogloader = "0.0.1-SNAPSHOT" frogloader = "0.0.1-SNAPSHOT"
phytotelma = "0.0.1-SNAPSHOT"
lombok = "8.6"

View file

View file

@ -0,0 +1,19 @@
package dev.frogmc.froglib.branding.impl.mixin;
import dev.frogmc.frogloader.api.FrogLoader;
import dev.frogmc.frogloader.impl.mod.ModUtil;
import net.minecraft.CrashReport;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(CrashReport.class)
public class CrashReportMixin {
@Inject(method = "getDetails(Ljava/lang/StringBuilder;)V", at = @At("TAIL"))
private void addModInfoToCrashReport(StringBuilder builder, CallbackInfo ci){
builder.append("\n");
builder.append(ModUtil.getModList(FrogLoader.getInstance().getMods()));
}
}

View file

@ -0,0 +1,21 @@
[frog]
format_version = "1.0.0"
[frog.mod]
id = "froglib_branding"
name = "FrogLib Branding"
version = "$version"
license = "Apache-2.0"
credits = [
{ name = "FrogMC Team", roles = ["author"] }
]
[frog.dependencies]
depends = [
{ id = "minecraft", versions = "~$game_version", name = "Minecraft" }
]
[frog.extensions]
mixin = [
"froglib.branding.mixins.json",
]

View file

@ -4,7 +4,7 @@
"package": "dev.frogmc.froglib.branding.impl.mixin", "package": "dev.frogmc.froglib.branding.impl.mixin",
"compatibilityLevel": "JAVA_21", "compatibilityLevel": "JAVA_21",
"mixins": [ "mixins": [
"CrashReportMixin"
], ],
"server": [ "server": [
], ],

View file

View file

@ -0,0 +1,22 @@
[frog]
format_version = "1.0.0"
[frog.mod]
id = "froglib_core"
name = "FrogLib Core"
version = "$version"
license = "Apache-2.0"
credits = [
{ name = "FrogMC Team", roles = ["author"] }
]
[frog.dependencies]
depends = [
{ id = "minecraft", versions = "~$game_version", name = "Minecraft" }
]
[frog.extensions]
mixin = [
"froglib.entrypoints.mixins.json",
"froglib.events.mixins.json"
]

View file

View file

@ -13,6 +13,7 @@ public class KeyMappingsImpl implements KeyMappings {
} }
public void registerKey(KeyMapping mapping){ public void registerKey(KeyMapping mapping){
// TODO maybe synchronize?
Minecraft.getInstance().options.keyMappings = ArrayUtils.add(Minecraft.getInstance().options.keyMappings, mapping); Minecraft.getInstance().options.keyMappings = ArrayUtils.add(Minecraft.getInstance().options.keyMappings, mapping);
} }
} }

View file

@ -0,0 +1,22 @@
[frog]
format_version = "1.0.0"
[frog.mod]
id = "froglib_keybinds"
name = "FrogLib Keybinds"
version = "$version"
license = "Apache-2.0"
credits = [
{ name = "FrogMC Team", roles = ["author"] }
]
[frog.dependencies]
depends = [
{ id = "minecraft", versions = "~$game_version", name = "Minecraft" }
]
[frog.extensions]
mixin = [
"froglib.keybinds.mixins.json"
]
accesswidener = "froglib.accesswidener"

View file

View file

@ -0,0 +1,4 @@
dependencies {
api(project(":library:core"))
}

View file

@ -0,0 +1,27 @@
[frog]
format_version = "1.0.0"
[frog.mod]
id = "froglib_resourceloader"
name = "FrogLib Resource Loader"
version = "$version"
license = "Apache-2.0"
credits = [
{ name = "FrogMC Team", roles = ["author"] }
]
[frog.dependencies]
depends = [
{ id = "minecraft", versions = "~$game_version", name = "Minecraft" }
]
[frog.extensions]
client = [
"dev.frogmc.froglib.resources.impl.ResourceLoaderClient"
]
server = [
"dev.frogmc.froglib.resources.impl.ResourceLoaderServer"
]
mixin = [
"froglib.resources.mixins.json"
]

View file

@ -13,3 +13,13 @@ pluginManagement {
} }
rootProject.name = "froglib" rootProject.name = "froglib"
include("library:networking")
findProject(":library:networking")?.name = "networking"
include("library:branding")
findProject(":library:branding")?.name = "branding"
include("library:core")
findProject(":library:core")?.name = "core"
include("library:keybinds")
findProject(":library:keybinds")?.name = "keybinds"
include("library:resourceloader")
findProject(":library:resourceloader")?.name = "resourceloader"

View file

@ -12,21 +12,7 @@ credits = [
[frog.dependencies] [frog.dependencies]
depends = [ depends = [
{ id = "minecraft", versions = "~1.20.6", name = "Minecraft" } { id = "minecraft", versions = "~$game_version", name = "Minecraft" }
] ]
[frog.extensions] [frog.extensions]
client = [
"dev.frogmc.froglib.resources.impl.ResourceLoaderClient"
]
server = [
"dev.frogmc.froglib.resources.impl.ResourceLoaderServer"
]
mixin = [
"froglib.branding.mixins.json",
"froglib.entrypoints.mixins.json",
"froglib.events.mixins.json",
"froglib.resources.mixins.json",
"froglib.keybinds.mixins.json"
]
accesswidener = "froglib.accesswidener"