joffrey
11/24/2025, 3:36 PMRey (Kingg22)
11/24/2025, 11:42 PMOliver.O
11/25/2025, 12:05 AM@TaskAction, @Input and @Output?
I guess with testballoon TestBalloon, I have to wait for a couple of days 😉 until KMP and compiler plugin support evolves, but that's fine. kodee lovingjoffrey
11/25/2025, 2:13 PMlayout: maven-like forever, but initially we introduced it to ease transitions from Maven/Gradle. Do you generally prefer this layout? Could you please share why you would stick to it? That would be quite helpful for us to understand the users' expectations.joffrey
11/25/2025, 2:48 PMCan we already use "kotlin compiler plugins" with this plugin thing, or not yet? I mean able to pass arguments to builds.There are several things to unpack here, sorry for the delay in my response. 1. In the current state, plugins are only local to the project, and only consist of custom tasks. 2. Custom tasks are separate from built-in tasks like the Kotlin compilation task. They can generate sources and thus provide more inputs to the compilation task, but they can't customize the compilation task itself (e.g., add compiler arguments). 3. The way to configure built-in things (like compiler arguments) in Amper is via the module settings, which can be set directly in
module.yaml, or via templates if you want to share configuration between module. Plugins don't provide anything in this regard for now – since they are only local to the project, that would be redundant with templates. That said, we will soon provide a way to publish/consume plugins to/from Maven. With this feature will come the need to provide some kind of template-like data together with the plugin, so the consumers of the plugin will get some module settings by default when enabling the plugin.
Now, if something is not doable in module.yaml, it is not doable in templates either (nor in future bundled plugin templates). So if we want to support 3rd party compiler plugins, this needs to be implemented first as a feature on its own. Then, templates (and later plugins) will be able to leverage this. We're aware that 3rd party compiler plugins are important to many users.
_
TL;DR: not yet. Once we implement support for the 3rd party compiler plugins + support for plugin publication and plugin bundled templates, you'll be able to write Amper plugins that wrap a custom Kotlin compiler plugin.joffrey
11/25/2025, 2:56 PM@TaskAction, @Input and @Output?
Hi @Oliver.O! Could you please clarify what you're referring to here? Do you mean the inferred task dependencies from input/output paths? Or maybe the automatic task avoidance based on changed inputs/outputs?
By "more explicit API", do you mean for example having to declare task dependencies by hand in plugin.yaml? We considered this, but it seems like the majority of the time, having an input that's the same path as another task's output really should mean you depend on that task, so we tried to optimize for the common case. There is an obvious need for an escape hatch though. A very common special case is linter-like plugins that save a baseline/reference file, and provide a task to update it and a task to check against it. These 2 tasks have this output/input link, but obviously the one that checks shouldn't depend on the task that generates it, otherwise you'll never see any failure.Oliver.O
11/25/2025, 4:24 PM@Input annotation can only be present in a task's parameter. In that case I would lose the ability to use plain Kotlin to construct inputs, like it would be possible via an explicit invocation of something like inputs.add(myFirstInput), then followed by inputs.add(mySecondInput).joffrey
11/25/2025, 6:51 PMjoffrey
11/25/2025, 6:53 PMOliver.O
11/25/2025, 7:22 PM--tests) without invalidating the configuration cache to
◦ set up environment variables,
◦ create a custom Karma configuration (simulating environment variables),
◦ removing or patching command line parameters which legacy test frameworks wouldn't understand.
Based on that experience, a clean execution model which would alleviate the lifecycles issues we are currently experiencing with Gradle (so many plugins resort to afterEvaluate) would be the most important contributing factor.
Does that help at this stage?rocketraman
11/26/2025, 1:29 PMjoffrey
11/26/2025, 1:50 PMOliver.O
11/26/2025, 1:55 PMjoffrey
11/26/2025, 2:03 PMWhen thinking about the execution model of plugins, please also consider multi-round code generation. Example: a KSP plugin (https://kotlinlang.org/docs/ksp-multi-round.html).Just to be clear, Amper supports KSP2 out-of-the-box, and with it, its multi-round processor calls. We don't control how KSP works, we just pass it all the processors, and then KSP does its own multi-round operations and ends up producing some outputs. We use these final outputs for our compilation. KSP2 is not a compiler plugin integrated into the compiler anymore (unlike KSP1), it's now a separate process that runs before Kotlin compilation. On the other hand, Amper doesn't support multi-round codegen in general Amper plugins. If your plugin generates sources, they are currently not seen by other plugins (they are just registered as inputs for the compilation). That said, the idea is that, if your plugin's goal is to read Kotlin sources to generate stuff, it should probably be a KSP processor instead, and this way you get the multi-round lifecycle "for free". If your plugin doesn't read source files, then it doesn't need multi-round execution because its inputs will not change. This is why we didn't consider introducing multi-round codegen for the time being. But we'll keep an eye out for more use cases, for sure. cc @Fedor Ihnatkevich
Fedor Ihnatkevich
11/26/2025, 2:23 PMThis is why we didn't consider introducing multi-round codegen for the time being.If you need the multi-round code generation (based on annotation processing) - then KSP is the way to go - it has all the necessary infrastructure. And Amper integrates KSP out of the box. In our new Amper plugin tasks you can read user sources (from
src) and generate more sources - that's pefectly fine. However you can't depend on the generated sources and then produce more (this requires multi-round or some other workarounds). We are not currently looking into implementing multi-round source generation using custom tasks in Amper, because KSP covers this, at least somehow.rocketraman
11/26/2025, 2:37 PMrocketraman
11/26/2025, 2:39 PMFedor Ihnatkevich
11/26/2025, 2:43 PMThat makes sense. One thing that wasn't clear to me was how KSP's API integrated with Gradle's (and now Amper) task input/output declarations.It doesn't have to, because KSP is a built-in thing in Amper and doesn't have to use public plugin APIs, like `@Input`/`@Output`, to interface with Amper build engine. So for KSP it just works. And KSP outputs (after all the rounds) are available to the external plugin tasks using
ModuleSources configurable with includeGenerated property enabled. See here.Fedor Ihnatkevich
11/26/2025, 2:55 PMksp task with something along the lines:
@TaskAction fun doKsp(
@Output kotlinOutputDir: Path,
@Output javaOutputDir: Path,
@Output resourcesOutputDir: Path,
@Input userSources: ModuleSources,
@Input userProcessors: Classpath,
@Input kspRuntimeClasspath: Classpath,
...
) { ... }
And all the multi-round processing would happen inside this task and it would only produce single well-defined output directories per output type. Which is perfectly fine with Amper's public plugins API.
Note: this would only work for JVM-only, because current plugins preview doesn't play well with KMP, but it may be implemented in the future.Rey (Kingg22)
11/27/2025, 12:31 AMDo you generally prefer this layout? Could you please share why you would stick to it? That would be quite helpful for us to understand the users' expectations.Hi @joffrey! I think I prefer keeping the same file layout for two main reasons. First, it makes it easier to test Amper and, if anything is missing, quickly switch back to Gradle or Maven without friction. Second, it helps avoid large commits or PRs that move many files around, which makes it harder to track changes in Git (and also affects
git blame readability).
Finally, I appreciate Amper’s philosophy of letting me focus on my application rather than the build tool itself — and that includes not having to reorganize my project structure just to satisfy the build system.joffrey
11/27/2025, 8:46 AM