Hello, why are aliases (for platforms) not support...
# kotlin-toolchain
l
Hello, why are aliases (for platforms) not supported in templates?
j
I would have sworn we had an issue for this. It's quite related to KTC-5527 Support setting
product.platforms
in templates. When I glance at it, I feel it is reasonable to allow both of those things in templates. Though I'm sure when we look at the details we'll find some implications about how to resolve
@foo
in different places. I don't know why
aliases
was initially forbidden in templates, but I believe it was this kind of reason (postponing a design that has some tricky implications). I'm all for reviving this, as I feel sharing platforms and aliases should be the standard for multi-module projects.
👍🏼 1
l
Interestingly, referring an alias defined in the template consumer seems to work, even though it doesn't have autocomplete. It also shows up red when not defined in the consumer module.
j
Yeah I vaguely remember some discussions about these subtleties, but I'm super up-to-date 😅 If something feels off to you, don't hesitate to report an issue, by the way. It's the easiest way for the idea not to get lost
Maybe @utikeev knows this better
l
I think it'd make sense to be able to define aliases in
project.yaml
at least
🤔 2
Then, having the ability to define them in templates wouldn't be really needed
j
I'd say KTC-4707 (Conventional default template) + allowing aliases and platforms in templates would be better for this
u
To be fair, I don't know the exact reason why even the
product
as a whole is not allowed to be the part of a template. The
aliases
fall under the same category as they're partially derivative of the product. We'll try discussing it internally—maybe it is an artificial restriction that can be lifted.
💯 1
👍🏼 1
l
KTC-4707 (Conventional default template) makes me think about a proposal I made a while ago: https://kotlinlang.slack.com/archives/C062WG3A7T8/p1707755145574719?thread_ts=1706476436.041369&cid=C062WG3A7T8 I think my original proposal, which in a nutshell, is making applying a template mandatory, would be more flexible if, say, you want to add a new kind of product/module to your build. I see it as composition (at least one template shall be applied) vs inheritance (default template) vs boilerplate (no template usage at all). This could be enabled by an option in
project.yaml
.
Created this formal issue to request alias support at project and template levels: https://youtrack.jetbrains.com/issue/KTC-6040
j
Thanks Louis! 🙏🏼