-
Notifications
You must be signed in to change notification settings - Fork 132
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
Omit triggering warning about directives in multple files for "//> using file ..." directives #2377
Comments
Thank you for reporting! As a quick solution You can suppress those warnings globally by using: scala-cli config suppress-warning.directives-in-multiple-files true |
Thank you for the fast response! In general, I think the ideal policy would be to retain the warning for scripts, but just omit In practice, I don't know how disruptive it might be to have to distinguish between directive types before emitting the warning, though. It might not be worth the trouble. I'm unlikely to suppress the warning globally (I think it is a good warning!). But I see that a One simple approach might be to just make the default value of Thanks again! |
For now let's try to reduce the number of warnings to one with a list of all files containing directives. Not showing the warning on As a follow up in the future we could try only report conflicting options, but that's a much harder case to solve. |
Is your feature request related to a problem? Please describe.
I'm playing with moving much of my sysadmin-ish scripting to Scala / scala-cli. I'd like to implement most of it with
shebang
style scripts.The scripts would make use of published libraries, but also local out-factorings of shared code, for which I would like to retain script-like ergonomics. For example, I might bring them into a
shebang
script with//> using file shared.scala
, and work with the imported code.This all works! The problem is just a warning:
This is in general a good warning! I can centralize nearly all of my directives in
project.scala
, and bring them in as//> using file project.scala
. So in general, my scripts can just have...and
shared.scala
can just containThe settings that describe everything other than the source set for the script can and should be centralized into
project.scala
.But I need the
//> using file ...
in multiple files. So I still have the warning.Describe the solution you'd like
The easiest solution might be just to omit
//> using file ...
from the set of directives that triggers theUsing directives detected in multiple files.
warning.//> using file ...
directives can't be centralized in that way when the entry point to the project is a script.Describe alternatives you've considered
Another approach might be an Ammonite-like or C-pre-processor-style textual include. Top-level
shebang
scripts could declare their full directive set, and shared source would be brought into a single logical file. But this seems less elegant.Additional context
Very much a work in progress, but for an example of the kind of script-set I'm trying to build, see https://github.com/swaldman/mchange-sysadmin-scripts/tree/main/taskbin
The text was updated successfully, but these errors were encountered: