Skip to content

//> using exclude does not work when excluded dir has project.scala #3546

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

Open
bishabosha opened this issue Mar 7, 2025 · 1 comment · May be fixed by #3613
Open

//> using exclude does not work when excluded dir has project.scala #3546

bishabosha opened this issue Mar 7, 2025 · 1 comment · May be fixed by #3613
Labels
--exclude Issues tied with the excluding inputs. bug Something isn't working

Comments

@bishabosha
Copy link
Contributor

bishabosha commented Mar 7, 2025

The symptom: //> using exclude foo does not stop scanning inside of foo, so if foo contains project.scala with directives, then it will evaluate the directives in foo/project.scala and even try to compile code.

(when i remove foo/project.scala then code compilation is excluded in foo as expected)

Here was an initial idea for a solution:

well, i would assume exclude should tell scala-cli to never even look inside that directory. Currently (if the excluded subdirectory has project.scala) it will try to typecheck my scala code in that subdirectory - and check using directives (such as reporting unresolvable library dependencies).

I would imagine the solution being an ahead of time scan for exclude before evaluating other settings/running compiler.

if that is too complex or performance sensitive - then perhaps warn about these semantics in the documentation

Originally posted by @bishabosha in #3385

@Gedochao Gedochao added bug Something isn't working --exclude Issues tied with the excluding inputs. labels Mar 7, 2025
@bishabosha
Copy link
Contributor Author

bishabosha commented Apr 3, 2025

So during the Scala tooling spree - @MaciejG604 pointed me towards CrossSources.scala, and the culprit is "finding first project.scala file in flattened inputs" - which often is likely this nested project that should be excluded.

The solution is instead to find the most-outer project file

@bishabosha bishabosha linked a pull request Apr 3, 2025 that will close this issue
bishabosha added a commit to bishabosha/scala-cli that referenced this issue Apr 3, 2025
pick the outermost project file, so that if an excluded directory
is itself a scala-cli project then it is ignored.

fixes VirtusLab#3546
bishabosha added a commit to bishabosha/scala-cli that referenced this issue Apr 3, 2025
pick the outermost project file, so that if an excluded directory
is itself a scala-cli project then it is ignored.

fixes VirtusLab#3546
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
--exclude Issues tied with the excluding inputs. bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants