-
-
Notifications
You must be signed in to change notification settings - Fork 353
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
First pass at first-class support for Java projects #3261
Conversation
javalib
package and Java Build Examples
documentation
This is a binary compatible change, so we can merge it into main and cut a 0.11.9 (we should cut a release soon after merging, because the new docs get published immediately from master, and people will be confused if the code hasn't been published yet) |
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.
In the locally built page, I see strange markers like SNIPPED:BUILD
. Are they necessary? Could you hide them with AscciDoc comments (//
)?
Ah that's probably a screw up in my templating logic, will fix |
Fixed it by swapping to asciidoc comments |
Do we really need that template logic? Can't we re-use AsciiDdoc includes here? Or do you already use them as tags for AsciiDoc includes? It's not obvious to me. |
Few reasons:
The implementation of our hacky build.sc doc-generator is not pretty, but I think the DRYness and readability of the combined test logic and documentation has been very good, so it's worth suffering the hackiness |
Why do we need two separate Installation pages for Java and Scala, while both contain the exact same content (via include)? |
Because I couldnt find a better place to put it, and having one page in both lists causes antora bugginess. Fundamentally, i want people to read that as the second page, after they read the intro but before they read the rest. So putting it alone at the top as the landing page doesnt work, and putting it below the Java/Scala quickstarts doesnt work. But people using both languages need the same installation instructions, so I ended up putting it in both |
We can just include a link to the same page in both sections, so we don't need the 3 files. PS: I fixed some adoc includes |
I can convert it to a link I wonder if there's some way to make asciisoc fail loudly if includes are not found. I find it very error prone looking for broken includes in the generated html |
I meant to revert to a single
I agree. I can ask @mojavelinux ... |
Having the same page twicenin the adoc doesnt work because they are the same page, so regardless of whether you go to the Java or Scala version the |
Ah, I didn't thought about the "next" button, which I use seldomly. It makes sense now. |
I only found the I opened a question: https://asciidoctor.zulipchat.com/#narrow/stream/279642-users/topic/Make.20including.20a.20missing.20file.20a.20failure |
After my latest push, we now fail if xrefs or includes can't be resolved. |
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.
This file looks like a copy of Builtin_Commands.adoc
and has some Scala mentions, for example in the init
command. We should either share/include the identical content, or adapt it further.
---- | ||
> mill -i init com-lihaoyi/mill-scala-hello.g8 | ||
.... | ||
A minimal Scala project. | ||
|
||
name [Scala Seed Project]: hello | ||
|
||
Template applied in ./hello | ||
---- |
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.
We should rather provide a minimal Java skeleton project.
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'm going to remove the init
portion of this doc for now I think. I'd like to overhaul it at some point later to make it accept the various example projects as templates, but that can come in a follow up PR
Co-authored-by: Tobias Roeser <le.petit.fou@web.de>
Co-authored-by: Tobias Roeser <le.petit.fou@web.de>
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.
Looks good to me. Let's welcome Java developers!
Going to cut a 0.11.9 just to ensure the code is up to date with the docs |
Most of the functionality necessary to support Java projects is already there, what's missing is a proper documentation and onboarding experience. This PR aims to make a first pass at writing that and setting up the supporting tooling necessary to do so. A Java programmer should be able to land on
Introduction to Mill for Java
, read through it, and competently make use of Mill for their Java project even without significant Scala expertise.Since the Scala and Java modules are pretty tied together via Zinc, for now I decided to avoid trying to split out a proper
javalib
module and left everything in place insidescalalib
. Instead, I defined apackage object javalib
with a bunch of aliases pointing at the variousscalalib
functionality; this should give us the UX benefits of letting usersimport javalib._
, without needing to invasively refactor the codebase. There's some tradeoff withscalalib
still appearing in stack traces etc., but for a first pass I think that's fine.I added a new set of
example/basicjava/
,javamodule
, andjavabuilds
.These are duplicates of
example/basic/
,scalamodule
, andscalabuilds
, but for Java. I implemented a janky DIYbuild
.sc templating/extension system, to allow me to share the bulk of the ascidoc between the Scala/Java versions while only specifying the differences: generally the build.sc Scala logic needs to be adapted, but the asciidoc text and the Usage command-blocks can mostly be re-used.All of the Java versions of the examples have had their Scala code ported to Java. This includes third party libraries, e.g. replacing MainArgs with ArgParse4j, Scalatags with
escapeHtml4
from apache commons text. Most of theUsage
command-blocks testing the builds are shared between the Java and Scala versions of each example, although some had to be generalized a bit, and a handful only apply to a single languageThe word "Scala" does not appear anywhere in the new documentation pages. In general, a Java programmer should be comfortable running through the docs, learning to use Mill, all without being scared off by it being a "Scala" build tool
Moved the docs for the
example/thirdparty/jimfs/
folder to the new Java Build Examples section, and added a newexample/thirdparty/commons-io/
folder to also include in those docsWith this PR, the docs have roughly the following sections:
In future, if we include Kotlin support, we can have a
Kotlin Quick Start
section next to that of the other two languages. It should be pretty easy (O(days)) to duplicate all the work I did for Java for Kotlin.Doc changes can be reviewed locally via
./mill -i docs.localPages
Pull Request: #3261