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 JavaModule.mandatoryJavacOptions #3503

Merged
merged 11 commits into from
Sep 10, 2024
Merged

Add JavaModule.mandatoryJavacOptions #3503

merged 11 commits into from
Sep 10, 2024

Conversation

lefou
Copy link
Member

@lefou lefou commented Sep 10, 2024

This will hold options contributed by traits like ErrorProneModule.

Those are not propagated to the inner test traits intentionally, since those options are typically configured by other means, e.g. dedicated targets.

I also removed propagation of ScalaModule.mandatoryScalacOptions to its inner ScalaTests trait, for that same reasons and for consistence. Now all mandatory* targets don't propagate their values to inner tests.

This will hold options contributed by traits like `ErrorProneModule`.

Those are not propagated to the inner test trait intentionally, since those options are typically configured by other means, e.g. dedicated targets.
@lefou lefou marked this pull request as ready for review September 10, 2024 09:23
@lefou lefou requested a review from lihaoyi September 10, 2024 09:23
@lihaoyi
Copy link
Member

lihaoyi commented Sep 10, 2024

I think the idea sounds reasonable. Why is it called managed instead of mandatory? Should we standardize on one name?

In the past the convention was just that mandatory* were things that traits would set and end users wouldn't. Are we adding a new convention that they're also not propagated? That seems fine, but is something to be aware of (and probably should be written down somewhere)

@lefou
Copy link
Member Author

lefou commented Sep 10, 2024

I though about mandatory, but went with a different name as the main goal was to have a different propagation behavior then the preexisting mandatoryIvyDeps and mandatoryScalacOptions.

Both could be changed to no propagate (their value should still compute to the same value, which is a good indicator) too, but unfortunately, this would be a binary incompatible change and has to wait for Mill 0.13.

For the sake of consistency, I can change to mandatoryJavacOptions, although the name is even less descriptive.

@lefou
Copy link
Member Author

lefou commented Sep 10, 2024

Changed to mandatoryJavacOptions.

@lefou lefou changed the title Add JavaModule.managedJavacOptions Add JavaModule.mandatoryJavacOptions Sep 10, 2024
Copy link
Member

@lihaoyi lihaoyi left a comment

Choose a reason for hiding this comment

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

yeah the name could be improved, maybe in 0.13.0 or something. Until then we'll just have to compensate by writing really good scaladoc so people who encounter it can read what it is for

@lolgab
Copy link
Member

lolgab commented Sep 10, 2024

What if we exposed a task in JavaModule that decides how dependencies are propagated to the Tests submodules?
It could be something like:

def javacOptionsTestsPropagation: Task[Seq[String] => Seq[String]] = T.task { identity }

This way your plugin can override it to filter out the option that you don't want to propagate.

@lefou
Copy link
Member Author

lefou commented Sep 10, 2024

I think filtering options isn't my favorite go-to solution, since it's always a bit error-prone. Since we use stackable traits which can't be removed we also should take care to not add unnecessary options, which can't be easily removed. The new mandaroryJavacOptions already addresses this.

Needed to add a MiMa exclusion, which should be safe in this case.
@lefou
Copy link
Member Author

lefou commented Sep 10, 2024

I took the opportunity to no longer propagate mandatoryScalacOptions to tests, to see if all tests pass. They should. I kept the override to just call super, so that binaries expecting this def in ScalaTests should work without issues.

@lefou
Copy link
Member Author

lefou commented Sep 10, 2024

I checked, we're not propagating mandatoryIvyDeps to tests, so we now no longer propagate any mandatory* target to tests. Nice and consistent.

@lihaoyi
Copy link
Member

lihaoyi commented Sep 10, 2024

Not propagating mandatoryScalacOptions sounds fine. If the test module needs it they can inherit the trait (and often already do in cases like ScalaJs options or ScalaNative options)

@lefou lefou merged commit 4805f4b into main Sep 10, 2024
23 checks passed
@lefou lefou deleted the javac-options branch September 10, 2024 15:16
@lefou lefou added this to the 0.12.0 milestone Sep 10, 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