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 possibility for scripts to define dependency on other scala files #1146

Closed
Kordyjan opened this issue Jun 30, 2022 · 1 comment · Fixed by #1157
Closed

Add possibility for scripts to define dependency on other scala files #1146

Kordyjan opened this issue Jun 30, 2022 · 1 comment · Fixed by #1157
Assignees

Comments

@Kordyjan
Copy link

Is your feature request related to a problem? Please describe.

The problem occurred for me when I was migrating a big pile of simple bash scripts to scala-cli.

I have multiple *.sc files, each with scala-cli in shebang, so I can just call them the same way I call bash scripts (just scripts/buildBase.sc) . I also want to have utils.scala file with common definitions for all the scripts. It is not possible to include the utils without needing to specify them explicitly every time I call a script.

scala-cli scripts/buildBase.sc scripts/utils.scala is rather long in comparison with scripts/buildBase.sc.

Describe the solution you'd like

I would like to be able to specify something like //> using file "utils.scala" which would add utils file to the classpath every time I compile and run my script.

Describe alternatives you've considered

I'm now calling my scripts using scala-cli scripts --main-class buildBase_sc. This is not elegant. Also, It loads dozens of scripts on classpath which may result in some unexpected problems in rare cases.

Additional context

In bash, the user is able to just source other scripts. The necessity of specifying each scala dependency on every script invocation may discourage people from migrating scripts from bash to scala.

@prolativ
Copy link

This might be considered as a use case for #1098

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 a pull request may close this issue.

3 participants