From b379be57ae16d508dd2215d1ab2cffc90c588799 Mon Sep 17 00:00:00 2001 From: Jozufozu Date: Mon, 6 Jan 2025 22:03:43 -0800 Subject: [PATCH 1/9] Make explicit the implicit - Add @apiNotes explaining that flywheel/ is prepended to each shader ResourceLocation's path - Document all InstanceType fields --- .../flywheel/api/instance/InstanceType.java | 37 +++++++++++++++++++ .../flywheel/api/material/CutoutShader.java | 6 +++ .../flywheel/api/material/FogShader.java | 6 +++ .../flywheel/api/material/LightShader.java | 6 +++ .../api/material/MaterialShaders.java | 9 +++++ 5 files changed, 64 insertions(+) diff --git a/common/src/api/java/dev/engine_room/flywheel/api/instance/InstanceType.java b/common/src/api/java/dev/engine_room/flywheel/api/instance/InstanceType.java index 1fd1c475e..fd5c726b1 100644 --- a/common/src/api/java/dev/engine_room/flywheel/api/instance/InstanceType.java +++ b/common/src/api/java/dev/engine_room/flywheel/api/instance/InstanceType.java @@ -15,11 +15,48 @@ public interface InstanceType { */ I create(InstanceHandle handle); + /** + * The native memory layout of this instance type. + * + *

This layout determines what fields are made available to the instance type's shaders + * as well as determining how the fields are arranged in memory. + * + * @return The layout of this instance type. + */ Layout layout(); + /** + * The writer of this instance type. + * + *

The writer of an InstanceType is responsible for translating java instance objects + * into contiguous native memory. The instance writer must write to the given pointer + * according to the layout of this instance type. + * + *

