Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Ktfmt support #3620

Merged
merged 1 commit into from
Sep 28, 2024
Merged

Add Ktfmt support #3620

merged 1 commit into from
Sep 28, 2024

Conversation

0xnm
Copy link
Contributor

@0xnm 0xnm commented Sep 27, 2024

Fixes #3612.

This PR is based on the logic done in #3531, so it looks quite similar.

@lihaoyi lihaoyi merged commit 55f02d9 into com-lihaoyi:main Sep 28, 2024
24 checks passed
@lihaoyi
Copy link
Member

lihaoyi commented Sep 28, 2024

Thanks @0xnm ! I'll transfer you the bounty using your earlier details

* Ktfmt version.
*/
def ktfmtVersion: T[String] = T {
"0.52"
Copy link
Member

Choose a reason for hiding this comment

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

If we want to provide a default at all, we should at least source it from a BuildInfo generated at build/release time. That way, we can automate bumping this dependency as part of Mill's version management.


object KtfmtModule extends ExternalModule with KtfmtBaseModule with TaskModule {

def kotlinVersion = "1.9.24"
Copy link
Member

Choose a reason for hiding this comment

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

I don't like this hardcoded version here. We should source it from some generated BuildInfo.

): Seq[os.Path] = {

object module extends TestBaseModule with KotlinModule with KtfmtModule {
override def kotlinVersion: T[String] = "1.9.24"
Copy link
Member

Choose a reason for hiding this comment

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

The version used here should be defined at the top of the test file. Same, for the other occurences.

@lefou lefou added this to the 0.12.0-RC3 milestone Sep 28, 2024
lihaoyi pushed a commit that referenced this pull request Oct 1, 2024
Some minor cleanup for the previous work on the Kotlin-related modules:

* Read tooling versions from build info
(#3620 (comment)
and
#3620 (comment))
* Declare versions only once in the unit tests
* Change parent module to `JavaModule` for Ktfmt support, because we
don't need the code to be compiled in this module, so declaring Kotlin
version there was looking a bit strange. In fact only `sources()` method
is needed, which is available in the `JavaModule`. In the future
`KotlinModule` may be split into different traits: the one which
collects Kotlin+Java files, but doesn't do any compilation (so Kotlin
version is not needed) and the one which actually does compilation.

---------

Co-authored-by: 0xnm <[email protected]>
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.

Add KtFmt support (500USD Bounty)
3 participants