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 kotlinlib example/module examples #3585

Merged
merged 5 commits into from
Sep 22, 2024

Conversation

0xnm
Copy link
Contributor

@0xnm 0xnm commented Sep 20, 2024

This PR adds more stuff for #3451, namely example/kotlinlib/module examples.

Few notes about things being done:

  • 1-compilation-execution-flags - there is not so many flags which can be passed to the Kotlin Compiler itself. I simply used -Werror.
  • 6-annotation-processors - I used kotlinx.serialization as proposed by @lefou. It seems Kotlin Compiler doesn't automatically pick compilation plugins from the classpath, so I had to pass path to it explicitly using -Xplugin option.
  • 7-dokkajar - obviously javadoc cannot be used to generate docs for Kotlin classes, so I added support for Dokka to KotlinModule and added a forwarding of docJar calls to dokkaJar.
  • 13-jni - there is no possibility to generate header files from Kotlin files (unless an ugly trick is used to take compiled .class files, decompile them back, clean-up and pass to javac to generate headers), so I dropped header generation.

@0xnm 0xnm marked this pull request as ready for review September 20, 2024 21:51
@0xnm 0xnm requested a review from lihaoyi September 21, 2024 08:13
@@ -134,6 +135,83 @@ trait KotlinModule extends JavaModule { outer =>
()
}

override def docJar: T[PathRef] = T[PathRef] {
T.log.info("docJar task shouldn't be used for Kotlin modules, using dokkaJar instead")
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if we really need this warning? e.g. for both Java and Scala 2.x and Scala 3.x they all use docJar, despite being wildly different backend implementations. Can we just let KotlineModule users use docJar as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, I added Dokka backend for docJar directly, without a dedicated dokkaJar task (although the example is still called 7-dokkajar to avoid copying lines from scalalib).

@lihaoyi
Copy link
Member

lihaoyi commented Sep 21, 2024

I think this looks pretty good. Left one more comment, and lemme try to get tests green before merging

@lihaoyi
Copy link
Member

lihaoyi commented Sep 22, 2024

Seems the mockito tests are flaky, will merge regardless and deal with the flaky test after

@lihaoyi lihaoyi merged commit b50c600 into com-lihaoyi:main Sep 22, 2024
23 of 24 checks passed
@lihaoyi
Copy link
Member

lihaoyi commented Sep 22, 2024

Thanks @0xnm! Just need the testing/ and publishing/ tests next, then I'll close out the bounty

lihaoyi added a commit that referenced this pull request Sep 23, 2024
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
@lefou lefou added this to the 0.12.0-RC3 milestone Sep 23, 2024
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.

3 participants