It is undefined behavior to write outside the half closed range + * {@code [ptr, ptr + layout().byteSize())}. + * + * @return The writer for this instance type. + */ InstanceWriter writer(); + /** + *

The vertex shader of an InstanceType is responsible for transforming vertices from mesh + * space to world space in whatever way the instance type requires. + * + * @return The vertex shader for this instance type. + * @apiNote {@code flywheel/} is implicitly prepended to the {@link ResourceLocation}'s path. + */ ResourceLocation vertexShader(); + /** + * The cull shader of this instance type. + * + *

The cull shader of an InstanceType is responsible for transforming bounding spheres from mesh + * space to world space, such that a mesh contained by the input bounding sphere and transformed + * by the vertex shader would be contained by the output bounding sphere. + * + * @return The cull shader for this instance type. + * @apiNote {@code flywheel/} is implicitly prepended to the {@link ResourceLocation}'s path. + */ ResourceLocation cullShader(); } diff --git a/common/src/api/java/dev/engine_room/flywheel/api/material/CutoutShader.java b/common/src/api/java/dev/engine_room/flywheel/api/material/CutoutShader.java index b45cd5432..d98910cd5 100644 --- a/common/src/api/java/dev/engine_room/flywheel/api/material/CutoutShader.java +++ b/common/src/api/java/dev/engine_room/flywheel/api/material/CutoutShader.java @@ -2,6 +2,12 @@ package dev.engine_room.flywheel.api.material; import net.minecraft.resources.ResourceLocation; +/** + * A shader that decides what colors should be discarded in the fragment shader. + */ public interface CutoutShader { + /** + * @apiNote {@code flywheel/} is implicitly prepended to the {@link ResourceLocation}'s path. + */ ResourceLocation source(); } diff --git a/common/src/api/java/dev/engine_room/flywheel/api/material/FogShader.java b/common/src/api/java/dev/engine_room/flywheel/api/material/FogShader.java index 9242d6990..9a77a873a 100644 --- a/common/src/api/java/dev/engine_room/flywheel/api/material/FogShader.java +++ b/common/src/api/java/dev/engine_room/flywheel/api/material/FogShader.java @@ -2,6 +2,12 @@ package dev.engine_room.flywheel.api.material; import net.minecraft.resources.ResourceLocation; +/** + * A shader that controls the fog effect on a material. + */ public interface FogShader { + /** + * @apiNote {@code flywheel/} is implicitly prepended to the {@link ResourceLocation}'s path. + */ ResourceLocation source(); } diff --git a/common/src/api/java/dev/engine_room/flywheel/api/material/LightShader.java b/common/src/api/java/dev/engine_room/flywheel/api/material/LightShader.java index 683be4674..977d16764 100644 --- a/common/src/api/java/dev/engine_room/flywheel/api/material/LightShader.java +++ b/common/src/api/java/dev/engine_room/flywheel/api/material/LightShader.java @@ -2,6 +2,12 @@ package dev.engine_room.flywheel.api.material; import net.minecraft.resources.ResourceLocation; +/** + * A shader that controls the GPU-based light on a material. + */ public interface LightShader { + /** + * @apiNote {@code flywheel/} is implicitly prepended to the {@link ResourceLocation}'s path. + */ ResourceLocation source(); } diff --git a/common/src/api/java/dev/engine_room/flywheel/api/material/MaterialShaders.java b/common/src/api/java/dev/engine_room/flywheel/api/material/MaterialShaders.java index 4cc566e2e..bb8dc76ad 100644 --- a/common/src/api/java/dev/engine_room/flywheel/api/material/MaterialShaders.java +++ b/common/src/api/java/dev/engine_room/flywheel/api/material/MaterialShaders.java @@ -2,8 +2,17 @@ package dev.engine_room.flywheel.api.material; import net.minecraft.resources.ResourceLocation; +/** + * A vertex and fragment shader pair that can be attached to a material. + */ public interface MaterialShaders { + /** + * @apiNote {@code flywheel/} is implicitly prepended to the {@link ResourceLocation}'s path. + */ ResourceLocation vertexSource(); + /** + * @apiNote {@code flywheel/} is implicitly prepended to the {@link ResourceLocation}'s path. + */ ResourceLocation fragmentSource(); } From 6bea04ffee02bb415805e9c5479849d52a4e47ab Mon Sep 17 00:00:00 2001 From: Jozufozu Date: Sun, 12 Jan 2025 13:02:50 -0800 Subject: [PATCH 2/9] No need to get spicy - Move common vanillin stuffs to a "vanillin" sourceset - Add vanillinForge and vanillinFabric subprojects - Mostly do gradling from scratch - Export remap jars from platform projects to `include` in vanillin projects --- .../engine_room/gradle/jarset/JarTaskSet.kt | 10 +-- .../gradle/platform/PlatformExtension.kt | 2 +- .../gradle/subproject/SubprojectPlugin.kt | 6 ++ common/build.gradle.kts | 8 +- .../engine_room/flywheel/impl/FlwImpl.java | 4 - .../dev/engine_room/vanillin/Vanillin.java | 5 ++ .../vanillin/visuals}/BellVisual.java | 2 +- .../vanillin/visuals}/ChestVisual.java | 2 +- .../vanillin/visuals}/MinecartVisual.java | 2 +- .../vanillin/visuals}/ShulkerBoxVisual.java | 2 +- .../vanillin/visuals}/TntMinecartVisual.java | 2 +- .../vanillin/visuals}/VanillaVisuals.java | 2 +- fabric/build.gradle.kts | 7 ++ forge/build.gradle.kts | 7 ++ gradle.properties | 6 ++ settings.gradle.kts | 2 + vanillinFabric/build.gradle.kts | 75 ++++++++++++++++ vanillinFabric/gradle.properties | 1 + .../engine_room/vanillin/VanillinFabric.java | 11 +++ .../src/main/resources/fabric.mod.json | 34 ++++++++ vanillinForge/build.gradle.kts | 86 +++++++++++++++++++ vanillinForge/gradle.properties | 1 + .../engine_room/vanillin/VanillinForge.java | 23 +++++ .../src/main/resources/META-INF/mods.toml | 33 +++++++ vanillinForge/src/main/resources/pack.mcmeta | 6 ++ 25 files changed, 322 insertions(+), 17 deletions(-) create mode 100644 common/src/vanillin/java/dev/engine_room/vanillin/Vanillin.java rename common/src/{main/java/dev/engine_room/flywheel/vanilla => vanillin/java/dev/engine_room/vanillin/visuals}/BellVisual.java (98%) rename common/src/{main/java/dev/engine_room/flywheel/vanilla => vanillin/java/dev/engine_room/vanillin/visuals}/ChestVisual.java (99%) rename common/src/{main/java/dev/engine_room/flywheel/vanilla => vanillin/java/dev/engine_room/vanillin/visuals}/MinecartVisual.java (99%) rename common/src/{main/java/dev/engine_room/flywheel/vanilla => vanillin/java/dev/engine_room/vanillin/visuals}/ShulkerBoxVisual.java (98%) rename common/src/{main/java/dev/engine_room/flywheel/vanilla => vanillin/java/dev/engine_room/vanillin/visuals}/TntMinecartVisual.java (96%) rename common/src/{main/java/dev/engine_room/flywheel/vanilla => vanillin/java/dev/engine_room/vanillin/visuals}/VanillaVisuals.java (98%) create mode 100644 vanillinFabric/build.gradle.kts create mode 100644 vanillinFabric/gradle.properties create mode 100644 vanillinFabric/src/main/java/dev/engine_room/vanillin/VanillinFabric.java create mode 100644 vanillinFabric/src/main/resources/fabric.mod.json create mode 100644 vanillinForge/build.gradle.kts create mode 100644 vanillinForge/gradle.properties create mode 100644 vanillinForge/src/main/java/dev/engine_room/vanillin/VanillinForge.java create mode 100644 vanillinForge/src/main/resources/META-INF/mods.toml create mode 100644 vanillinForge/src/main/resources/pack.mcmeta diff --git a/buildSrc/src/main/kotlin/dev/engine_room/gradle/jarset/JarTaskSet.kt b/buildSrc/src/main/kotlin/dev/engine_room/gradle/jarset/JarTaskSet.kt index 7ef0b7fc7..0327683d5 100644 --- a/buildSrc/src/main/kotlin/dev/engine_room/gradle/jarset/JarTaskSet.kt +++ b/buildSrc/src/main/kotlin/dev/engine_room/gradle/jarset/JarTaskSet.kt @@ -23,11 +23,11 @@ import org.gradle.language.jvm.tasks.ProcessResources class JarTaskSet( private val project: Project, private val name: String, - private val jar: TaskProvider, - private val sources: TaskProvider, - private val javadocJar: TaskProvider, - private val remapJar: TaskProvider, - private val remapSources: TaskProvider + val jar: TaskProvider, + val sources: TaskProvider, + val javadocJar: TaskProvider, + val remapJar: TaskProvider, + val remapSources: TaskProvider ) { fun publish(artifactId: String) { diff --git a/buildSrc/src/main/kotlin/dev/engine_room/gradle/platform/PlatformExtension.kt b/buildSrc/src/main/kotlin/dev/engine_room/gradle/platform/PlatformExtension.kt index 2addef1dc..55b0d12ac 100644 --- a/buildSrc/src/main/kotlin/dev/engine_room/gradle/platform/PlatformExtension.kt +++ b/buildSrc/src/main/kotlin/dev/engine_room/gradle/platform/PlatformExtension.kt @@ -23,7 +23,7 @@ open class PlatformExtension(val project: Project) { var apiArtifactId: String = "flywheel-${project.name}-api-${project.property("artifact_minecraft_version")}" - private val commonSourceSets: SourceSetContainer by lazy { commonProject.the() } + val commonSourceSets: SourceSetContainer by lazy { commonProject.the() } fun setupLoomMod(vararg sourceSets: SourceSet) { project.the().mods.maybeCreate("main").apply { diff --git a/buildSrc/src/main/kotlin/dev/engine_room/gradle/subproject/SubprojectPlugin.kt b/buildSrc/src/main/kotlin/dev/engine_room/gradle/subproject/SubprojectPlugin.kt index 6c3230f0d..8fa4ff4d4 100644 --- a/buildSrc/src/main/kotlin/dev/engine_room/gradle/subproject/SubprojectPlugin.kt +++ b/buildSrc/src/main/kotlin/dev/engine_room/gradle/subproject/SubprojectPlugin.kt @@ -181,5 +181,11 @@ val processResourcesExpandProperties = listOf( "minecraft_maven_version_range", "fabric_api_version_range", "forge_version_range", + "vanillin_id", + "vanillin_name", + "vanillin_version", + "vanillin_description", + "flywheel_maven_version_range", + "flywheel_semver_version_range", ) diff --git a/common/build.gradle.kts b/common/build.gradle.kts index 5aaf88778..84d63c41c 100644 --- a/common/build.gradle.kts +++ b/common/build.gradle.kts @@ -11,6 +11,7 @@ val lib = sourceSets.create("lib") val backend = sourceSets.create("backend") val stubs = sourceSets.create("stubs") val main = sourceSets.getByName("main") +val vanillin = sourceSets.create("vanillin") transitiveSourceSets { compileClasspath = main.compileClasspath @@ -35,10 +36,14 @@ transitiveSourceSets { sourceSet(sourceSets.getByName("test")) { implementation(api, lib, backend) } + sourceSet(vanillin) { + rootCompile() + compile(api, lib) + } } defaultPackageInfos { - sources(api, lib, backend, main) + sources(api, lib, backend, main, vanillin) } jarSets { @@ -48,6 +53,7 @@ jarSets { outgoing("commonBackend", backend) outgoing("commonStubs", stubs) outgoing("commonImpl", main) + outgoing("commonVanillin", vanillin) // For publishing. create("api", api, lib).apply { diff --git a/common/src/main/java/dev/engine_room/flywheel/impl/FlwImpl.java b/common/src/main/java/dev/engine_room/flywheel/impl/FlwImpl.java index 909c39647..3ee7c6352 100644 --- a/common/src/main/java/dev/engine_room/flywheel/impl/FlwImpl.java +++ b/common/src/main/java/dev/engine_room/flywheel/impl/FlwImpl.java @@ -6,7 +6,6 @@ import org.slf4j.LoggerFactory; import dev.engine_room.flywheel.api.Flywheel; import dev.engine_room.flywheel.backend.FlwBackend; import dev.engine_room.flywheel.impl.registry.IdRegistryImpl; -import dev.engine_room.flywheel.vanilla.VanillaVisuals; public final class FlwImpl { public static final Logger LOGGER = LoggerFactory.getLogger(Flywheel.ID); @@ -23,9 +22,6 @@ public final class FlwImpl { // backend FlwBackend.init(FlwConfig.INSTANCE.backendConfig()); - - // vanilla - VanillaVisuals.init(); } public static void freezeRegistries() { diff --git a/common/src/vanillin/java/dev/engine_room/vanillin/Vanillin.java b/common/src/vanillin/java/dev/engine_room/vanillin/Vanillin.java new file mode 100644 index 000000000..2b4fd2efb --- /dev/null +++ b/common/src/vanillin/java/dev/engine_room/vanillin/Vanillin.java @@ -0,0 +1,5 @@ +package dev.engine_room.vanillin; + +public class Vanillin { + public static final String ID = "vanillin"; +} diff --git a/common/src/main/java/dev/engine_room/flywheel/vanilla/BellVisual.java b/common/src/vanillin/java/dev/engine_room/vanillin/visuals/BellVisual.java similarity index 98% rename from common/src/main/java/dev/engine_room/flywheel/vanilla/BellVisual.java rename to common/src/vanillin/java/dev/engine_room/vanillin/visuals/BellVisual.java index c1ebae568..cd6788c67 100644 --- a/common/src/main/java/dev/engine_room/flywheel/vanilla/BellVisual.java +++ b/common/src/vanillin/java/dev/engine_room/vanillin/visuals/BellVisual.java @@ -1,4 +1,4 @@ -package dev.engine_room.flywheel.vanilla; +package dev.engine_room.vanillin.visuals; import java.util.function.Consumer; diff --git a/common/src/main/java/dev/engine_room/flywheel/vanilla/ChestVisual.java b/common/src/vanillin/java/dev/engine_room/vanillin/visuals/ChestVisual.java similarity index 99% rename from common/src/main/java/dev/engine_room/flywheel/vanilla/ChestVisual.java rename to common/src/vanillin/java/dev/engine_room/vanillin/visuals/ChestVisual.java index ebf0d2456..fe4731189 100644 --- a/common/src/main/java/dev/engine_room/flywheel/vanilla/ChestVisual.java +++ b/common/src/vanillin/java/dev/engine_room/vanillin/visuals/ChestVisual.java @@ -1,4 +1,4 @@ -package dev.engine_room.flywheel.vanilla; +package dev.engine_room.vanillin.visuals; import java.util.Calendar; import java.util.EnumMap; diff --git a/common/src/main/java/dev/engine_room/flywheel/vanilla/MinecartVisual.java b/common/src/vanillin/java/dev/engine_room/vanillin/visuals/MinecartVisual.java similarity index 99% rename from common/src/main/java/dev/engine_room/flywheel/vanilla/MinecartVisual.java rename to common/src/vanillin/java/dev/engine_room/vanillin/visuals/MinecartVisual.java index b3c90cdef..e654cc75d 100644 --- a/common/src/main/java/dev/engine_room/flywheel/vanilla/MinecartVisual.java +++ b/common/src/vanillin/java/dev/engine_room/vanillin/visuals/MinecartVisual.java @@ -1,4 +1,4 @@ -package dev.engine_room.flywheel.vanilla; +package dev.engine_room.vanillin.visuals; import org.jetbrains.annotations.Nullable; import org.joml.Matrix4f; diff --git a/common/src/main/java/dev/engine_room/flywheel/vanilla/ShulkerBoxVisual.java b/common/src/vanillin/java/dev/engine_room/vanillin/visuals/ShulkerBoxVisual.java similarity index 98% rename from common/src/main/java/dev/engine_room/flywheel/vanilla/ShulkerBoxVisual.java rename to common/src/vanillin/java/dev/engine_room/vanillin/visuals/ShulkerBoxVisual.java index 699d96c9e..0080041a1 100644 --- a/common/src/main/java/dev/engine_room/flywheel/vanilla/ShulkerBoxVisual.java +++ b/common/src/vanillin/java/dev/engine_room/vanillin/visuals/ShulkerBoxVisual.java @@ -1,4 +1,4 @@ -package dev.engine_room.flywheel.vanilla; +package dev.engine_room.vanillin.visuals; import java.util.Set; import java.util.function.Consumer; diff --git a/common/src/main/java/dev/engine_room/flywheel/vanilla/TntMinecartVisual.java b/common/src/vanillin/java/dev/engine_room/vanillin/visuals/TntMinecartVisual.java similarity index 96% rename from common/src/main/java/dev/engine_room/flywheel/vanilla/TntMinecartVisual.java rename to common/src/vanillin/java/dev/engine_room/vanillin/visuals/TntMinecartVisual.java index 4ba546586..7cf6d0736 100644 --- a/common/src/main/java/dev/engine_room/flywheel/vanilla/TntMinecartVisual.java +++ b/common/src/vanillin/java/dev/engine_room/vanillin/visuals/TntMinecartVisual.java @@ -1,4 +1,4 @@ -package dev.engine_room.flywheel.vanilla; +package dev.engine_room.vanillin.visuals; import org.joml.Matrix4f; diff --git a/common/src/main/java/dev/engine_room/flywheel/vanilla/VanillaVisuals.java b/common/src/vanillin/java/dev/engine_room/vanillin/visuals/VanillaVisuals.java similarity index 98% rename from common/src/main/java/dev/engine_room/flywheel/vanilla/VanillaVisuals.java rename to common/src/vanillin/java/dev/engine_room/vanillin/visuals/VanillaVisuals.java index 3516cd041..eae31e8f2 100644 --- a/common/src/main/java/dev/engine_room/flywheel/vanilla/VanillaVisuals.java +++ b/common/src/vanillin/java/dev/engine_room/vanillin/visuals/VanillaVisuals.java @@ -1,4 +1,4 @@ -package dev.engine_room.flywheel.vanilla; +package dev.engine_room.vanillin.visuals; import static dev.engine_room.flywheel.lib.visualization.SimpleBlockEntityVisualizer.builder; import static dev.engine_room.flywheel.lib.visualization.SimpleEntityVisualizer.builder; diff --git a/fabric/build.gradle.kts b/fabric/build.gradle.kts index b1b04dad8..6f2a7745e 100644 --- a/fabric/build.gradle.kts +++ b/fabric/build.gradle.kts @@ -66,6 +66,13 @@ jarSets { } } +val config = project.configurations.register("flywheelFabric") { + isCanBeConsumed = true + isCanBeResolved = false +} + +project.artifacts.add(config.name, jarSets.mainSet.remapJar) + defaultPackageInfos { sources(api, lib, backend, main) } diff --git a/forge/build.gradle.kts b/forge/build.gradle.kts index 6900fd197..6b1959a84 100644 --- a/forge/build.gradle.kts +++ b/forge/build.gradle.kts @@ -64,6 +64,13 @@ jarSets { } } +val config = project.configurations.register("flywheelForge") { + isCanBeConsumed = true + isCanBeResolved = false +} + +project.artifacts.add(config.name, jarSets.mainSet.remapJar) + defaultPackageInfos { sources(api, lib, backend, main) } diff --git a/gradle.properties b/gradle.properties index 57a9985e6..1741bed76 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,6 +10,12 @@ mod_license = MIT mod_sources = https://github.com/Engine-Room/Flywheel mod_issues = https://github.com/Engine-Room/Flywheel/issues mod_homepage = https://github.com/Engine-Room/Flywheel +vanillin_id=vanillin +vanillin_name=Vanillin +vanillin_version=1.0.0-beta +vanillin_description=Instanced rendering for entities and block entities via Flywheel. +flywheel_maven_version_range=[1.0.0-beta,2.0) +flywheel_semver_version_range=>=1.0.0-beta <2.0.0 # Mod dependency declarations minecraft_semver_version_range = >=1.20.1 <1.20.2 diff --git a/settings.gradle.kts b/settings.gradle.kts index cdaa0ff9f..3f8bd243d 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -18,3 +18,5 @@ rootProject.name = "Flywheel" include("common") include("fabric") include("forge") +include("vanillinForge") +include("vanillinFabric") diff --git a/vanillinFabric/build.gradle.kts b/vanillinFabric/build.gradle.kts new file mode 100644 index 000000000..84adeef1e --- /dev/null +++ b/vanillinFabric/build.gradle.kts @@ -0,0 +1,75 @@ +import dev.engine_room.gradle.jarset.JarTaskSet +import org.gradle.jvm.tasks.Jar + +plugins { + idea + java + `maven-publish` + id("dev.architectury.loom") + id("flywheel.subproject") + id("flywheel.platform") +} + +group = "dev.engine_room.vanillin" + +val main = sourceSets.getByName("main") + +platform { + modArtifactId = "vanillin-fabric-${project.property("artifact_minecraft_version")}" + commonProject = project(":common") + setupLoomRuns() +} + +listOf("api", "lib") + .map { project(":fabric").sourceSets.named(it).get() } + .forEach { main.compileClasspath += it.output } + +val commonSourceSet = platform.commonSourceSets.named("vanillin").get() + +tasks.named("javadoc").configure { + source(commonSourceSet.allJava) + + JarTaskSet.excludeDuplicatePackageInfos(this) +} + +tasks.named("sourcesJar").configure { + from(commonSourceSet.allJava) + + JarTaskSet.excludeDuplicatePackageInfos(this) +} + +tasks.withType().configureEach { + JarTaskSet.excludeDuplicatePackageInfos(this) +} +tasks.named(main.compileJavaTaskName).configure { + source(commonSourceSet.allJava) +} +tasks.named(main.processResourcesTaskName).configure { + from(commonSourceSet.resources) +} + +jarSets { + mainSet.publish(platform.modArtifactId) +} + +defaultPackageInfos { + sources(main) +} + +loom { + mixin { + useLegacyMixinAp = true + add(main, "vanillin.refmap.json") + } +} + +dependencies { + modImplementation("net.fabricmc:fabric-loader:${property("fabric_loader_version")}") + modApi("net.fabricmc.fabric-api:fabric-api:${property("fabric_api_version")}") + + modCompileOnly("maven.modrinth:sodium:${property("sodium_version")}") + + compileOnly(project(path = ":common", configuration = "commonVanillin")) + include(project(path = ":fabric", configuration = "flywheelFabric")) + modRuntimeOnly(project(path = ":fabric", configuration = "flywheelFabric")) +} diff --git a/vanillinFabric/gradle.properties b/vanillinFabric/gradle.properties new file mode 100644 index 000000000..e846a8f57 --- /dev/null +++ b/vanillinFabric/gradle.properties @@ -0,0 +1 @@ +loom.platform=fabric diff --git a/vanillinFabric/src/main/java/dev/engine_room/vanillin/VanillinFabric.java b/vanillinFabric/src/main/java/dev/engine_room/vanillin/VanillinFabric.java new file mode 100644 index 000000000..8b01ad009 --- /dev/null +++ b/vanillinFabric/src/main/java/dev/engine_room/vanillin/VanillinFabric.java @@ -0,0 +1,11 @@ +package dev.engine_room.vanillin; + +import dev.engine_room.vanillin.visuals.VanillaVisuals; +import net.fabricmc.api.ClientModInitializer; + +public class VanillinFabric implements ClientModInitializer { + @Override + public void onInitializeClient() { + VanillaVisuals.init(); + } +} diff --git a/vanillinFabric/src/main/resources/fabric.mod.json b/vanillinFabric/src/main/resources/fabric.mod.json new file mode 100644 index 000000000..fd50a6f89 --- /dev/null +++ b/vanillinFabric/src/main/resources/fabric.mod.json @@ -0,0 +1,34 @@ +{ + "schemaVersion" : 1, + "id" : "${vanillin_id}", + "version" : "${vanillin_version}", + "name" : "${vanillin_name}", + "description" : "${vanillin_description}", + "authors" : [ + "Jozufozu", + "PepperCode1" + ], + "contact" : { + "homepage" : "${mod_homepage}", + "sources" : "${mod_sources}", + "issues" : "${mod_issues}" + }, + "license" : "${mod_license}", + "icon" : "logo.png", + "environment" : "client", + "entrypoints" : { + "client" : [ + "dev.engine_room.vanillin.VanillinFabric" + ] + }, + "mixins" : [ + ], + "depends" : { + "minecraft" : "${minecraft_semver_version_range}", + "fabricloader" : ">=0.15.0", + "fabric-api" : "${fabric_api_version_range}", + "${mod_id}" : "${flywheel_semver_version_range}" + }, + "breaks" : { + } +} diff --git a/vanillinForge/build.gradle.kts b/vanillinForge/build.gradle.kts new file mode 100644 index 000000000..0c72d0ef9 --- /dev/null +++ b/vanillinForge/build.gradle.kts @@ -0,0 +1,86 @@ +import dev.engine_room.gradle.jarset.JarTaskSet +import org.gradle.jvm.tasks.Jar + +plugins { + idea + java + `maven-publish` + id("dev.architectury.loom") + id("flywheel.subproject") + id("flywheel.platform") +} + +group = "dev.engine_room.vanillin" + +val main = sourceSets.getByName("main") + +platform { + modArtifactId = "vanillin-forge-${project.property("artifact_minecraft_version")}" + commonProject = project(":common") + setupLoomRuns() +} + +listOf("api", "lib") + .map { project(":forge").sourceSets.named(it).get() } + .forEach { main.compileClasspath += it.output } + +val commonSourceSet = platform.commonSourceSets.named("vanillin").get() + +tasks.named("javadoc").configure { + source(commonSourceSet.allJava) + + JarTaskSet.excludeDuplicatePackageInfos(this) +} + +tasks.named("sourcesJar").configure { + from(commonSourceSet.allJava) + + JarTaskSet.excludeDuplicatePackageInfos(this) +} + +tasks.withType().configureEach { + JarTaskSet.excludeDuplicatePackageInfos(this) +} +tasks.named(main.compileJavaTaskName).configure { + source(commonSourceSet.allJava) +} +tasks.named(main.processResourcesTaskName).configure { + from(commonSourceSet.resources) +} + +jarSets { + mainSet.publish(platform.modArtifactId) +} + +defaultPackageInfos { + sources(main) +} + +loom { + mixin { + useLegacyMixinAp = true + add(main, "vanillin.refmap.json") + } + + forge { +// mixinConfig("flywheel.backend.mixins.json") +// mixinConfig("flywheel.impl.mixins.json") + } + + runs { + configureEach { + property("forge.logging.markers", "") + property("forge.logging.console.level", "debug") + } + } +} + +dependencies { + forge("net.minecraftforge:forge:${property("minecraft_version")}-${property("forge_version")}") + + modCompileOnly("maven.modrinth:embeddium:${property("embeddium_version")}") + + compileOnly(project(path = ":common", configuration = "commonVanillin")) + include(project(path = ":forge", configuration = "flywheelForge")) + modRuntimeOnly(project(path = ":forge", configuration = "flywheelForge")) +} diff --git a/vanillinForge/gradle.properties b/vanillinForge/gradle.properties new file mode 100644 index 000000000..82425854e --- /dev/null +++ b/vanillinForge/gradle.properties @@ -0,0 +1 @@ +loom.platform=forge diff --git a/vanillinForge/src/main/java/dev/engine_room/vanillin/VanillinForge.java b/vanillinForge/src/main/java/dev/engine_room/vanillin/VanillinForge.java new file mode 100644 index 000000000..7bbe0651b --- /dev/null +++ b/vanillinForge/src/main/java/dev/engine_room/vanillin/VanillinForge.java @@ -0,0 +1,23 @@ +package dev.engine_room.vanillin; + +import dev.engine_room.vanillin.visuals.VanillaVisuals; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.eventbus.api.IEventBus; +import net.minecraftforge.fml.DistExecutor; +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; + +@Mod(Vanillin.ID) +public class VanillinForge { + public VanillinForge() { + IEventBus forgeEventBus = MinecraftForge.EVENT_BUS; + IEventBus modEventBus = FMLJavaModLoadingContext.get() + .getModEventBus(); + DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> clientInit(forgeEventBus, modEventBus)); + } + + private static void clientInit(IEventBus forgeEventBus, IEventBus modEventBus) { + VanillaVisuals.init(); + } +} diff --git a/vanillinForge/src/main/resources/META-INF/mods.toml b/vanillinForge/src/main/resources/META-INF/mods.toml new file mode 100644 index 000000000..b550c343b --- /dev/null +++ b/vanillinForge/src/main/resources/META-INF/mods.toml @@ -0,0 +1,33 @@ +modLoader = "javafml" +# The loader version doesn't matter. Modify the Forge and/or Minecraft version ranges instead. +loaderVersion = "[0,)" +license = "${mod_license}" +issueTrackerURL = "${mod_issues}" + +[[mods]] +modId = "${vanillin_id}" +version = "${vanillin_version}" +displayName = "${vanillin_name}" +description = "${vanillin_description}" +logoFile = "logo.png" +authors = "Jozufozu, PepperCode1" +displayURL = "${mod_homepage}" +displayTest = "IGNORE_ALL_VERSION" + +[[dependencies.${ vanillin_id }]] +modId = "minecraft" +mandatory = true +versionRange = "${minecraft_maven_version_range}" +side = "CLIENT" + +[[dependencies.${ vanillin_id }]] +modId = "forge" +mandatory = true +versionRange = "${forge_version_range}" +side = "CLIENT" + +[[dependencies.${ vanillin_id }]] +modId = "${mod_id}" +mandatory = true +versionRange = "${flywheel_maven_version_range}" +side = "CLIENT" diff --git a/vanillinForge/src/main/resources/pack.mcmeta b/vanillinForge/src/main/resources/pack.mcmeta new file mode 100644 index 000000000..d9e46396e --- /dev/null +++ b/vanillinForge/src/main/resources/pack.mcmeta @@ -0,0 +1,6 @@ +{ + "pack": { + "description": "${mod_name} resources", + "pack_format": 15 + } +} From b541c19785051747313aad4ee5a80d231463cb78 Mon Sep 17 00:00:00 2001 From: Jozufozu Date: Sun, 12 Jan 2025 14:04:21 -0800 Subject: [PATCH 3/9] See yourself out - Replace outgoing jars by directly consuming classes/resources from common - Add vanillin logo - Move subproject plugin logic to an extension so it can be configured - Rename "mod_" properties to "flywheel_" --- .../gradle/jarset/JarSetExtension.kt | 4 - .../engine_room/gradle/jarset/JarTaskSet.kt | 12 -- .../gradle/subproject/SubprojectExtension.kt | 182 ++++++++++++++++++ .../gradle/subproject/SubprojectPlugin.kt | 177 +---------------- .../TransitiveSourceSetConfigurator.kt | 34 ++++ .../TransitiveSourceSetsExtension.kt | 2 +- common/build.gradle.kts | 16 +- common/src/vanillin/resources/logo.png | Bin 0 -> 14750 bytes fabric/build.gradle.kts | 16 +- fabric/src/main/resources/fabric.mod.json | 8 +- forge/build.gradle.kts | 16 +- forge/src/main/resources/META-INF/mods.toml | 16 +- forge/src/main/resources/pack.mcmeta | 2 +- gradle.properties | 17 +- vanillinFabric/build.gradle.kts | 7 +- .../src/main/resources/fabric.mod.json | 2 +- vanillinForge/build.gradle.kts | 7 +- .../src/main/resources/META-INF/mods.toml | 2 +- vanillinForge/src/main/resources/pack.mcmeta | 2 +- 19 files changed, 284 insertions(+), 238 deletions(-) create mode 100644 buildSrc/src/main/kotlin/dev/engine_room/gradle/subproject/SubprojectExtension.kt create mode 100644 common/src/vanillin/resources/logo.png diff --git a/buildSrc/src/main/kotlin/dev/engine_room/gradle/jarset/JarSetExtension.kt b/buildSrc/src/main/kotlin/dev/engine_room/gradle/jarset/JarSetExtension.kt index 7f7eb2f7f..218984e20 100644 --- a/buildSrc/src/main/kotlin/dev/engine_room/gradle/jarset/JarSetExtension.kt +++ b/buildSrc/src/main/kotlin/dev/engine_room/gradle/jarset/JarSetExtension.kt @@ -13,10 +13,6 @@ open class JarSetExtension(private val project: Project) { return JarTaskSet.create(project, name, *sourceSetSet) } - fun outgoing(name: String, vararg sourceSetSet: SourceSet): JarTaskSet { - return JarTaskSet.create(project, name, *sourceSetSet).also { it.createOutgoingConfiguration() } - } - val mainSet: JarTaskSet by lazy { val jarTask = project.tasks.named("jar") val remapJarTask = project.tasks.named("remapJar") diff --git a/buildSrc/src/main/kotlin/dev/engine_room/gradle/jarset/JarTaskSet.kt b/buildSrc/src/main/kotlin/dev/engine_room/gradle/jarset/JarTaskSet.kt index 0327683d5..03c30a11f 100644 --- a/buildSrc/src/main/kotlin/dev/engine_room/gradle/jarset/JarTaskSet.kt +++ b/buildSrc/src/main/kotlin/dev/engine_room/gradle/jarset/JarTaskSet.kt @@ -41,18 +41,6 @@ class JarTaskSet( } } - /** - * Create a new configuration that can be consumed by other projects, and export the base jar. - */ - fun createOutgoingConfiguration() { - val config = project.configurations.register(name) { - isCanBeConsumed = true - isCanBeResolved = false - } - - project.artifacts.add(config.name, jar) - } - /** * Configure the assemble task to depend on the remap tasks and javadoc jar. */ diff --git a/buildSrc/src/main/kotlin/dev/engine_room/gradle/subproject/SubprojectExtension.kt b/buildSrc/src/main/kotlin/dev/engine_room/gradle/subproject/SubprojectExtension.kt new file mode 100644 index 000000000..29e3f7690 --- /dev/null +++ b/buildSrc/src/main/kotlin/dev/engine_room/gradle/subproject/SubprojectExtension.kt @@ -0,0 +1,182 @@ +package dev.engine_room.gradle.subproject + +import net.fabricmc.loom.api.LoomGradleExtensionAPI +import org.gradle.api.JavaVersion +import org.gradle.api.Project +import org.gradle.api.plugins.BasePluginExtension +import org.gradle.api.plugins.JavaPluginExtension +import org.gradle.api.publish.PublishingExtension +import org.gradle.api.publish.tasks.GenerateModuleMetadata +import org.gradle.api.tasks.bundling.AbstractArchiveTask +import org.gradle.api.tasks.compile.JavaCompile +import org.gradle.api.tasks.javadoc.Javadoc +import org.gradle.jvm.tasks.Jar +import org.gradle.jvm.toolchain.JavaLanguageVersion +import org.gradle.kotlin.dsl.* +import org.gradle.language.jvm.tasks.ProcessResources + +open class SubprojectExtension(val project: Project) { + fun init(group: String, version: String) { + setBaseProperties(group, version) + setupJava() + addRepositories() + setupLoom() + setupDependencies() + configureTasks() + setupPublishing() + } + + private fun setBaseProperties(group: String, version: String) { + val dev = System.getenv("RELEASE")?.contentEquals("false", true) ?: true + val buildNumber = System.getenv("BUILD_NUMBER") + + val versionSuffix = if (dev && buildNumber != null) "-${buildNumber}" else "" + + project.group = group + project.version = "${version}${versionSuffix}" + + project.the().apply { + archivesName = "flywheel-${project.name}-${project.property("artifact_minecraft_version")}" + } + } + + private fun setupLoom() { + val loom = project.the() + loom.silentMojangMappingsLicense() + } + + private fun setupJava() { + val java_version: String by project + + project.the().apply { + val javaVersion = JavaVersion.toVersion(java_version) + sourceCompatibility = javaVersion + targetCompatibility = javaVersion + + toolchain.languageVersion = JavaLanguageVersion.of(java_version) + + withSourcesJar() + withJavadocJar() + } + } + + private fun addRepositories() { + project.repositories.apply { + mavenCentral() + maven("https://maven.parchmentmc.org") { + name = "ParchmentMC" + } + maven("https://maven.tterrag.com/") { + name = "tterrag maven" + } + maven("https://www.cursemaven.com") { + name = "CurseMaven" + content { + includeGroup("curse.maven") + } + } + maven("https://api.modrinth.com/maven") { + name = "Modrinth" + content { + includeGroup("maven.modrinth") + } + } + } + } + + @Suppress("UnstableApiUsage") + private fun setupDependencies() { + project.dependencies.apply { + val minecraft_version: String by project + val parchment_minecraft_version: String by project + val parchment_version: String by project + val loom = project.the() + + add("minecraft", "com.mojang:minecraft:${minecraft_version}") + + add("mappings", loom.layered { + officialMojangMappings() + parchment("org.parchmentmc.data:parchment-${parchment_minecraft_version}:${parchment_version}@zip") + }) + + add("api", "com.google.code.findbugs:jsr305:3.0.2") + } + } + + private fun configureTasks() { + val java_version: String by project + + project.tasks.apply { + // make builds reproducible + withType().configureEach { + isPreserveFileTimestamps = false + isReproducibleFileOrder = true + } + + // module metadata is often broken on multi-platform projects + withType().configureEach { + enabled = false + } + + withType().configureEach { + options.encoding = "UTF-8" + options.release = Integer.parseInt(java_version) + options.compilerArgs.add("-Xdiags:verbose") + } + + withType().configureEach { + from("${project.rootDir}/LICENSE.md") { + into("META-INF") + } + } + + withType().configureEach { + options.optionFiles(project.rootProject.file("javadoc-options.txt")) + options.encoding = "UTF-8" + } + + val replaceProperties = processResourcesExpandProperties.associateWith { project.property(it) as String } + + withType().configureEach { + inputs.properties(replaceProperties) + + filesMatching(processResourcesExpandFiles) { + expand(replaceProperties) + } + } + } + } + + private fun setupPublishing() { + project.the().repositories.apply { + maven("file://${project.rootProject.projectDir}/mcmodsrepo") + + if (project.hasProperty("mavendir")) { + maven(project.rootProject.file(project.property("mavendir") as String)) + } + } + } +} + +val processResourcesExpandFiles = listOf("pack.mcmeta", "fabric.mod.json", "META-INF/mods.toml") + +val processResourcesExpandProperties = listOf( + "mod_license", + "mod_sources", + "mod_issues", + "mod_homepage", + "flywheel_id", + "flywheel_name", + "flywheel_description", + "flywheel_version", + "vanillin_id", + "vanillin_name", + "vanillin_version", + "vanillin_description", + "flywheel_maven_version_range", + "flywheel_semver_version_range", + "minecraft_semver_version_range", + "minecraft_maven_version_range", + "fabric_api_version_range", + "forge_version_range", +) diff --git a/buildSrc/src/main/kotlin/dev/engine_room/gradle/subproject/SubprojectPlugin.kt b/buildSrc/src/main/kotlin/dev/engine_room/gradle/subproject/SubprojectPlugin.kt index 8fa4ff4d4..8a22ae7c1 100644 --- a/buildSrc/src/main/kotlin/dev/engine_room/gradle/subproject/SubprojectPlugin.kt +++ b/buildSrc/src/main/kotlin/dev/engine_room/gradle/subproject/SubprojectPlugin.kt @@ -3,189 +3,14 @@ package dev.engine_room.gradle.subproject import dev.engine_room.gradle.jarset.JarSetExtension import dev.engine_room.gradle.nullability.PackageInfosExtension import dev.engine_room.gradle.transitive.TransitiveSourceSetsExtension -import net.fabricmc.loom.api.LoomGradleExtensionAPI -import org.gradle.api.JavaVersion import org.gradle.api.Plugin import org.gradle.api.Project -import org.gradle.api.plugins.BasePluginExtension -import org.gradle.api.plugins.JavaPluginExtension -import org.gradle.api.publish.PublishingExtension -import org.gradle.api.publish.tasks.GenerateModuleMetadata -import org.gradle.api.tasks.bundling.AbstractArchiveTask -import org.gradle.api.tasks.compile.JavaCompile -import org.gradle.api.tasks.javadoc.Javadoc -import org.gradle.jvm.tasks.Jar -import org.gradle.jvm.toolchain.JavaLanguageVersion -import org.gradle.kotlin.dsl.* -import org.gradle.language.jvm.tasks.ProcessResources class SubprojectPlugin: Plugin { override fun apply(project: Project) { project.extensions.create("defaultPackageInfos", PackageInfosExtension::class.java, project) project.extensions.create("transitiveSourceSets", TransitiveSourceSetsExtension::class.java, project) project.extensions.create("jarSets", JarSetExtension::class.java, project) - - setBaseProperties(project) - setupJava(project) - addRepositories(project) - setupLoom(project) - setupDependencies(project) - configureTasks(project) - setupPublishing(project) - } - - private fun setBaseProperties(project: Project) { - val dev = System.getenv("RELEASE")?.contentEquals("false", true) ?: true - val buildNumber = System.getenv("BUILD_NUMBER") - - val versionSuffix = if (dev && buildNumber != null) "-${buildNumber}" else "" - - project.group = project.property("group") as String - project.version = "${project.property("mod_version")}${versionSuffix}" - - project.the().apply { - archivesName = "flywheel-${project.name}-${project.property("artifact_minecraft_version")}" - } - } - - private fun setupLoom(project: Project) { - val loom = project.the() - loom.silentMojangMappingsLicense() - } - - private fun setupJava(project: Project) { - val java_version: String by project - - project.the().apply { - val javaVersion = JavaVersion.toVersion(java_version) - sourceCompatibility = javaVersion - targetCompatibility = javaVersion - - toolchain.languageVersion = JavaLanguageVersion.of(java_version) - - withSourcesJar() - withJavadocJar() - } - } - - private fun addRepositories(project: Project) { - project.repositories.apply { - mavenCentral() - maven("https://maven.parchmentmc.org") { - name = "ParchmentMC" - } - maven("https://maven.tterrag.com/") { - name = "tterrag maven" - } - maven("https://www.cursemaven.com") { - name = "CurseMaven" - content { - includeGroup("curse.maven") - } - } - maven("https://api.modrinth.com/maven") { - name = "Modrinth" - content { - includeGroup("maven.modrinth") - } - } - } - } - - @Suppress("UnstableApiUsage") - private fun setupDependencies(project: Project) { - project.dependencies.apply { - val minecraft_version: String by project - val parchment_minecraft_version: String by project - val parchment_version: String by project - val loom = project.the() - - add("minecraft", "com.mojang:minecraft:${minecraft_version}") - - add("mappings", loom.layered { - officialMojangMappings() - parchment("org.parchmentmc.data:parchment-${parchment_minecraft_version}:${parchment_version}@zip") - }) - - add("api", "com.google.code.findbugs:jsr305:3.0.2") - } - } - - private fun configureTasks(project: Project) { - val java_version: String by project - - project.tasks.apply { - // make builds reproducible - withType().configureEach { - isPreserveFileTimestamps = false - isReproducibleFileOrder = true - } - - // module metadata is often broken on multi-platform projects - withType().configureEach { - enabled = false - } - - withType().configureEach { - options.encoding = "UTF-8" - options.release = Integer.parseInt(java_version) - options.compilerArgs.add("-Xdiags:verbose") - } - - withType().configureEach { - from("${project.rootDir}/LICENSE.md") { - into("META-INF") - } - } - - withType().configureEach { - options.optionFiles(project.rootProject.file("javadoc-options.txt")) - options.encoding = "UTF-8" - } - - val replaceProperties = processResourcesExpandProperties.associateWith { project.property(it) as String } - - withType().configureEach { - inputs.properties(replaceProperties) - - filesMatching(processResourcesExpandFiles) { - expand(replaceProperties) - } - } - } - } - - private fun setupPublishing(project: Project) { - project.the().repositories.apply { - maven("file://${project.rootProject.projectDir}/mcmodsrepo") - - if (project.hasProperty("mavendir")) { - maven(project.rootProject.file(project.property("mavendir") as String)) - } - } + project.extensions.create("subproject", SubprojectExtension::class.java, project) } } - -val processResourcesExpandFiles = listOf("pack.mcmeta", "fabric.mod.json", "META-INF/mods.toml") - -val processResourcesExpandProperties = listOf( - "mod_id", - "mod_name", - "mod_description", - "mod_license", - "mod_sources", - "mod_issues", - "mod_homepage", - "mod_version", - "minecraft_semver_version_range", - "minecraft_maven_version_range", - "fabric_api_version_range", - "forge_version_range", - "vanillin_id", - "vanillin_name", - "vanillin_version", - "vanillin_description", - "flywheel_maven_version_range", - "flywheel_semver_version_range", -) - diff --git a/buildSrc/src/main/kotlin/dev/engine_room/gradle/transitive/TransitiveSourceSetConfigurator.kt b/buildSrc/src/main/kotlin/dev/engine_room/gradle/transitive/TransitiveSourceSetConfigurator.kt index c2c69f2ce..7d043ebf1 100644 --- a/buildSrc/src/main/kotlin/dev/engine_room/gradle/transitive/TransitiveSourceSetConfigurator.kt +++ b/buildSrc/src/main/kotlin/dev/engine_room/gradle/transitive/TransitiveSourceSetConfigurator.kt @@ -1,6 +1,9 @@ package dev.engine_room.gradle.transitive import org.gradle.api.tasks.SourceSet +import org.gradle.api.tasks.compile.JavaCompile +import org.gradle.kotlin.dsl.named +import org.gradle.language.jvm.tasks.ProcessResources class TransitiveSourceSetConfigurator(private val parent: TransitiveSourceSetsExtension, private val sourceSet: SourceSet) { internal val compileSourceSets = mutableSetOf() @@ -37,4 +40,35 @@ class TransitiveSourceSetConfigurator(private val parent: TransitiveSourceSetsEx compile(*sourceSets) runtime(*sourceSets) } + + fun outgoing() { + outgoingClasses() + outgoingResources() + } + + fun outgoingResources() { + val project = parent.project + val exportResources = project.configurations.register("${sourceSet.name}Resources") { + isCanBeResolved = false + isCanBeConsumed = true + } + val processResources = project.tasks.named(sourceSet.processResourcesTaskName).get() + + project.artifacts.add(exportResources.name, processResources.destinationDir) { + builtBy(processResources) + } + } + + fun outgoingClasses() { + val project = parent.project + val exportClasses = project.configurations.register("${sourceSet.name}Classes") { + isCanBeResolved = false + isCanBeConsumed = true + } + + val compileTask = project.tasks.named(sourceSet.compileJavaTaskName).get() + project.artifacts.add(exportClasses.name, compileTask.destinationDirectory) { + builtBy(compileTask) + } + } } diff --git a/buildSrc/src/main/kotlin/dev/engine_room/gradle/transitive/TransitiveSourceSetsExtension.kt b/buildSrc/src/main/kotlin/dev/engine_room/gradle/transitive/TransitiveSourceSetsExtension.kt index 05fa4dc46..2fb1478e7 100644 --- a/buildSrc/src/main/kotlin/dev/engine_room/gradle/transitive/TransitiveSourceSetsExtension.kt +++ b/buildSrc/src/main/kotlin/dev/engine_room/gradle/transitive/TransitiveSourceSetsExtension.kt @@ -5,7 +5,7 @@ import org.gradle.api.Project import org.gradle.api.file.FileCollection import org.gradle.api.tasks.SourceSet -open class TransitiveSourceSetsExtension(private val project: Project) { +open class TransitiveSourceSetsExtension(val project: Project) { var compileClasspath: FileCollection? = null var runtimeClasspath: FileCollection? = null diff --git a/common/build.gradle.kts b/common/build.gradle.kts index 84d63c41c..af237a959 100644 --- a/common/build.gradle.kts +++ b/common/build.gradle.kts @@ -6,6 +6,8 @@ plugins { id("flywheel.subproject") } +subproject.init(property("flywheel_group") as String, property("flywheel_version") as String) + val api = sourceSets.create("api") val lib = sourceSets.create("lib") val backend = sourceSets.create("backend") @@ -18,20 +20,25 @@ transitiveSourceSets { sourceSet(api) { rootCompile() + outgoingClasses() } sourceSet(lib) { rootCompile() compile(api) + outgoing() } sourceSet(backend) { rootCompile() compile(api, lib) + outgoing() } sourceSet(stubs) { rootCompile() + outgoingClasses() } sourceSet(main) { compile(api, lib, backend, stubs) + outgoing() } sourceSet(sourceSets.getByName("test")) { implementation(api, lib, backend) @@ -39,6 +46,7 @@ transitiveSourceSets { sourceSet(vanillin) { rootCompile() compile(api, lib) + outgoing() } } @@ -47,14 +55,6 @@ defaultPackageInfos { } jarSets { - // For sharing with other subprojects. - outgoing("commonApiOnly", api) - outgoing("commonLib", lib) - outgoing("commonBackend", backend) - outgoing("commonStubs", stubs) - outgoing("commonImpl", main) - outgoing("commonVanillin", vanillin) - // For publishing. create("api", api, lib).apply { addToAssemble() diff --git a/common/src/vanillin/resources/logo.png b/common/src/vanillin/resources/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..f704c5629967195c52e04ccdf3c70963e3a82d46 GIT binary patch literal 14750 zcmaKT_cPqz`}S)KR`0#7UZMpN-Rgqq2|?6o(FM`1-V&WC!HQmj=-m<}MD*SzQ9`h~ zX#0JCo8KMEFc1I$K>S2Q#Q*?6{~bX94D#RRTy0_m z01!Y=+er04SBBx?V;Z6VzkPs9V6oW$?qL6&U~ew4ch}gfL#&Mr_F@lvwvDw;!e-TC ztuwLvn^?>$7yx6BH?Y=e*uy=nbv$-&4Qri)wf4ZC{=#Aov4@M;^`2b#W9;QU);bhx z9fi%S$L?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 -7,6 +7,8 @@ plugins { id("flywheel.platform") } +subproject.init(property("flywheel_group") as String, property("flywheel_version") as String) + val api = sourceSets.create("api") val lib = sourceSets.create("lib") val backend = sourceSets.create("backend") @@ -91,9 +93,13 @@ dependencies { modCompileOnly("maven.modrinth:sodium:${property("sodium_version")}") - "forApi"(project(path = ":common", configuration = "commonApiOnly")) - "forLib"(project(path = ":common", configuration = "commonLib")) - "forBackend"(project(path = ":common", configuration = "commonBackend")) - "forStubs"(project(path = ":common", configuration = "commonStubs")) - "forMain"(project(path = ":common", configuration = "commonImpl")) + "forApi"(project(path = ":common", configuration = "apiClasses")) + "forLib"(project(path = ":common", configuration = "libClasses")) + "forBackend"(project(path = ":common", configuration = "backendClasses")) + "forStubs"(project(path = ":common", configuration = "stubsClasses")) + "forMain"(project(path = ":common", configuration = "mainClasses")) + + "forLib"(project(path = ":common", configuration = "libResources")) + "forBackend"(project(path = ":common", configuration = "backendResources")) + "forMain"(project(path = ":common", configuration = "mainResources")) } diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json index d90f772c9..8e4687393 100644 --- a/fabric/src/main/resources/fabric.mod.json +++ b/fabric/src/main/resources/fabric.mod.json @@ -1,9 +1,9 @@ { "schemaVersion": 1, - "id": "${mod_id}", - "version": "${mod_version}", - "name": "${mod_name}", - "description": "${mod_description}", + "id" : "${flywheel_id}", + "version" : "${flywheel_version}", + "name" : "${flywheel_name}", + "description" : "${flywheel_description}", "authors": [ "Jozufozu", "PepperCode1" diff --git a/forge/build.gradle.kts b/forge/build.gradle.kts index 6b1959a84..f3de6800b 100644 --- a/forge/build.gradle.kts +++ b/forge/build.gradle.kts @@ -7,6 +7,8 @@ plugins { id("flywheel.platform") } +subproject.init(property("flywheel_group") as String, property("flywheel_version") as String) + val api = sourceSets.create("api") val lib = sourceSets.create("lib") val backend = sourceSets.create("backend") @@ -100,9 +102,13 @@ dependencies { modCompileOnly("maven.modrinth:embeddium:${property("embeddium_version")}") - "forApi"(project(path = ":common", configuration = "commonApiOnly")) - "forLib"(project(path = ":common", configuration = "commonLib")) - "forBackend"(project(path = ":common", configuration = "commonBackend")) - "forStubs"(project(path = ":common", configuration = "commonStubs")) - "forMain"(project(path = ":common", configuration = "commonImpl")) + "forApi"(project(path = ":common", configuration = "apiClasses")) + "forLib"(project(path = ":common", configuration = "libClasses")) + "forBackend"(project(path = ":common", configuration = "backendClasses")) + "forStubs"(project(path = ":common", configuration = "stubsClasses")) + "forMain"(project(path = ":common", configuration = "mainClasses")) + + "forLib"(project(path = ":common", configuration = "libResources")) + "forBackend"(project(path = ":common", configuration = "backendResources")) + "forMain"(project(path = ":common", configuration = "mainResources")) } diff --git a/forge/src/main/resources/META-INF/mods.toml b/forge/src/main/resources/META-INF/mods.toml index 766bbfe9f..b41d47516 100644 --- a/forge/src/main/resources/META-INF/mods.toml +++ b/forge/src/main/resources/META-INF/mods.toml @@ -5,34 +5,34 @@ license = "${mod_license}" issueTrackerURL = "${mod_issues}" [[mods]] -modId = "${mod_id}" -version = "${mod_version}" -displayName = "${mod_name}" -description = "${mod_description}" +modId = "${flywheel_id}" +version = "${flywheel_version}" +displayName = "${flywheel_name}" +description = "${flywheel_description}" logoFile = "logo.png" authors = "Jozufozu, PepperCode1" displayURL = "${mod_homepage}" displayTest = "IGNORE_ALL_VERSION" -[[dependencies.${mod_id}]] +[[dependencies.${ flywheel_id }]] modId = "minecraft" mandatory = true versionRange = "${minecraft_maven_version_range}" side = "CLIENT" -[[dependencies.${mod_id}]] +[[dependencies.${ flywheel_id }]] modId = "forge" mandatory = true versionRange = "${forge_version_range}" side = "CLIENT" -[[dependencies.${mod_id}]] +[[dependencies.${ flywheel_id }]] modId = "embeddium" mandatory = false versionRange = "[0.3.25,)" side = "CLIENT" -[[dependencies.${mod_id}]] +[[dependencies.${ flywheel_id }]] modId = "sodium" mandatory = false versionRange = "[0.6.0-beta.2,)" diff --git a/forge/src/main/resources/pack.mcmeta b/forge/src/main/resources/pack.mcmeta index ae03c9b7f..9db28873e 100644 --- a/forge/src/main/resources/pack.mcmeta +++ b/forge/src/main/resources/pack.mcmeta @@ -1,6 +1,6 @@ { "pack": { - "description": "${mod_name} resources", + "description": "${flywheel_name} resources", "pack_format": 15 } } diff --git a/gradle.properties b/gradle.properties index 1741bed76..0bc337a5d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,19 +1,21 @@ org.gradle.jvmargs = -Xmx3G org.gradle.daemon = false - -# Mod metadata -mod_id = flywheel -mod_name = Flywheel -mod_version = 1.0.0-beta -mod_description = An overhauled entity and block entity rendering API. +# Common metadata mod_license = MIT mod_sources = https://github.com/Engine-Room/Flywheel mod_issues = https://github.com/Engine-Room/Flywheel/issues mod_homepage = https://github.com/Engine-Room/Flywheel +# Flywheel metadata +flywheel_id=flywheel +flywheel_name=Flywheel +flywheel_version=1.0.0-beta +flywheel_description=An overhauled entity and block entity rendering API. +# Vanillin metadata vanillin_id=vanillin vanillin_name=Vanillin vanillin_version=1.0.0-beta vanillin_description=Instanced rendering for entities and block entities via Flywheel. +# Vanillin dependencies flywheel_maven_version_range=[1.0.0-beta,2.0) flywheel_semver_version_range=>=1.0.0-beta <2.0.0 @@ -41,5 +43,6 @@ sodium_version = mc1.20.1-0.5.11 embeddium_version = 0.3.25+mc1.20.1 # Publication info -group = dev.engine_room.flywheel +flywheel_group=dev.engine_room.flywheel +vanillin_group=dev.engine_room.vanillin artifact_minecraft_version = 1.20.1 diff --git a/vanillinFabric/build.gradle.kts b/vanillinFabric/build.gradle.kts index 84adeef1e..fa9184276 100644 --- a/vanillinFabric/build.gradle.kts +++ b/vanillinFabric/build.gradle.kts @@ -10,7 +10,7 @@ plugins { id("flywheel.platform") } -group = "dev.engine_room.vanillin" +subproject.init(property("vanillin_group") as String, property("vanillin_version") as String) val main = sourceSets.getByName("main") @@ -69,7 +69,10 @@ dependencies { modCompileOnly("maven.modrinth:sodium:${property("sodium_version")}") - compileOnly(project(path = ":common", configuration = "commonVanillin")) + compileOnly(project(path = ":common", configuration = "vanillinClasses")) + compileOnly(project(path = ":common", configuration = "vanillinResources")) + + // JiJ flywheel proper include(project(path = ":fabric", configuration = "flywheelFabric")) modRuntimeOnly(project(path = ":fabric", configuration = "flywheelFabric")) } diff --git a/vanillinFabric/src/main/resources/fabric.mod.json b/vanillinFabric/src/main/resources/fabric.mod.json index fd50a6f89..3dd5c0342 100644 --- a/vanillinFabric/src/main/resources/fabric.mod.json +++ b/vanillinFabric/src/main/resources/fabric.mod.json @@ -27,7 +27,7 @@ "minecraft" : "${minecraft_semver_version_range}", "fabricloader" : ">=0.15.0", "fabric-api" : "${fabric_api_version_range}", - "${mod_id}" : "${flywheel_semver_version_range}" + "${flywheel_id}" : "${flywheel_semver_version_range}" }, "breaks" : { } diff --git a/vanillinForge/build.gradle.kts b/vanillinForge/build.gradle.kts index 0c72d0ef9..270b68aee 100644 --- a/vanillinForge/build.gradle.kts +++ b/vanillinForge/build.gradle.kts @@ -10,7 +10,7 @@ plugins { id("flywheel.platform") } -group = "dev.engine_room.vanillin" +subproject.init(property("vanillin_group") as String, property("vanillin_version") as String) val main = sourceSets.getByName("main") @@ -80,7 +80,10 @@ dependencies { modCompileOnly("maven.modrinth:embeddium:${property("embeddium_version")}") - compileOnly(project(path = ":common", configuration = "commonVanillin")) + compileOnly(project(path = ":common", configuration = "vanillinClasses")) + compileOnly(project(path = ":common", configuration = "vanillinResources")) + + // JiJ flywheel proper include(project(path = ":forge", configuration = "flywheelForge")) modRuntimeOnly(project(path = ":forge", configuration = "flywheelForge")) } diff --git a/vanillinForge/src/main/resources/META-INF/mods.toml b/vanillinForge/src/main/resources/META-INF/mods.toml index b550c343b..dd213eb6b 100644 --- a/vanillinForge/src/main/resources/META-INF/mods.toml +++ b/vanillinForge/src/main/resources/META-INF/mods.toml @@ -27,7 +27,7 @@ versionRange = "${forge_version_range}" side = "CLIENT" [[dependencies.${ vanillin_id }]] -modId = "${mod_id}" +modId = "${flywheel_id}" mandatory = true versionRange = "${flywheel_maven_version_range}" side = "CLIENT" diff --git a/vanillinForge/src/main/resources/pack.mcmeta b/vanillinForge/src/main/resources/pack.mcmeta index d9e46396e..0d29ea3f1 100644 --- a/vanillinForge/src/main/resources/pack.mcmeta +++ b/vanillinForge/src/main/resources/pack.mcmeta @@ -1,6 +1,6 @@ { "pack": { - "description": "${mod_name} resources", + "description": "${vanillin_name} resources", "pack_format": 15 } } From b6124be28a91f969752ebe6879b67d26ddcc8f45 Mon Sep 17 00:00:00 2001 From: Jozufozu Date: Sun, 12 Jan 2025 15:34:33 -0800 Subject: [PATCH 4/9] Scratch that - Loom gets angry when a mod* dependency doesn't immediately exist so use a regular runtime dependency with the devlibs jar - Strangely, the include dependency is just fine with the remap jar - Move outgoing remapJar/jar configuration generation to JarTaskSet - Don't actually need evaluationDependsOn - Fix test mod id --- .../engine_room/gradle/jarset/JarTaskSet.kt | 23 +++++++++++++++++++ .../gradle/platform/PlatformExtension.kt | 1 - fabric/build.gradle.kts | 9 ++------ fabric/src/testMod/resources/fabric.mod.json | 4 ++-- forge/build.gradle.kts | 9 ++------ .../src/testMod/resources/META-INF/mods.toml | 4 ++-- vanillinFabric/build.gradle.kts | 4 ++-- vanillinForge/build.gradle.kts | 4 ++-- 8 files changed, 35 insertions(+), 23 deletions(-) diff --git a/buildSrc/src/main/kotlin/dev/engine_room/gradle/jarset/JarTaskSet.kt b/buildSrc/src/main/kotlin/dev/engine_room/gradle/jarset/JarTaskSet.kt index 03c30a11f..da7fa4e1b 100644 --- a/buildSrc/src/main/kotlin/dev/engine_room/gradle/jarset/JarTaskSet.kt +++ b/buildSrc/src/main/kotlin/dev/engine_room/gradle/jarset/JarTaskSet.kt @@ -41,6 +41,29 @@ class JarTaskSet( } } + fun outgoing(name: String) { + outgoingRemapJar("${name}Remap") + outgoingJar("${name}Dev") + } + + fun outgoingRemapJar(name: String) { + val config = project.configurations.register(name) { + isCanBeConsumed = true + isCanBeResolved = false + } + + project.artifacts.add(config.name, remapJar) + } + + fun outgoingJar(name: String) { + val config = project.configurations.register(name) { + isCanBeConsumed = true + isCanBeResolved = false + } + + project.artifacts.add(config.name, jar) + } + /** * Configure the assemble task to depend on the remap tasks and javadoc jar. */ diff --git a/buildSrc/src/main/kotlin/dev/engine_room/gradle/platform/PlatformExtension.kt b/buildSrc/src/main/kotlin/dev/engine_room/gradle/platform/PlatformExtension.kt index 55b0d12ac..76f1b175e 100644 --- a/buildSrc/src/main/kotlin/dev/engine_room/gradle/platform/PlatformExtension.kt +++ b/buildSrc/src/main/kotlin/dev/engine_room/gradle/platform/PlatformExtension.kt @@ -134,7 +134,6 @@ open class PlatformExtension(val project: Project) { override fun setValue(thisRef: Any?, property: KProperty<*>, value: Project) { this.value = value - thisProject.evaluationDependsOn(value.path) } override fun toString(): String = diff --git a/fabric/build.gradle.kts b/fabric/build.gradle.kts index 1dee675de..8392678c3 100644 --- a/fabric/build.gradle.kts +++ b/fabric/build.gradle.kts @@ -56,6 +56,8 @@ platform { jarSets { mainSet.publish(platform.modArtifactId) + mainSet.outgoing("flywheel") + create("api", api, lib).apply { addToAssemble() publish(platform.apiArtifactId) @@ -68,13 +70,6 @@ jarSets { } } -val config = project.configurations.register("flywheelFabric") { - isCanBeConsumed = true - isCanBeResolved = false -} - -project.artifacts.add(config.name, jarSets.mainSet.remapJar) - defaultPackageInfos { sources(api, lib, backend, main) } diff --git a/fabric/src/testMod/resources/fabric.mod.json b/fabric/src/testMod/resources/fabric.mod.json index 11bd545a1..f8c0b82c3 100644 --- a/fabric/src/testMod/resources/fabric.mod.json +++ b/fabric/src/testMod/resources/fabric.mod.json @@ -1,7 +1,7 @@ { "schemaVersion": 1, - "id" : "${mod_id}_testmod", - "name": "${mod_name} Test Mod", + "id" : "${flywheel_id}_testmod", + "name" : "${flywheel_name} Test Mod", "version": "1.0.0", "environment": "*", "license": "${mod_license}", diff --git a/forge/build.gradle.kts b/forge/build.gradle.kts index f3de6800b..fb03838f2 100644 --- a/forge/build.gradle.kts +++ b/forge/build.gradle.kts @@ -54,6 +54,8 @@ platform { jarSets { mainSet.publish(platform.modArtifactId) + mainSet.outgoing("flywheel") + create("api", api, lib).apply { addToAssemble() publish(platform.apiArtifactId) @@ -66,13 +68,6 @@ jarSets { } } -val config = project.configurations.register("flywheelForge") { - isCanBeConsumed = true - isCanBeResolved = false -} - -project.artifacts.add(config.name, jarSets.mainSet.remapJar) - defaultPackageInfos { sources(api, lib, backend, main) } diff --git a/forge/src/testMod/resources/META-INF/mods.toml b/forge/src/testMod/resources/META-INF/mods.toml index 4d76a503e..20235395d 100644 --- a/forge/src/testMod/resources/META-INF/mods.toml +++ b/forge/src/testMod/resources/META-INF/mods.toml @@ -3,6 +3,6 @@ loaderVersion = "[0,)" license = "${mod_license}" [[mods]] -modId = "${mod_id}_testmod" +modId = "${flywheel_id}_testmod" version = "1.0.0" -displayName = "${mod_name} Test Mod" +displayName = "${flywheel_name} Test Mod" diff --git a/vanillinFabric/build.gradle.kts b/vanillinFabric/build.gradle.kts index fa9184276..3b59ceb16 100644 --- a/vanillinFabric/build.gradle.kts +++ b/vanillinFabric/build.gradle.kts @@ -73,6 +73,6 @@ dependencies { compileOnly(project(path = ":common", configuration = "vanillinResources")) // JiJ flywheel proper - include(project(path = ":fabric", configuration = "flywheelFabric")) - modRuntimeOnly(project(path = ":fabric", configuration = "flywheelFabric")) + include(project(path = ":fabric", configuration = "flywheelRemap")) + runtimeOnly(project(path = ":fabric", configuration = "flywheelDev")) } diff --git a/vanillinForge/build.gradle.kts b/vanillinForge/build.gradle.kts index 270b68aee..26a7b2e30 100644 --- a/vanillinForge/build.gradle.kts +++ b/vanillinForge/build.gradle.kts @@ -84,6 +84,6 @@ dependencies { compileOnly(project(path = ":common", configuration = "vanillinResources")) // JiJ flywheel proper - include(project(path = ":forge", configuration = "flywheelForge")) - modRuntimeOnly(project(path = ":forge", configuration = "flywheelForge")) + include(project(path = ":forge", configuration = "flywheelRemap")) + runtimeOnly(project(path = ":forge", configuration = "flywheelDev")) } From 02ea671d31712fcff799ae673e58441a2e56b1c2 Mon Sep 17 00:00:00 2001 From: Jozufozu Date: Sun, 12 Jan 2025 15:48:10 -0800 Subject: [PATCH 5/9] Oh my glob - Glob over all jars from libs when running the test mod - Add vanillin jars to artifacts --- .github/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4b270af22..b949f1132 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -44,6 +44,8 @@ jobs: common/build/libs/ fabric/build/libs/ forge/build/libs/ + vanillinFabric/build/libs/ + vanillinForge/build/libs/ test: strategy: @@ -63,15 +65,13 @@ jobs: - name: Setup Environment Variables run: | - echo "MOD_VERSION=$(grep '^mod_version =' gradle.properties | cut -d'=' -f2 | tr -d ' ')" >> "$GITHUB_ENV" echo "MINECRAFT_VERSION=$(grep '^minecraft_version =' gradle.properties | cut -d'=' -f2 | tr -d ' ')" >> "$GITHUB_ENV" echo "FABRIC_API_VERSION=$(grep '^fabric_api_version =' gradle.properties | cut -d'=' -f2 | tr -d ' ' | sed 's/+.*//')" >> "$GITHUB_ENV" - name: Move Test Mod and Flywheel into run/mods run: | mkdir -p run/mods - cp ${{ matrix.loader }}/build/libs/flywheel-${{ matrix.loader }}-${{ env.MINECRAFT_VERSION }}-${{ env.MOD_VERSION }}.jar run/mods - cp ${{ matrix.loader }}/build/libs/flywheel-${{ matrix.loader }}-${{ env.MINECRAFT_VERSION }}-${{ env.MOD_VERSION }}-testmod.jar run/mods + cp ${{ matrix.loader }}/build/libs/*.jar run/mods # Lock to a specific commit, it would be bad if the tag is re-pushed with unwanted changes - name: Run the MC client From 0dc8f97b73277cae8fe8d3a396fbe376fddb26f0 Mon Sep 17 00:00:00 2001 From: Jozufozu Date: Sun, 12 Jan 2025 16:08:38 -0800 Subject: [PATCH 6/9] String theory - Assume group/version are behind properties in subproject.init - Force each subproject to manually specify their base archive name - Don't generate mod/api artifact ids, just write them out by hand - Remove DependentProject --- .../gradle/platform/PlatformExtension.kt | 24 ++----------------- .../gradle/subproject/SubprojectExtension.kt | 12 +++++----- common/build.gradle.kts | 2 +- fabric/build.gradle.kts | 6 ++--- forge/build.gradle.kts | 6 ++--- vanillinFabric/build.gradle.kts | 5 ++-- vanillinForge/build.gradle.kts | 5 ++-- 7 files changed, 19 insertions(+), 41 deletions(-) diff --git a/buildSrc/src/main/kotlin/dev/engine_room/gradle/platform/PlatformExtension.kt b/buildSrc/src/main/kotlin/dev/engine_room/gradle/platform/PlatformExtension.kt index 76f1b175e..1c03dad14 100644 --- a/buildSrc/src/main/kotlin/dev/engine_room/gradle/platform/PlatformExtension.kt +++ b/buildSrc/src/main/kotlin/dev/engine_room/gradle/platform/PlatformExtension.kt @@ -13,15 +13,10 @@ import org.gradle.jvm.tasks.Jar import org.gradle.kotlin.dsl.* import org.gradle.language.jvm.tasks.ProcessResources import java.io.File -import kotlin.properties.ReadWriteProperty -import kotlin.reflect.KProperty +import kotlin.properties.Delegates open class PlatformExtension(val project: Project) { - var commonProject: Project by DependentProject(this.project) - - var modArtifactId: String = "flywheel-${project.name}-${project.property("artifact_minecraft_version")}" - - var apiArtifactId: String = "flywheel-${project.name}-api-${project.property("artifact_minecraft_version")}" + var commonProject: Project by Delegates.notNull() val commonSourceSets: SourceSetContainer by lazy { commonProject.the() } @@ -124,19 +119,4 @@ open class PlatformExtension(val project: Project) { } } } - - private class DependentProject(private val thisProject: Project) : ReadWriteProperty { - private var value: Project? = null - - override fun getValue(thisRef: Any?, property: KProperty<*>): Project { - return value ?: throw IllegalStateException("Property ${property.name} should be initialized before get.") - } - - override fun setValue(thisRef: Any?, property: KProperty<*>, value: Project) { - this.value = value - } - - override fun toString(): String = - "NotNullProperty(${if (value != null) "value=$value" else "value not initialized yet"})" - } } diff --git a/buildSrc/src/main/kotlin/dev/engine_room/gradle/subproject/SubprojectExtension.kt b/buildSrc/src/main/kotlin/dev/engine_room/gradle/subproject/SubprojectExtension.kt index 29e3f7690..223538724 100644 --- a/buildSrc/src/main/kotlin/dev/engine_room/gradle/subproject/SubprojectExtension.kt +++ b/buildSrc/src/main/kotlin/dev/engine_room/gradle/subproject/SubprojectExtension.kt @@ -16,8 +16,8 @@ import org.gradle.kotlin.dsl.* import org.gradle.language.jvm.tasks.ProcessResources open class SubprojectExtension(val project: Project) { - fun init(group: String, version: String) { - setBaseProperties(group, version) + fun init(archiveBase: String, group: String, version: String) { + setBaseProperties(archiveBase, group, version) setupJava() addRepositories() setupLoom() @@ -26,17 +26,17 @@ open class SubprojectExtension(val project: Project) { setupPublishing() } - private fun setBaseProperties(group: String, version: String) { + private fun setBaseProperties(archiveBase: String, group: String, version: String) { val dev = System.getenv("RELEASE")?.contentEquals("false", true) ?: true val buildNumber = System.getenv("BUILD_NUMBER") val versionSuffix = if (dev && buildNumber != null) "-${buildNumber}" else "" - project.group = group - project.version = "${version}${versionSuffix}" + project.group = project.property(group) as String + project.version = "${project.property(version)}${versionSuffix}" project.the().apply { - archivesName = "flywheel-${project.name}-${project.property("artifact_minecraft_version")}" + archivesName = "${archiveBase}-${project.property("artifact_minecraft_version")}" } } diff --git a/common/build.gradle.kts b/common/build.gradle.kts index af237a959..a2877f83b 100644 --- a/common/build.gradle.kts +++ b/common/build.gradle.kts @@ -6,7 +6,7 @@ plugins { id("flywheel.subproject") } -subproject.init(property("flywheel_group") as String, property("flywheel_version") as String) +subproject.init("flywheel-common", "flywheel_group", "flywheel_version") val api = sourceSets.create("api") val lib = sourceSets.create("lib") diff --git a/fabric/build.gradle.kts b/fabric/build.gradle.kts index 8392678c3..67b44b5a0 100644 --- a/fabric/build.gradle.kts +++ b/fabric/build.gradle.kts @@ -7,7 +7,7 @@ plugins { id("flywheel.platform") } -subproject.init(property("flywheel_group") as String, property("flywheel_version") as String) +subproject.init("flywheel-fabric", "flywheel_group", "flywheel_version") val api = sourceSets.create("api") val lib = sourceSets.create("lib") @@ -55,12 +55,12 @@ platform { } jarSets { - mainSet.publish(platform.modArtifactId) + mainSet.publish("flywheel-fabric-${project.property("artifact_minecraft_version")}") mainSet.outgoing("flywheel") create("api", api, lib).apply { addToAssemble() - publish(platform.apiArtifactId) + publish("flywheel-fabric-api-${project.property("artifact_minecraft_version")}") configureJar { manifest { diff --git a/forge/build.gradle.kts b/forge/build.gradle.kts index fb03838f2..a12ea2c76 100644 --- a/forge/build.gradle.kts +++ b/forge/build.gradle.kts @@ -7,7 +7,7 @@ plugins { id("flywheel.platform") } -subproject.init(property("flywheel_group") as String, property("flywheel_version") as String) +subproject.init("flywheel-forge", "flywheel_group", "flywheel_version") val api = sourceSets.create("api") val lib = sourceSets.create("lib") @@ -53,12 +53,12 @@ platform { } jarSets { - mainSet.publish(platform.modArtifactId) + mainSet.publish("flywheel-forge-${project.property("artifact_minecraft_version")}") mainSet.outgoing("flywheel") create("api", api, lib).apply { addToAssemble() - publish(platform.apiArtifactId) + publish("flywheel-forge-api-${project.property("artifact_minecraft_version")}") configureJar { manifest { diff --git a/vanillinFabric/build.gradle.kts b/vanillinFabric/build.gradle.kts index 3b59ceb16..96883fd3c 100644 --- a/vanillinFabric/build.gradle.kts +++ b/vanillinFabric/build.gradle.kts @@ -10,12 +10,11 @@ plugins { id("flywheel.platform") } -subproject.init(property("vanillin_group") as String, property("vanillin_version") as String) +subproject.init("vanillin-fabric", "vanillin_group", "vanillin_version") val main = sourceSets.getByName("main") platform { - modArtifactId = "vanillin-fabric-${project.property("artifact_minecraft_version")}" commonProject = project(":common") setupLoomRuns() } @@ -49,7 +48,7 @@ tasks.named(main.processResourcesTaskName).configure { } jarSets { - mainSet.publish(platform.modArtifactId) + mainSet.publish("vanillin-fabric-${project.property("artifact_minecraft_version")}") } defaultPackageInfos { diff --git a/vanillinForge/build.gradle.kts b/vanillinForge/build.gradle.kts index 26a7b2e30..e16475411 100644 --- a/vanillinForge/build.gradle.kts +++ b/vanillinForge/build.gradle.kts @@ -10,12 +10,11 @@ plugins { id("flywheel.platform") } -subproject.init(property("vanillin_group") as String, property("vanillin_version") as String) +subproject.init("vanillin-forge", "vanillin_group", "vanillin_version") val main = sourceSets.getByName("main") platform { - modArtifactId = "vanillin-forge-${project.property("artifact_minecraft_version")}" commonProject = project(":common") setupLoomRuns() } @@ -49,7 +48,7 @@ tasks.named(main.processResourcesTaskName).configure { } jarSets { - mainSet.publish(platform.modArtifactId) + mainSet.publish("vanillin-forge-${project.property("artifact_minecraft_version")}") } defaultPackageInfos { From 811b0f25324680eddfe5462ce384f906778829e8 Mon Sep 17 00:00:00 2001 From: Jozufozu Date: Sun, 12 Jan 2025 16:23:34 -0800 Subject: [PATCH 7/9] Hrm - Remove sources and javadoc after glob copying them --- .github/workflows/build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b949f1132..de171b355 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -69,9 +69,11 @@ jobs: echo "FABRIC_API_VERSION=$(grep '^fabric_api_version =' gradle.properties | cut -d'=' -f2 | tr -d ' ' | sed 's/+.*//')" >> "$GITHUB_ENV" - name: Move Test Mod and Flywheel into run/mods + # We don't want to recreate the jar name formatting so glob everything over then remove the sources and javadoc jars run: | mkdir -p run/mods cp ${{ matrix.loader }}/build/libs/*.jar run/mods + rm -f run/mods/*-sources.jar run/mods/*-javadoc.jar # Lock to a specific commit, it would be bad if the tag is re-pushed with unwanted changes - name: Run the MC client From 045b065166805baaf1c5e8a5b733ffd3513fc526 Mon Sep 17 00:00:00 2001 From: Jozufozu Date: Sun, 12 Jan 2025 19:03:32 -0800 Subject: [PATCH 8/9] I do declare - Move source set bundling/common source set sharing logic into transitiveSourceSets and make it more flexible - Remove commonProject field from platform extension --- .../gradle/platform/PlatformExtension.kt | 61 +------------ .../TransitiveSourceSetConfigurator.kt | 90 ++++++++++++++++++- common/build.gradle.kts | 8 +- fabric/build.gradle.kts | 40 ++++++--- forge/build.gradle.kts | 40 ++++++--- vanillinFabric/build.gradle.kts | 45 +++------- vanillinForge/build.gradle.kts | 45 +++------- 7 files changed, 170 insertions(+), 159 deletions(-) diff --git a/buildSrc/src/main/kotlin/dev/engine_room/gradle/platform/PlatformExtension.kt b/buildSrc/src/main/kotlin/dev/engine_room/gradle/platform/PlatformExtension.kt index 1c03dad14..95ed30384 100644 --- a/buildSrc/src/main/kotlin/dev/engine_room/gradle/platform/PlatformExtension.kt +++ b/buildSrc/src/main/kotlin/dev/engine_room/gradle/platform/PlatformExtension.kt @@ -1,25 +1,18 @@ package dev.engine_room.gradle.platform -import dev.engine_room.gradle.jarset.JarTaskSet import net.fabricmc.loom.api.LoomGradleExtensionAPI import net.fabricmc.loom.task.RemapJarTask import org.gradle.api.Project import org.gradle.api.Task import org.gradle.api.tasks.SourceSet -import org.gradle.api.tasks.SourceSetContainer -import org.gradle.api.tasks.compile.JavaCompile -import org.gradle.api.tasks.javadoc.Javadoc import org.gradle.jvm.tasks.Jar -import org.gradle.kotlin.dsl.* -import org.gradle.language.jvm.tasks.ProcessResources +import org.gradle.kotlin.dsl.assign +import org.gradle.kotlin.dsl.named +import org.gradle.kotlin.dsl.register +import org.gradle.kotlin.dsl.the import java.io.File -import kotlin.properties.Delegates open class PlatformExtension(val project: Project) { - var commonProject: Project by Delegates.notNull() - - val commonSourceSets: SourceSetContainer by lazy { commonProject.the() } - fun setupLoomMod(vararg sourceSets: SourceSet) { project.the().mods.maybeCreate("main").apply { sourceSets.forEach(::sourceSet) @@ -51,52 +44,6 @@ open class PlatformExtension(val project: Project) { } } - fun compileWithCommonSourceSets(vararg sourceSets: SourceSet) { - project.tasks.apply { - withType().configureEach { - JarTaskSet.excludeDuplicatePackageInfos(this) - } - - sourceSets.forEach { - val commonSourceSet = commonSourceSets.named(it.name).get() - - named(it.compileJavaTaskName).configure { - source(commonSourceSet.allJava) - } - named(it.processResourcesTaskName).configure { - from(commonSourceSet.resources) - } - } - } - } - - fun setupFatJar(vararg sourceSets: SourceSet) { - project.tasks.apply { - val extraSourceSets = sourceSets.filter { it.name != "main" }.toList() - val commonSources = sourceSets.map { commonSourceSets.named(it.name).get() } - - named("jar").configure { - extraSourceSets.forEach { from(it.output) } - - JarTaskSet.excludeDuplicatePackageInfos(this) - } - - named("javadoc").configure { - commonSources.forEach { source(it.allJava) } - extraSourceSets.forEach { source(it.allJava) } - - JarTaskSet.excludeDuplicatePackageInfos(this) - } - - named("sourcesJar").configure { - commonSources.forEach { from(it.allJava) } - extraSourceSets.forEach { from(it.allJava) } - - JarTaskSet.excludeDuplicatePackageInfos(this) - } - } - } - fun setupTestMod(sourceSet: SourceSet) { project.tasks.apply { val testModJar = register("testModJar") { diff --git a/buildSrc/src/main/kotlin/dev/engine_room/gradle/transitive/TransitiveSourceSetConfigurator.kt b/buildSrc/src/main/kotlin/dev/engine_room/gradle/transitive/TransitiveSourceSetConfigurator.kt index 7d043ebf1..d197bfccc 100644 --- a/buildSrc/src/main/kotlin/dev/engine_room/gradle/transitive/TransitiveSourceSetConfigurator.kt +++ b/buildSrc/src/main/kotlin/dev/engine_room/gradle/transitive/TransitiveSourceSetConfigurator.kt @@ -1,8 +1,14 @@ package dev.engine_room.gradle.transitive +import dev.engine_room.gradle.jarset.JarTaskSet +import org.gradle.api.Project import org.gradle.api.tasks.SourceSet +import org.gradle.api.tasks.SourceSetContainer import org.gradle.api.tasks.compile.JavaCompile +import org.gradle.api.tasks.javadoc.Javadoc +import org.gradle.jvm.tasks.Jar import org.gradle.kotlin.dsl.named +import org.gradle.kotlin.dsl.the import org.gradle.language.jvm.tasks.ProcessResources class TransitiveSourceSetConfigurator(private val parent: TransitiveSourceSetsExtension, private val sourceSet: SourceSet) { @@ -22,14 +28,21 @@ class TransitiveSourceSetConfigurator(private val parent: TransitiveSourceSetsEx rootRuntime() } - fun compile(vararg sourceSets: SourceSet) { + fun compileClasspath(vararg sourceSets: SourceSet) { compileSourceSets += sourceSets for (sourceSet in sourceSets) { this.sourceSet.compileClasspath += sourceSet.output } } - fun runtime(vararg sourceSets: SourceSet) { + fun compileClasspath(project: Project, vararg sourceSets: String) { + val externalSourceSets = project.the() + for (name in sourceSets) { + this.sourceSet.compileClasspath += externalSourceSets.getByName(name).output + } + } + + fun runtimeClasspath(vararg sourceSets: SourceSet) { runtimeSourceSets += sourceSets for (sourceSet in sourceSets) { this.sourceSet.runtimeClasspath += sourceSet.output @@ -37,8 +50,77 @@ class TransitiveSourceSetConfigurator(private val parent: TransitiveSourceSetsEx } fun implementation(vararg sourceSets: SourceSet) { - compile(*sourceSets) - runtime(*sourceSets) + compileClasspath(*sourceSets) + runtimeClasspath(*sourceSets) + } + + fun from(otherProject: Project) { + from(otherProject, sourceSet.name) + } + + fun from(otherProject: Project, vararg names: String) { + + val otherSourceSets = otherProject.the() + + from(*names.map { otherSourceSets.getByName(it) }.toTypedArray()) + } + + fun from(vararg sourceSets: SourceSet) { + parent.project.tasks.apply { + named(sourceSet.compileJavaTaskName).configure { + sourceSets.forEach { source(it.allJava) } + + JarTaskSet.excludeDuplicatePackageInfos(this) + } + named(sourceSet.processResourcesTaskName).configure { + sourceSets.forEach { from(it.resources) } + } + } + } + + fun bundleFrom(otherProject: Project) { + bundleFrom(otherProject, sourceSet.name) + } + + fun bundleFrom(otherProject: Project, vararg names: String) { + val otherSourceSets = otherProject.the() + + bundleFrom(*names.map { otherSourceSets.getByName(it) }.toTypedArray()) + } + + fun bundleFrom(vararg sourceSets: SourceSet) { + from(*sourceSets) + // The external sourceSets will be included in the jar by default since we bring it into the java compile task, + // however we need to make sure that the javadoc and sources jars also include the external sourceSets + bundleJavadocAndSources(*sourceSets) + } + + fun bundleOutput(vararg sourceSets: SourceSet) { + bundleJavadocAndSources(*sourceSets) + + parent.project.tasks.apply { + named(sourceSet.jarTaskName).configure { + sourceSets.forEach { from(it.output) } + + JarTaskSet.excludeDuplicatePackageInfos(this) + } + } + } + + private fun bundleJavadocAndSources(vararg sourceSets: SourceSet) { + parent.project.tasks.apply { + named(sourceSet.javadocTaskName).configure { + sourceSets.forEach { source(it.allJava) } + + JarTaskSet.excludeDuplicatePackageInfos(this) + } + + named(sourceSet.sourcesJarTaskName).configure { + sourceSets.forEach { from(it.allJava) } + + JarTaskSet.excludeDuplicatePackageInfos(this) + } + } } fun outgoing() { diff --git a/common/build.gradle.kts b/common/build.gradle.kts index a2877f83b..4efe08229 100644 --- a/common/build.gradle.kts +++ b/common/build.gradle.kts @@ -24,12 +24,12 @@ transitiveSourceSets { } sourceSet(lib) { rootCompile() - compile(api) + compileClasspath(api) outgoing() } sourceSet(backend) { rootCompile() - compile(api, lib) + compileClasspath(api, lib) outgoing() } sourceSet(stubs) { @@ -37,7 +37,7 @@ transitiveSourceSets { outgoingClasses() } sourceSet(main) { - compile(api, lib, backend, stubs) + compileClasspath(api, lib, backend, stubs) outgoing() } sourceSet(sourceSets.getByName("test")) { @@ -45,7 +45,7 @@ transitiveSourceSets { } sourceSet(vanillin) { rootCompile() - compile(api, lib) + compileClasspath(api, lib) outgoing() } } diff --git a/fabric/build.gradle.kts b/fabric/build.gradle.kts index 67b44b5a0..e9edf9108 100644 --- a/fabric/build.gradle.kts +++ b/fabric/build.gradle.kts @@ -7,6 +7,9 @@ plugins { id("flywheel.platform") } +val common = ":common" +val commonProject = project(common) + subproject.init("flywheel-fabric", "flywheel_group", "flywheel_version") val api = sourceSets.create("api") @@ -21,22 +24,34 @@ transitiveSourceSets { sourceSet(api) { rootCompile() + + from(commonProject) } sourceSet(lib) { rootCompile() - compile(api) + compileClasspath(api) + + from(commonProject) } sourceSet(backend) { rootCompile() - compile(api, lib) + compileClasspath(api, lib) + + from(commonProject) } sourceSet(stubs) { rootCompile() + + from(commonProject) } sourceSet(main) { // Don't want stubs at runtime - compile(stubs) + compileClasspath(stubs) implementation(api, lib, backend) + + bundleFrom(commonProject) + + bundleOutput(api, lib, backend) } sourceSet(testMod) { rootCompile() @@ -46,11 +61,8 @@ transitiveSourceSets { } platform { - commonProject = project(":common") - compileWithCommonSourceSets(api, lib, backend, stubs, main) setupLoomMod(api, lib, backend, main) setupLoomRuns() - setupFatJar(api, lib, backend, main) setupTestMod(testMod) } @@ -88,13 +100,13 @@ dependencies { modCompileOnly("maven.modrinth:sodium:${property("sodium_version")}") - "forApi"(project(path = ":common", configuration = "apiClasses")) - "forLib"(project(path = ":common", configuration = "libClasses")) - "forBackend"(project(path = ":common", configuration = "backendClasses")) - "forStubs"(project(path = ":common", configuration = "stubsClasses")) - "forMain"(project(path = ":common", configuration = "mainClasses")) + "forApi"(project(path = common, configuration = "apiClasses")) + "forLib"(project(path = common, configuration = "libClasses")) + "forBackend"(project(path = common, configuration = "backendClasses")) + "forStubs"(project(path = common, configuration = "stubsClasses")) + "forMain"(project(path = common, configuration = "mainClasses")) - "forLib"(project(path = ":common", configuration = "libResources")) - "forBackend"(project(path = ":common", configuration = "backendResources")) - "forMain"(project(path = ":common", configuration = "mainResources")) + "forLib"(project(path = common, configuration = "libResources")) + "forBackend"(project(path = common, configuration = "backendResources")) + "forMain"(project(path = common, configuration = "mainResources")) } diff --git a/forge/build.gradle.kts b/forge/build.gradle.kts index a12ea2c76..fdd825e1e 100644 --- a/forge/build.gradle.kts +++ b/forge/build.gradle.kts @@ -7,6 +7,9 @@ plugins { id("flywheel.platform") } +val common = ":common" +val commonProject = project(common) + subproject.init("flywheel-forge", "flywheel_group", "flywheel_version") val api = sourceSets.create("api") @@ -21,20 +24,32 @@ transitiveSourceSets { sourceSet(api) { rootCompile() + + from(commonProject) } sourceSet(lib) { rootCompile() - compile(api) + compileClasspath(api) + + from(commonProject) } sourceSet(backend) { rootCompile() - compile(api, lib) + compileClasspath(api, lib) + + from(commonProject) } sourceSet(stubs) { rootCompile() + + from(commonProject) } sourceSet(main) { - compile(api, lib, backend, stubs) + compileClasspath(api, lib, backend, stubs) + + bundleFrom(commonProject) + + bundleOutput(api, lib, backend) } sourceSet(testMod) { rootCompile() @@ -44,11 +59,8 @@ transitiveSourceSets { } platform { - commonProject = project(":common") - compileWithCommonSourceSets(api, lib, backend, stubs, main) setupLoomMod(api, lib, backend, main) setupLoomRuns() - setupFatJar(api, lib, backend, main) setupTestMod(testMod) } @@ -97,13 +109,13 @@ dependencies { modCompileOnly("maven.modrinth:embeddium:${property("embeddium_version")}") - "forApi"(project(path = ":common", configuration = "apiClasses")) - "forLib"(project(path = ":common", configuration = "libClasses")) - "forBackend"(project(path = ":common", configuration = "backendClasses")) - "forStubs"(project(path = ":common", configuration = "stubsClasses")) - "forMain"(project(path = ":common", configuration = "mainClasses")) + "forApi"(project(path = common, configuration = "apiClasses")) + "forLib"(project(path = common, configuration = "libClasses")) + "forBackend"(project(path = common, configuration = "backendClasses")) + "forStubs"(project(path = common, configuration = "stubsClasses")) + "forMain"(project(path = common, configuration = "mainClasses")) - "forLib"(project(path = ":common", configuration = "libResources")) - "forBackend"(project(path = ":common", configuration = "backendResources")) - "forMain"(project(path = ":common", configuration = "mainResources")) + "forLib"(project(path = common, configuration = "libResources")) + "forBackend"(project(path = common, configuration = "backendResources")) + "forMain"(project(path = common, configuration = "mainResources")) } diff --git a/vanillinFabric/build.gradle.kts b/vanillinFabric/build.gradle.kts index 96883fd3c..455da11d1 100644 --- a/vanillinFabric/build.gradle.kts +++ b/vanillinFabric/build.gradle.kts @@ -1,6 +1,3 @@ -import dev.engine_room.gradle.jarset.JarTaskSet -import org.gradle.jvm.tasks.Jar - plugins { idea java @@ -10,41 +7,23 @@ plugins { id("flywheel.platform") } +val common = ":common" +val platform = ":fabric" + subproject.init("vanillin-fabric", "vanillin_group", "vanillin_version") val main = sourceSets.getByName("main") platform { - commonProject = project(":common") setupLoomRuns() } -listOf("api", "lib") - .map { project(":fabric").sourceSets.named(it).get() } - .forEach { main.compileClasspath += it.output } +transitiveSourceSets { + sourceSet(main) { + compileClasspath(project(platform), "api", "lib") -val commonSourceSet = platform.commonSourceSets.named("vanillin").get() - -tasks.named("javadoc").configure { - source(commonSourceSet.allJava) - - JarTaskSet.excludeDuplicatePackageInfos(this) -} - -tasks.named("sourcesJar").configure { - from(commonSourceSet.allJava) - - JarTaskSet.excludeDuplicatePackageInfos(this) -} - -tasks.withType().configureEach { - JarTaskSet.excludeDuplicatePackageInfos(this) -} -tasks.named(main.compileJavaTaskName).configure { - source(commonSourceSet.allJava) -} -tasks.named(main.processResourcesTaskName).configure { - from(commonSourceSet.resources) + bundleFrom(project(common), "vanillin") + } } jarSets { @@ -68,10 +47,10 @@ dependencies { modCompileOnly("maven.modrinth:sodium:${property("sodium_version")}") - compileOnly(project(path = ":common", configuration = "vanillinClasses")) - compileOnly(project(path = ":common", configuration = "vanillinResources")) + compileOnly(project(path = common, configuration = "vanillinClasses")) + compileOnly(project(path = common, configuration = "vanillinResources")) // JiJ flywheel proper - include(project(path = ":fabric", configuration = "flywheelRemap")) - runtimeOnly(project(path = ":fabric", configuration = "flywheelDev")) + include(project(path = platform, configuration = "flywheelRemap")) + runtimeOnly(project(path = platform, configuration = "flywheelDev")) } diff --git a/vanillinForge/build.gradle.kts b/vanillinForge/build.gradle.kts index e16475411..b7f1a8170 100644 --- a/vanillinForge/build.gradle.kts +++ b/vanillinForge/build.gradle.kts @@ -1,6 +1,3 @@ -import dev.engine_room.gradle.jarset.JarTaskSet -import org.gradle.jvm.tasks.Jar - plugins { idea java @@ -10,41 +7,23 @@ plugins { id("flywheel.platform") } +val common = ":common" +val platform = ":forge" + subproject.init("vanillin-forge", "vanillin_group", "vanillin_version") val main = sourceSets.getByName("main") platform { - commonProject = project(":common") setupLoomRuns() } -listOf("api", "lib") - .map { project(":forge").sourceSets.named(it).get() } - .forEach { main.compileClasspath += it.output } +transitiveSourceSets { + sourceSet(main) { + compileClasspath(project(platform), "api", "lib") -val commonSourceSet = platform.commonSourceSets.named("vanillin").get() - -tasks.named("javadoc").configure { - source(commonSourceSet.allJava) - - JarTaskSet.excludeDuplicatePackageInfos(this) -} - -tasks.named("sourcesJar").configure { - from(commonSourceSet.allJava) - - JarTaskSet.excludeDuplicatePackageInfos(this) -} - -tasks.withType().configureEach { - JarTaskSet.excludeDuplicatePackageInfos(this) -} -tasks.named(main.compileJavaTaskName).configure { - source(commonSourceSet.allJava) -} -tasks.named(main.processResourcesTaskName).configure { - from(commonSourceSet.resources) + bundleFrom(project(common), "vanillin") + } } jarSets { @@ -79,10 +58,10 @@ dependencies { modCompileOnly("maven.modrinth:embeddium:${property("embeddium_version")}") - compileOnly(project(path = ":common", configuration = "vanillinClasses")) - compileOnly(project(path = ":common", configuration = "vanillinResources")) + compileOnly(project(path = common, configuration = "vanillinClasses")) + compileOnly(project(path = common, configuration = "vanillinResources")) // JiJ flywheel proper - include(project(path = ":forge", configuration = "flywheelRemap")) - runtimeOnly(project(path = ":forge", configuration = "flywheelDev")) + include(project(path = platform, configuration = "flywheelRemap")) + runtimeOnly(project(path = platform, configuration = "flywheelDev")) } From 40bd90b6408204e4e4cd4e8f2ca18179d2500c68 Mon Sep 17 00:00:00 2001 From: Jozufozu Date: Thu, 16 Jan 2025 10:57:11 -0800 Subject: [PATCH 9/9] One and the same - Add model id debug view - Want to be able to visually check that instances are pointing to the same model --- .../flywheel/backend/engine/instancing/InstancedDraw.java | 4 ++++ .../backend/engine/instancing/InstancedRenderStage.java | 3 +++ .../flywheel/backend/engine/uniform/DebugMode.java | 1 + .../assets/flywheel/flywheel/internal/common.frag | 7 +++++-- .../assets/flywheel/flywheel/internal/common.vert | 6 +++--- .../assets/flywheel/flywheel/internal/indirect/main.vert | 2 +- .../assets/flywheel/flywheel/internal/instancing/main.vert | 4 +++- 7 files changed, 20 insertions(+), 7 deletions(-) diff --git a/common/src/backend/java/dev/engine_room/flywheel/backend/engine/instancing/InstancedDraw.java b/common/src/backend/java/dev/engine_room/flywheel/backend/engine/instancing/InstancedDraw.java index d01e916e5..dc5fe37a2 100644 --- a/common/src/backend/java/dev/engine_room/flywheel/backend/engine/instancing/InstancedDraw.java +++ b/common/src/backend/java/dev/engine_room/flywheel/backend/engine/instancing/InstancedDraw.java @@ -42,6 +42,10 @@ public class InstancedDraw { return deleted; } + public MeshPool.PooledMesh mesh() { + return mesh; + } + public void render(TextureBuffer buffer) { if (mesh.isInvalid()) { return; diff --git a/common/src/backend/java/dev/engine_room/flywheel/backend/engine/instancing/InstancedRenderStage.java b/common/src/backend/java/dev/engine_room/flywheel/backend/engine/instancing/InstancedRenderStage.java index b3ca15b8e..38614226c 100644 --- a/common/src/backend/java/dev/engine_room/flywheel/backend/engine/instancing/InstancedRenderStage.java +++ b/common/src/backend/java/dev/engine_room/flywheel/backend/engine/instancing/InstancedRenderStage.java @@ -64,6 +64,9 @@ public class InstancedRenderStage { uploadMaterialUniform(program, material); + program.setUInt("_flw_vertexOffset", drawCall.mesh() + .baseVertex()); + MaterialRenderState.setup(material); Samplers.INSTANCE_BUFFER.makeActive(); diff --git a/common/src/backend/java/dev/engine_room/flywheel/backend/engine/uniform/DebugMode.java b/common/src/backend/java/dev/engine_room/flywheel/backend/engine/uniform/DebugMode.java index dcc13dc4c..5942e95d4 100644 --- a/common/src/backend/java/dev/engine_room/flywheel/backend/engine/uniform/DebugMode.java +++ b/common/src/backend/java/dev/engine_room/flywheel/backend/engine/uniform/DebugMode.java @@ -14,6 +14,7 @@ public enum DebugMode implements StringRepresentable { LIGHT_COLOR, OVERLAY, DIFFUSE, + MODEL_ID, ; public static final Codec CODEC = StringRepresentable.fromEnum(DebugMode::values); diff --git a/common/src/backend/resources/assets/flywheel/flywheel/internal/common.frag b/common/src/backend/resources/assets/flywheel/flywheel/internal/common.frag index 421370598..d2d4fc5d8 100644 --- a/common/src/backend/resources/assets/flywheel/flywheel/internal/common.frag +++ b/common/src/backend/resources/assets/flywheel/flywheel/internal/common.frag @@ -14,7 +14,7 @@ in vec2 _flw_crumblingTexCoord; #endif #ifdef _FLW_DEBUG -flat in uint _flw_instanceID; +flat in uvec2 _flw_ids; #endif out vec4 _flw_outputColor; @@ -79,7 +79,7 @@ void _flw_main() { color = vec4(flw_vertexNormal * .5 + .5, 1.); break; case 2u: - color = _flw_id2Color(_flw_instanceID); + color = _flw_id2Color(_flw_ids.x); break; case 3u: color = vec4(vec2((flw_fragLight * 15.0 + 0.5) / 16.), 0., 1.); @@ -93,6 +93,9 @@ void _flw_main() { case 6u: color = vec4(vec3(diffuseFactor), 1.); break; + case 7u: + color = _flw_id2Color(_flw_ids.y); + break; } #endif diff --git a/common/src/backend/resources/assets/flywheel/flywheel/internal/common.vert b/common/src/backend/resources/assets/flywheel/flywheel/internal/common.vert index 8163c1118..59e86ca53 100644 --- a/common/src/backend/resources/assets/flywheel/flywheel/internal/common.vert +++ b/common/src/backend/resources/assets/flywheel/flywheel/internal/common.vert @@ -72,10 +72,10 @@ mat3 _flw_normalMatrix; #endif #ifdef _FLW_DEBUG -flat out uint _flw_instanceID; +flat out uvec2 _flw_ids; #endif -void _flw_main(in FlwInstance instance, in uint stableInstanceID) { +void _flw_main(in FlwInstance instance, in uint stableInstanceID, in uint modelID) { _flw_layoutVertex(); flw_instanceVertex(instance); flw_materialVertex(); @@ -96,6 +96,6 @@ void _flw_main(in FlwInstance instance, in uint stableInstanceID) { gl_Position = flw_viewProjection * flw_vertexPos; #ifdef _FLW_DEBUG - _flw_instanceID = stableInstanceID; + _flw_ids = uvec2(stableInstanceID, modelID); #endif } diff --git a/common/src/backend/resources/assets/flywheel/flywheel/internal/indirect/main.vert b/common/src/backend/resources/assets/flywheel/flywheel/internal/indirect/main.vert index 85e2c8f2b..7058c21de 100644 --- a/common/src/backend/resources/assets/flywheel/flywheel/internal/indirect/main.vert +++ b/common/src/backend/resources/assets/flywheel/flywheel/internal/indirect/main.vert @@ -51,5 +51,5 @@ void main() { FlwInstance instance = _flw_unpackInstance(instanceIndex); - _flw_main(instance, instanceIndex); + _flw_main(instance, instanceIndex, draw.vertexOffset); } diff --git a/common/src/backend/resources/assets/flywheel/flywheel/internal/instancing/main.vert b/common/src/backend/resources/assets/flywheel/flywheel/internal/instancing/main.vert index 5e32d028e..75d59a73c 100644 --- a/common/src/backend/resources/assets/flywheel/flywheel/internal/instancing/main.vert +++ b/common/src/backend/resources/assets/flywheel/flywheel/internal/instancing/main.vert @@ -10,6 +10,8 @@ uniform mat4 _flw_modelMatrixUniform; uniform mat3 _flw_normalMatrixUniform; #endif +uniform uint _flw_vertexOffset; + void main() { _flw_unpackMaterialProperties(_flw_packedMaterial.y, flw_material); @@ -20,5 +22,5 @@ void main() { _flw_normalMatrix = _flw_normalMatrixUniform; #endif - _flw_main(instance, uint(gl_InstanceID)); + _flw_main(instance, uint(gl_InstanceID), _flw_vertexOffset); }