Modernize build toolchain - #46
Merged
Merged
Conversation
The sha256 had to be supplied explicitly via --gradle-distribution-sha256-sum because gradle-wrapper.properties pins distributionSha256Sum; the wrapper task refuses to regenerate it otherwise. Checksum verified against services.gradle.org.
Kotlin 2.4 removed experimental context receivers, so -Xcontext-receivers is now rejected outright rather than merely deprecated. The flag becomes -Xcontext-parameters and every `context(Type)` declaration becomes `context(name: Type)`. Call sites that used the context receiver's `botApiClient` member implicitly must now qualify it through a named parameter, so the two generator templates that emit those bodies use `context(ctx: ...)`; declarations that only propagate the context use the anonymous `_`. This is ABI-neutral: context parameters are still lowered to a leading JVM parameter, so all 655 public signatures carrying TelegramBotApiContext are byte-identical to before. The CONTEXT_RECEIVERS_DEPRECATED suppressions are dropped as the diagnostic no longer exists.
serialization 1.11.0 is built against Kotlin 2.3.20, one minor behind the 2.4.10 compiler. This library uses serialization heavily, but the full test suite passes and this bump leaves the generated ABI unchanged.
0.18.0 is the latest stable validator release. Documentation still generates via dokkaGeneratePublicationHtml.
Two leftovers from the context receivers to context parameters move: a stale doc comment in the generator corrections, and an unexplained 'with' in the poller that reads like an obsolete idiom but is load-bearing. The stdlib 'context(...)' introducer is unavailable on this toolchain, so 'with' is currently the only way to supply a context parameter at a call site, and modernizing it would not compile.
embeddedKotlinVersion floats with the Gradle distribution and moved 2.2.0 to 2.3.21 unnoticed during the 9.0 to 9.6.1 upgrade. Referencing the catalog makes the version explicit and keeps it in step with the main build. Gradle resolves the kotlin-dsl plugin's embedded 2.3.21 up to 2.4.10, so buildSrc still compiles.
The 17 in .ci-java-version is not drift from the declared jvmToolchain of 21: it only starts Gradle, while the foojay resolver provisions 21 for compilation. Left as is and explained at both usages.
The 'by tasks.registering' and 'by project' delegate syntaxes are scheduled for removal in Gradle 10. Switched to register(name) and findProperty. Six task registrations were affected, not just the two originally reported, since every delegate form warns.
Matches the style used by the rest of the catalog. Resolved versions are unchanged: buildEnvironment output is identical before and after.
slf4j 1.7.36 to 2.0.18 requires swapping the test binding from log4j-slf4j-impl to log4j-slf4j2-impl: the 1.x binding is silently inert against a 2.x API, so logging would have gone dark without any error. Ktor 2.3.7 to 3.5.1 is a major bump but still targets JDK 8 bytecode. JUnit stays on 5.x here because 6.x requires JDK 17; it moves with the release target in a later commit.
Clears the standing deprecation: 2.0 and 2.1 are deprecated on the 2.4.10 compiler, and 2.4 is the compiler default, so this avoids straddling a deprecation line that would need revisiting within a year. apiVersion is the consumer gate, so consumers now need Kotlin 2.4 or newer; languageVersion governs how this source compiles. Both move because the build derives them from kotlinTarget. coreLibrariesVersion also moves, raising the published POM's kotlin-stdlib constraint from 2.0.0 to 2.4.0.
JDK 11 is past broad support. 17 rather than 21 because no published dependency needs more: Ktor 3.5.1 still ships JDK 8 bytecode, and the only JDK 17 requirement comes from JUnit 6, which is test-only. Going to 21 would exclude consumers still on 17 for no gain. Consumers now need a JDK 17 or newer runtime. The CI bootstrap JVM stays independent of this and of the toolchain; its comment is updated to say so.
Context parameters are stable at language version 2.4, and the compiler now reports -Xcontext-parameters as redundant. Gradle 10 has not shipped; 9.6.1 is still current, and no Gradle 10 deprecations remain under --warning-mode all.
Two categories of change, both consequences of the Kotlin 2.4 compiler rather than source edits. 419 synthesized $$serializer classes gain a final modifier and a typeParametersSerializers method, from the serialization plugin's codegen. 23 TelegramBotUpdateListener methods change from abstract to default: they have empty bodies in source, and 2.4 emits real JVM default methods instead of abstract plus DefaultImpls, which improves Java interop. Generated sources are unchanged, so neither is source drift.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Moves the build onto current tooling: Gradle 9.6.1, Kotlin 2.4.10, and the latest stable of every remaining dependency. Breaking for consumers.
Why
The toolchain had drifted far enough that several pieces were past support or blocking each other. Kotlin 2.4 removed the K1 compiler and with it
-Xcontext-receivers, so the compiler bump forced the context-parameters migration rather than being optional.What
-Xcontext-receivers→ context parameterskotlinTarget2.0.0 → 2.4.0;jdkTarget11 → 17embeddedKotlinVersion[versions]Details
Consumer impact — all breaking:
The slf4j bump requires swapping the binding:
log4j-slf4j-impl→log4j-slf4j2-impl. The 1.x binding is silently inert against a 2.x API — logging goes dark with no error. Done here for the test binding; anyone depending on this library needs the same swap in their own runtime.Deliberate choices:
languageVersion/apiVersionstay derived fromkotlinTarget. Raising it to 2.4 is what moves the consumer floor; that derivation is unchanged.embeddedKotlinVersionwas floating. It moved 2.2.0 → 2.3.21 unnoticed during the Gradle bump. Now pinned to the catalog. Gradle resolves the kotlin-dsl plugin's embedded 2.3.21 up to 2.4.10.Review: scrutinise the version catalog and
build.gradle.kts. The context-parameters migration is mechanical and ABI-neutral — all 655 signatures carryingTelegramBotApiContextare byte-identical, since context parameters still lower to a leading JVM parameter. The.apibaseline commit is churn from the Kotlin 2.4 serialization plugin (419 synthesized$$serializerclasses gainfinal+typeParametersSerializers) plus 23 listener methods goingabstract→default; no source drift.