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 .mill.sc as an alternative file extension to .mill #3461

Merged
merged 64 commits into from
Sep 5, 2024

Conversation

lihaoyi
Copy link
Member

@lihaoyi lihaoyi commented Sep 4, 2024

Took a bit of fiddling because we had to stop using os.Path#ext because it only takes the last segment, and also now one of the extensions is a suffix of another. There will likely be a short tail of bugs that arise because of this, but it shouldn't be too burdensome to resolve them. Otherwise this functionality should be relatively cheap to add and maintain since we already have the extensions and file names centralized in CodeGenConstants.java.

This is a compromise between .mill and .mill.sc. I still believe long term .mill is better, but I can believe that short term pain of having everything not understand your .mill extensions is painful. This lets people use .mill.sc where preferable, and .mill otherwise by default. I expect long term .mill will be superior once all the tooling has caught up, but until then people can use .mill.sc if they want the generic .sc Scala script support that many tools use.

Having two extensions isn't that unusual, e.g. Bazel supports both BUILD and BUILD.bazel as file extenions, supported indefinitely. The cost of adding two extensions isn't significantly more than the cost of adding one: in any case we need to send PRs to the various tools, and a PR adding two extensions isn't any more difficult than a PR adding one.

Added an example test 13-helper-files-mill-sc, variant of 11-helper-files, which should exercise most of the file discovery/import/codegen/etc. logic that may be impacted by the extension

@lihaoyi lihaoyi requested a review from lefou September 4, 2024 14:49
Copy link
Member

@lefou lefou left a comment

Choose a reason for hiding this comment

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

Kudos for being open to support .mill.sc as an alternative extension to .mill!

Having the alternative is probably not ideal and will cause friction since projects will eventually encounter contributors preferring the other version. But we're still experimenting, so it's good to keep any bit of editor support we can get.

@lihaoyi lihaoyi marked this pull request as ready for review September 4, 2024 21:07
@lihaoyi
Copy link
Member Author

lihaoyi commented Sep 5, 2024

My attempts to deal with CI flakiness have gotten a bit out of hand, but hopefully I'll be able to stabilize this enough to get a solid green build

@lihaoyi lihaoyi merged commit 75b7cfa into com-lihaoyi:main Sep 5, 2024
25 checks passed
@lihaoyi lihaoyi added this to the 0.12.0-RC1 milestone Sep 5, 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.

2 participants