Skip to content

feat(gradle)!: stop choosing the engine and drop the Kotlin plugin - #336

Merged
oglassdev merged 2 commits into
feat/neutral-session-contractsfrom
feat/plugin-rework
Oct 6, 2026
Merged

oglassdev merged 2 commits into
feat/neutral-session-contractsfrom
feat/plugin-rework

Conversation

@oglassdev

@oglassdev oglassdev commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #335 (which is stacked on #334).

Summary

The Gradle plugin no longer picks an engine or configures Kotlin. Apps declare what they run on, and everything the plugin generates or runs is engine-neutral.

  • No engine dependency: com.chunkzero.chunk stops adding multistom / multistom-kotlin. Apps add com.chunkzero.chunk:multistom (or multistom-kotlin), or upstream net.minestom:minestom with com.chunkzero.chunk:minestom.
  • No Kotlin plugin: com.chunkzero.chunk.kotlin is removed. When the root project applies org.jetbrains.kotlin.jvm, the base plugin generates CoroutineBackendClient, compiles it in the reserved :chunk:backend-kotlin project, and makes Kotlin modules depend on it. Java apps stay free of Kotlin (the root's own kotlin-stdlib is excluded from its published variants).
    • The plugin no longer has a compile-time dependency on the Kotlin Gradle plugin. validateChunkJvm still checks Kotlin compile targets against the toolchain, loading Kotlin types through the applied plugin's classloader. It works whether Kotlin is declared in settings with apply false or applied with a version in the root build; both are covered by TestKit.
    • The plugin no longer sets Kotlin compiler options.
  • Engine-neutral world conversion: the new com.chunkzero.chunk:world-converter module replaces multistom's internal AnvilConverter. The plugin resolves it at its own version and runs it on the app's runtime classpath, so it uses the app's own Minestom or multistom. Polar resolves consistently with the app's version.
    • The converter compiles against upstream Minestom. The few process APIs that differ between upstream and multistom (process startup, exception manager, instance constructor, version constants) go through a small reflective Engine adapter.
    • Its tests run against both engines (test and multistomTest).
  • Templates: chunk create writes root build files as templates. Java apps add multistom, and Kotlin apps apply Kotlin themselves and add multistom-kotlin, pinned to the CLI version.
  • Examples declare their engine dependency and apply Kotlin themselves.

Breaking changes

  • Replace id("com.chunkzero.chunk.kotlin") with id("org.jetbrains.kotlin.jvm") plus id("com.chunkzero.chunk"), in the root and in Kotlin modules.
  • Add the engine dependency to each app: implementation("com.chunkzero.chunk:multistom:<version>") or multistom-kotlin.

Known limitations

  • Kotlin code in the root project itself isn't supported: Java apps don't get the root's kotlin-stdlib.
  • The converter's engine differences are bridged with reflection rather than compile-time checks. They are covered by running the converter's tests on both engines. feat!: stop converting Anvil worlds #337 removes world conversion entirely until it's redesigned.

Validation

  • ./gradlew :jvm:runtime:test :jvm:multistom:test :jvm:multistom-kotlin:test :jvm:minestom:test :jvm:world-converter:check (the converter on both engines)
  • jvm/gradle-plugin tests, including both Kotlin setups and a Java app in a Kotlin build
  • cargo test -p chunk-cli creation
  • examples/{local,arena,load} testClasses
  • scripts/check-consumers.py (fresh Java and Kotlin chunk create projects, arena, local)
  • An end-to-end Anvil → Polar conversion on both engines, in a scratch project
  • just fmt-check

🤖 Generated with Claude Code

The com.chunkzero.chunk plugin no longer adds multistom or multistom-kotlin;
apps declare their engine dependency themselves. The com.chunkzero.chunk.kotlin
plugin is removed: when the root project applies org.jetbrains.kotlin.jvm, the
base plugin generates and compiles the coroutine backend facade, and Kotlin
modules depend on it. World conversion moves to the engine-neutral
world-converter module, which runs on the app's own Minestom or multistom.

BREAKING CHANGE: apply org.jetbrains.kotlin.jvm instead of
com.chunkzero.chunk.kotlin, and add com.chunkzero.chunk:multistom (or
multistom-kotlin) to each app.
@oglassdev
oglassdev added this pull request to stack #338 October 6, 2026 03:54
@oglassdev
oglassdev merged commit 5d6c6a4 into main Oct 6, 2026
13 checks passed
@oglassdev
oglassdev deleted the feat/plugin-rework branch October 12, 2026 23:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant