Skip to content

build(publish): Stop declaring kotlin-stdlib in published POMs#1276

Merged
runningcode merged 2 commits into
mainfrom
no/disable-default-kotlin-stdlib-dependency
Jun 8, 2026
Merged

build(publish): Stop declaring kotlin-stdlib in published POMs#1276
runningcode merged 2 commits into
mainfrom
no/disable-default-kotlin-stdlib-dependency

Conversation

@runningcode

@runningcode runningcode commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

The Kotlin Gradle plugin adds kotlin-stdlib as a default dependency, which leaks into the published POMs of the Gradle plugin (io.sentry:sentry-android-gradle-plugin) and the snapshots runtime (io.sentry:sentry-snapshots-runtime).

See Gradle docs for best practices: https://docs.gradle.org/current/userguide/best_practices_dependencies.html#dont_depend_on_kotlin_stdlib

Both artifacts run somewhere the Kotlin stdlib is already on the classpath — Gradle's own runtime for the plugin, and the consuming project for the runtime annotation library — so the declared dependency is redundant. Setting kotlin.stdlib.default.dependency=false in each module's gradle.properties drops it from the published POMs.

Verified locally: both modules still compile (they pick up stdlib transitively — via the Kotlin Gradle plugin and androidx.annotation respectively) and their generated POMs no longer list kotlin-stdlib.

sentry-kotlin-compiler-plugin is intentionally not included: its versioned source sets compile only against kotlin-compiler-embeddable and depend on the default stdlib to compile, so disabling it there would require fragile per-source-set compileOnly stdlib wiring for no real benefit (it's loaded into the Kotlin compiler classpath, which already provides stdlib).

🤖 Generated with Claude Code

The Kotlin Gradle plugin adds kotlin-stdlib as a default dependency,
which leaks into the published POMs of the Gradle plugin and the
snapshots runtime. Both run where the stdlib is already on the classpath
(Gradle for the plugin; the consuming project for the runtime artifact),
so the declared dependency is redundant. Disable it via
kotlin.stdlib.default.dependency=false.

sentry-kotlin-compiler-plugin is intentionally left out: its versioned
source sets compile only against kotlin-compiler-embeddable and rely on
the default stdlib to compile, so dropping it there would need fragile
per-source-set compileOnly stdlib wiring for no real benefit.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

@romtsn romtsn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@runningcode
runningcode merged commit 3fb86a4 into main Jun 8, 2026
23 checks passed
@runningcode
runningcode deleted the no/disable-default-kotlin-stdlib-dependency branch June 8, 2026 15:28
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.

2 participants