-
-
Notifications
You must be signed in to change notification settings - Fork 354
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
Set correct mill home path. #1334
Conversation
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.
Thank you for pointing out the issue (on gitter) and providing a fix.
It's a bit hard to spot the real change between all these formatting changes. I can see that you just applied the project default formatting, so this is ok. Maybe next time, you can keep functional changes in a separate commit. Anyways, I think we have a special situation here.
Ammonite and mill uses the same commandline parser (mainargs
). Mill re-uses the ammonite core configuration part, which is IMHO far from optimal but at least helps to avoid code duplication.
The issue which you are trying to fix here is that the ammonite home directory is not properly set to $HOME/.mill/ammonite
(since the last command-line parser refactoring in mill). This means, we use the $HOME/.ammonite
directory, which is the default for ammonite.
Unfortunately, you introduce a new issue with your fix. When a user decides to override ammonite home with --home
command line option, this switch will be reset to mills default right after parsing.
Without further studying the mainargs
API, I think the only option we have is to check whether the config value contains the ammonite default value (ammonite.main.Defaults.ammoniteHome
) and only then reset it to mills default (mill.api.Ctx.defaultHome
). But even then, we miss the case, where the user wishes to set it explicitly to $HOME/.ammonite
.
So, unless there is some better way to apply default values in mainargs
, there is no proper solution. At least not if we try to reuse the ammonite config class for parsing.
What is the reason that we use |
I don't know, but it's IMHO good design to not pollute the state / cache area of another application. Although mill scripts are technically ammonite scripts, they are executed in a different context. Using a different cache area reduces the chance of a conflict and gives the user more control. |
Well, the simple solution would probably be to just add a |
Yeah, that might work, but I hope it fails for consistency reasons, as ammonite |
Tested it and it seemed to work fine adding the home arg to the |
Just to clarify. After your PR:
Is that all correct? |
I have used the creation of the runtime jar as the marker, by having a Docker image where
This should be consistent with your assertions. :) |
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.
Very nice. Thank you for this pull request!
No description provided.