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

More robust configuration of unmanagedSourceDirectories #659

Closed
wants to merge 1 commit into from

Conversation

armanbilge
Copy link
Member

@armanbilge armanbilge commented Nov 6, 2023

Previously, we were forgetting to configure scala-2.13+ and scala-2.12- for the non-shared directories of CrossProjects. h/t @j-mie6 for reporting.

So in this PR I'm trying a strategy that is a lot dumber but simpler to implement and more robust to unusual setups. It simply looks for all the source directories that end in /scala and adds /scala-{2.12-,2.13+} variants of them.

Notably, we no longer need to know about CrossProjects at all.

Please somebody tell me this is a bad idea 😂 it feels just a little bit too hacked. But I honestly cannot think of a better way to do this, esp. when there is also the explosion of jvm-native style shared directories that also need to be considered ...

This PR also turns the settings plugin into a CrossProject so we can properly dogfood the changes.

@mergify mergify bot added the settings label Nov 6, 2023
Copy link
Collaborator

@j-mie6 j-mie6 left a comment

Choose a reason for hiding this comment

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

LGTM, I can test out a snapshot later if we want to be more safe that it works. Though it seems like we are changing the way the paths themselves are being constructed a bit, is that a problem cross-OS?

@armanbilge
Copy link
Member Author

is that a problem cross-OS?

CI passed on Windows and it exercises this code. So must be working?

@j-mie6
Copy link
Collaborator

j-mie6 commented Nov 7, 2023

is that a problem cross-OS?

CI passed on Windows and it exercises this code. So must be working?

Ok! :)

@j-mie6
Copy link
Collaborator

j-mie6 commented Nov 7, 2023

Test reveals that indeed, scala-2.13+ is only added on the jvm project build, not for native, js, shared, or any combination of js-jvm etc.

EDIT: actually, it's jvm for projectJVM, js gets it for projectJS, and native for projectNative. Not provided ever for shared, nor the composite jvm-native, etcs

@armanbilge
Copy link
Member Author

Can confirm by introspecting our own build.

sbt:sbt-typelevel> show settings/Compile/unmanagedSourceDirectories
[info] * /workspace/sbt-typelevel/settings/jvm/src/main/scala
[info] * /workspace/sbt-typelevel/settings/jvm/src/main/scala-2.12
[info] * /workspace/sbt-typelevel/settings/jvm/src/main/scala-2
[info] * /workspace/sbt-typelevel/settings/jvm/src/main/java
[info] * /workspace/sbt-typelevel/settings/jvm/src/main/scala-sbt-1.0
[info] * /workspace/sbt-typelevel/settings/jvm/src/main/scala
[info] * /workspace/sbt-typelevel/settings/jvm/src/main/scala-2.12-
[info] * /workspace/sbt-typelevel/settings/jvm/src/main/scala-2.12
[info] * /workspace/sbt-typelevel/settings/jvm/src/main/scala-2
[info] * /workspace/sbt-typelevel/settings/jvm/src/main/java
[info] * /workspace/sbt-typelevel/settings/jvm/src/main/scala-sbt-1.0
[info] * /workspace/sbt-typelevel/settings/shared/src/main/scala-2.12
[info] * /workspace/sbt-typelevel/settings/shared/src/main/scala-2
[info] * /workspace/sbt-typelevel/settings/shared/src/main/scala

@armanbilge
Copy link
Member Author

Please somebody tell me this is a bad idea 😂 it feels just a little bit too hacked

So the hack part of this, where I think it's breaking down, is that our configuration must run last after all the other source directories are configured. I don't think that's happening right now and I'm not really sure if we can guarantee that in general anyway.

This approach may be bust.

@armanbilge armanbilge marked this pull request as draft November 7, 2023 18:52
Copy link
Collaborator

@j-mie6 j-mie6 left a comment

Choose a reason for hiding this comment

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

Still needs to fix for the cross-target folders

@armanbilge
Copy link
Member Author

@armanbilge armanbilge closed this Dec 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants