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

Make mill-build folder opt in via import $meta._ #2527

Merged
merged 5 commits into from
May 18, 2023

Conversation

lihaoyi
Copy link
Member

@lihaoyi lihaoyi commented May 18, 2023

Fixes #2461

For now it remains hard-coded as mill-build/, for simplicity. Given the mill- prefix, it's unlikely to collide with user-defined folders. Making it configurable would open another can of worms where the import $meta.foo can now collide with an object foo, which is very unintuitive.

For now, we just parse the script files one additional time in MillBuildBootstrap.scala. This is a bit wasteful, but is probably fast enough for now, and we're already pretty sloppy parsing everything twice in MillBuildRootModule#scriptSources and MillBuildRootModule#parseBuildFiles, so parsing things three times isn't the end of the world. We can look into optimizing it in future if necessary

@lihaoyi lihaoyi requested a review from lefou May 18, 2023 06:08
@lihaoyi lihaoyi marked this pull request as ready for review May 18, 2023 06:08
@lihaoyi
Copy link
Member Author

lihaoyi commented May 18, 2023

Seems the integration tests need to be tweaked abit since we're no longer unconditionally going through all levels of meta-builds.

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.

I think the $mill.build is a bit unfortunate. Although the $mill.build somehow corresponds to mill-build, once we want to support a custom name, it will no longer match as nice. Just because it already contains two segments.

I like the originally proposed $meta better, as it can support a custom name when given, e.g.

import $meta.`my-mill-build`

but also use the default name when used without any extra segment like

import $meta // short form of import $meta.`mill-build`.

@lihaoyi
Copy link
Member Author

lihaoyi commented May 18, 2023

import $meta isnt valid syntax, but `import $meta._' works.

@lihaoyi lihaoyi requested a review from lefou May 18, 2023 15:48
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.

Looks good to me!

@lihaoyi lihaoyi merged commit 099cc3e into com-lihaoyi:main May 18, 2023
@lefou lefou changed the title Make mill-build folder opt in via import $mill.build Make mill-build folder opt in via import $meta._ May 18, 2023
@lefou lefou added this to the 0.11.0-M9 milestone May 18, 2023
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.

Make meta builds (mill-build/build.sc) opt-in and configurable
2 participants