Fix discovery of project file for exclude#3613
Fix discovery of project file for exclude#3613bishabosha wants to merge 2 commits intoVirtusLab:mainfrom
Conversation
pick the outermost project file, so that if an excluded directory is itself a scala-cli project then it is ignored. fixes VirtusLab#3546
cf6eee4 to
7b460a8
Compare
| // this relies upon the inferred workspace root being the outermost directory. | ||
| // which is the common case when you pass a single directory. | ||
| val projectScalaFileOpt = | ||
| projectScalaFileCandidates.sortBy(_.subPath.segments.size).headOption |
There was a problem hiding this comment.
while defaulting to the outermost directory doesn't sound like a bad fallback (and we can keep it as fallback), I'm thinking we should favor the project.scala which is closest to the designated workspace for the Scala CLI project - and that may not be the shortest path, actually. Especially since the workspace can be overridden with a command line option.
As in, let's say we have:
── partitionA
└── outerdir
└── actualWorkspace
└── project.scala
── partitionB
└── outerdir
└── project.scala
partitionA/outerdir/actualWorkspace/project.scala is longer than partitionB/outerdir/project.scala, but it should still be picked.
That being said your change is strictly better than what we have on main, so I'm okay with that being fixed as a follow-up.
There was a problem hiding this comment.
so closest to the workspace of Inputs?
There was a problem hiding this comment.
Yep. Just be wary that it can be overridden with --workspace.
|
@Gedochao is there a reason that the paths aren't sorted (e.g. by outermost) before inferring the workspace? ( i guess changing that would be breaking) |
No reason that I know of... It should be covered with tests, in case you want to experiment. |
pick the outermost project file, so that if an excluded directory is itself a scala-cli project then it is ignored.
result of the Scala Tooling Spree April 3 2025
fixes #3546