-
-
Notifications
You must be signed in to change notification settings - Fork 350
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 Kotlin examples for builds and linting #3555
Add Kotlin examples for builds and linting #3555
Conversation
d0396dd
to
9d83320
Compare
At a first glance the approach looks reasonable. As your TODOs mention, explicit For the |
b81cae3
to
c80199b
Compare
c80199b
to
6c502ba
Compare
I created Indeed it is possible to have a mix of the |
Generally looks good. The We should also include an autoformatting integration in |
I just realized that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think all these type aliases are necessary or should be there at all. Instead, users should just include either the scalalib
or even better the javalib
versions. E.g if users see a MavenModule
in the kotlinlib
package as an addition to the version in javalib
they might think it's already preconfigured to handle Kotlin sources, which isn't the case.
Instead introduce a KotlinMavenModule
which is handling the Kotlin specifics, but extends from javalib.MavenModule
. This will also ensure, that users who already customized MavenModule
to their needs, don't get their sources overridden or changed twice.
I think the I think it's a nice property that someone writing Kotlin shouldn't generally just need |
I disagree. Once we really move classes that are now only aliases into In fact extending |
@lefou I don't think what your saying is contradictory with mine. I agree that having the different Not everyone agrees that having one import is necessary - e.g. lot of akka makes you import stuff from 5-10 different packages to get anything done. But most of com-lihaoyi is built around trying to reach one or even zero-import usage. It's a stylistic choice There's definitely an arbitrary line drawn in every case, and there'll be edge cases around ambiguity and stuff, but let's keep the aliases in kotlinlib/package.scala for this initial set of kotlin PRs, and we can discuss changing the convention separately |
@lihaoyi Sure. You have the final saying here. Removing stuff is harder than adding. Any alias removal is a source incompatible change. |
I extracted Added a formatting option and example for
I would say that having re-exports is handy, because having import from |
Looks good @0xnm ! Going to merge it so you can proceed with the remaining few folders |
Apart from adding `.adoc` pages for all the kotlin examples #3585 #3589 #3555 and the palantir java format example from https://github.com/com-lihaoyi/mill/pulls?page=2&q=is%3Apr+is%3Aclosed, I moved some docs around: the first few things under `Foo Example Builds` really belong under `Foo Module Configuration`, the `external/libraries/` folder should be in `depth/libraries/` The test for `Custom Main Argument Parsers` seems to have bitrotted since it was implemented, and it accidentally wasn't running in the test suite before so we didn't notice. For now just disabling that test and we can fix it later
This PR partially addresses Part 2 of #3451, it add
builds
andlinting
examples.For the linting example I used detekt for the static code analysis (
error-prone
doesn't support Kotlin) and ktlint for formatting.Note:
builds/8-compat-modules
usedsrc/java
structure which is dictated by theMavenModule
, but ideally it should besrc/kotlin
for Kotlin files and maybesrc/java
for Java files.