rocketraman
10/16/2026, 5:09 PMkotlin build, tests pass with kotlin test (TestBalloon + power-assert), and the examples start with kotlin run
• Metro works as a third-party compilerPlugins entry
• Our Gradle setup used custom source sets and hand-written POMs for optional DI integrations -- those became plain modules plus a small template, and the published POMs and Gradle module metadata came out right
• Error messages are very good (e.g. “Maven Central requires artifact signatures”, pointing at both conflicting lines)
What blocks me from migrating
• Signing: it only works with an exported ASCII-armored key in KOTLIN_TOOLCHAIN_SIGNING_KEY. I sign with gpg-agent and the key lives on my YubiKey, so I’d need something like Gradle’s useGpgCmd() or support for an external signer
Smaller things I hit
• The javadoc jar is a placeholder; an easy way to ship Dokka output in it would be good.
• Version: settings.publishing.version is a fixed string. Currently we get the release version from the vX.Y.Z git tag, so I’d need a CLI or env-var override, or some way to compute it
• With kotlin.version pinned to 2.3.x, built-in powerAssert still adds kotlin-power-assert-runtime, which only exists for 2.4+, so dependency resolution fails
• TestBalloon by default finds 0 tests because the toolchain passes class selectors to JUnit. Workaround: set `TESTBALLOON_INCLUDE_PATTERNS`: "*" via settings.jvm.test.extraEnvironment -- understood that TestBalloon does not officially support Toolchain yet, so the fact that it works at all is cool (and IDE support for TestBalloon tests with kotlin-toolchain is missing)
• We still have to manually pick the Metro compiler artifact that matches the Kotlin version: 1.3.2 crashes on 2.4 with NoSuchMethodError, 1.4.5 works -- Gradle works the same way but ideally Toolchain would work better, and at least provide clearer error messages (maybe this is a Metro issue, not Toolchain)
• If mavenCentral is enabled, signing is required even to publish to mavenLocal. There’s no per-run switch like Gradle’s -PsigningRequired=false
• kotlin publish <repo> without -m fails when some modules (like non-published example modules) don’t declare that repo
• Templates can’t override each other (a conflict is an error). Our Metro modules need languageVersion: 2.3 while everything else uses 2.1, so the override has to be repeated in each Metro module.yaml. Some way to layer templates would help.
• A file:// repository URL isn’t supported, which isn't normally an issue, but this ability can be useful for debugging
• An unknown key in a template shows the right error, then an internal-error stack trace (propertyDeclaration is null)joffrey
10/19/2026, 2:07 PMjoffrey
10/19/2026, 2:12 PMThe javadoc jar is a placeholder; an easy way to ship Dokka output in it would be goodI initially planned integrating with Dokka for this, but the recent developments with Sonatype quotas for Maven Central made me think twice. In the long discussion with Brian Fox (from Sonatype) on this Slack (+ other internal ones), the idea surfaced that Dokka's content is not super suitable as a Javadoc JAR (at least not as HTML). The Dokka output would be repeated on all KMP target artifacts, which bloats the publication, and IDEs read the sources JAR instead when loading the KDocs anyway. For pure JVM libraries, it could make sense to use the Javadoc output of Dokka, though. We still have this ticket open for it (might need some updates): KTC-472 Support javadoc jar generation (for publication)
joffrey
10/19/2026, 2:14 PMsettings.publishing.version is a fixed string. Currently we get the release version from the vX.Y.Z git tag, so I’d need a CLI or env-var override, or some way to compute it
We have started a design to properly inject values into the build from outside (properties, env vars, stuff like that). This should eventually solve this problem. The issue to track this is the following:
KTC-3854 Possibility to define different configs for different environments
In the meantime, I agree it's a bit inconvenient. What we do ourselves in our own CI is we change the YAML from the CI job before publication 😅joffrey
10/19/2026, 2:17 PMWithOh thank you! For some reason I missed this. I created this issue for tracking: KTC-6057 Implicit kotlin-power-assert-runtime fails DR with Kotlin < 2.4pinned to 2.3.x, built-in powerAssert still adds kotlin-power-assert-runtime, which only exists for 2.4+, so dependency resolution failskotlin.version
joffrey
10/19/2026, 2:19 PMsettings.jvm.test.extraEnvironment -- understood that TestBalloon does not officially support Toolchain yet, so the fact that it works at all is cool (and IDE support for TestBalloon tests with kotlin-toolchain is missing)
@Oliver.O is actually pretty involved in making things work with Kotlin Toolchain. The test selector issue is a known problem that we'll eventually need to address somehow on the Kotlin Toolchain side. It's not 100% clear how we'll support arbitrary JUnit engines via our test filters, but we'll need to think about it.
Some suggestions by Oliver here: youtrack.jetbrains.com/issue/KTC-4080/Simplify-test-filtering-options#focus=Comments-27-13637610…joffrey
10/19/2026, 2:21 PMWe still have to manually pick the Metro compiler artifact that matches the Kotlin version: 1.3.2 crashes on 2.4 with NoSuchMethodError, 1.4.5 works -- Gradle works the same way but ideally Toolchain would work better, and at least provide clearer error messages (maybe this is a Metro issue, not Toolchain)I think @Youssef is working on something that will make it easier for compiler plugin authors to support multiple Kotlin versions. Hopefully this will eventually get better. I don't think there is a lot we can do on the Kotlin Toolchain side for now, apart maybe from providing a way to reference the Kotlin version from inside the compiler plugin coordinates (so that compiler plugin authors can publish versions like
1.2.3-kotlin-2.4.21 (a bit like KSP used to do). But again, if there is a better long-term solution, maybe this is not needed.joffrey
10/19/2026, 2:31 PMmavenCentral is enabled, signing is required even to publish to mavenLocal. There’s no per-run switch like Gradle’s -PsigningRequired=false
>
Thanks! I think this was broken when implementing publication for KMP libraries. We moved the sigining code to some common place that is now also used to publish to maven local, and thus missing signatures now also fail there. Now tracked there:
KTC-6058 kotlin publish mavenLocal fails on missing signature when signing is enabledjoffrey
10/19/2026, 2:37 PMThank you! That's definitely on me: KTC-6059without -m fails when some modules (like non-published example modules) don’t declare that repokotlin publish <repo>
kotlin publish without -m incorrectly requires in non-published modulesjoffrey
10/19/2026, 2:39 PMapply)? This is one of their uses. Please check the very last part of this documentation page:
kotlin-toolchain.org/latest/user-guide/templates#…joffrey
10/19/2026, 2:41 PMAThat would be KTC-5759 Allow publishing to a custom local directoryrepository URL isn’t supported, which isn't normally an issue, but this ability can be useful for debuggingfile://
joffrey
10/19/2026, 2:45 PMrocketraman
10/19/2026, 3:27 PMHave you tried nested templates (templates using apply)? This is one of their uses. Please check the very last part of this documentation page:Confirmed, that works, thank you.
Could you please share a reproducer? I can't seem to reproduce. I get the clean error, and no internal stack: (edited)Reproducer: it seems specific to
description, which is valid in module.yaml but not in a template. Unknown keys like foo: bar give the clean error. On 0.13.0:
project.yaml modules:
- lib
common.module-template.yaml description: Some description
lib/module.yaml product: jvm/lib
apply:
- //common.module-template.yaml
lib/src/Hello.kt fun hello() = "hi"rocketraman
10/19/2026, 3:29 PMOliver.O
10/19/2026, 3:30 PMrocketraman
10/19/2026, 4:52 PMrocketraman
10/19/2026, 5:12 PMjoffrey
10/19/2026, 5:40 PMjoffrey
10/19/2026, 5:41 PMrocketraman
10/19/2026, 6:37 PMJAVA_HOME unset, “Get provisioned JDK” takes up to 1.3 s per task even with the JDK already cached; with JAVA_HOME set it drops to 0.06 s and the build goes from 11.8 s to 10.2 s.
I'm not sure why the first 3 small modules take 1.5s to compile.
di-bench appears to take a long time to compile (long enough that it is critical path) takes ~6.4 s in the compiler alone: ~2 s each for the Kodein and Metro code and ~2.3 s even with both removed. Gradle seems faster on this module for some reason. If I can dig into anything here, let me know.rocketraman
10/19/2026, 7:26 PM[SC] primary on a smartcard, KOTLIN_TOOLCHAIN_SIGNING_KEY set to gpg --export-secret-subkeys '<subkey>!' (stub primary plus one signing subkey) fails with PGP signing failed … NullPointerException: … OpenPGPSecretKey.unlock(char[]) is null” BouncyCastle’s addSigningKey also selects the stub primary. gpg signs fine with the same export. Could the toolchain skip keys without secret material, or let us pick the signing subkey (like Gradle’s signing.keyId)?Oliver.O
10/19/2026, 7:55 PM--include-pattern, --exclude-pattern) and another TestFilter subclass, which basically holds the corresponding attributes (list of strings).
These would be passed to the respective test framework unchanged (without parsing or interpretation), except for an element delimiter (e.g. picking one that's really unlikely to be part of a test name, like TestBalloon's ⬥). Environment variables could serve as a single mechanism to make these pattern lists available on all platforms except browsers (like KOTLIN_TEST_INCLUDE, KOTLIN_TEST_EXCLUDE). For browsers, we could use URL parameters of the same name.
For the Kotlin Toolchain IDE plugin, we'd need an integration point for a test framework's IDE plugin. We'd need just two functions with the following capabilities:
• Take a PsiElement, and provide its test element characteristics like type (test or suite), includePattern, displayName. The Toolchain plugin could then display a run gutter icon and supply the run configuration's --include-pattern argument.
• Take the framework-specific test element's pathId from a test event reported during execution, and provide its PsiElement. The Toolchain plugin could then support "jump to source" from test results and display run gutter icon's test result status (success, failure, ...).
If there is interest and it would not collide with current priorities in the Toolchain roadmap: I could try to come up with a PR for Kotlin Toolchain. And for IDE plugin integration, I could try to create a more elaborate spec.joffrey
10/19/2026, 8:00 PMAttached. From a clean kotlin build (11.8 s) followed by kotlin test (2.1 s) on 0.13.0. Claude rendered this timelineSorry I was asking for the actual telemetry traces from the logs folder (
build/logs/amper_<datetime>_<command>/telemetry/kotlin_cli_traces.json), or the whole build/logs/amper_<datetime>_<command> folder if you're ok with that. That would be way more helpful. This rendered view doesn't say muchjoffrey
10/19/2026, 8:05 PMWith anThanks for exploring this option! I think we need to support subkeys, that would be more correct. Let me open an issue for this: KTC-6065 Allow configuring a signing subkeyprimary on a smartcard,[SC]set toKOTLIN_TOOLCHAIN_SIGNING_KEY(stub primary plus one signing subkey) fails withgpg --export-secret-subkeys '<subkey>!'BouncyCastle’sPGP signing failed … NullPointerException: … OpenPGPSecretKey.unlock(char[]) is null"also selects the stub primary. gpg signs fine with the same export. Could the toolchain skip keys without secret material, or let us pick the signing subkey (like Gradle’saddSigningKey)?signing.keyId
rocketraman
10/19/2026, 8:06 PMjoffrey
10/19/2026, 8:16 PMjoffrey
10/19/2026, 8:17 PMdescription in templates, thanks for the reproducer!
KTC-6066 Internal error when using a module-only property in a templatejoffrey
10/19/2026, 8:24 PMgpg binary: KTC-6067 Allow signing with a local GPG binary/agentjoffrey
10/19/2026, 8:43 PMJAVA_HOME unset, “Get provisioned JDK” takes up to 1.3 s per task even with the JDK already cached; with JAVA_HOME set it drops to 0.06 s and the build goes from 11.8 s to 10.2 s.
About the JDK stuff, this is because on clean builds we re-check the list of JDKs. It's technically in a shared cache, but the information that tracks whether it's up to date is still stored per project. So if you clean your build directory, the Kotlin Toolchain will re-download and decompress the JDK list just to be sure. This is what takes 1.3s.
It is actually not really per-task. In the traces, only one of these spans actually does the download/decompression. The others are just waiting on it (because they are synchronized). You can see they have from-memory-cache=true and no nested spans.
This shouldn't affect hot builds or tests, though. You can see the traces for the test run on hot caches does the JDK check in ~20ms for the first module(s) and then sub-millisecond (<150μs) for anything that needs it later.joffrey
10/19/2026, 9:28 PMbuild call that is not fully cached therefore need to load the compiler's classes, which is quite significant.
One thing you could check is whether you have any Gradle or Kotlin daemon running before doing the clean build. That would skew the results of the Gradle side for the comparison.
I'm exploring some options with AOT caching to speed the startup of our CLI, and it can give more than 1.3x speedups in some cases on clean builds, and 2.5x on builds with a hot cache. If you have a small-ish project, compilation startup might matter.rocketraman
10/21/2026, 12:52 PM