Description
Is your feature request related to a problem? Please describe.
Build tools generally provide ways to generate source files before compilation. scala-cli doesn't, it was previously mentioned it potentially could.
Describe the solution you'd like
Some way to run an arbitrary script before every compilation, probably configured in directives or by convention (i.e. putting a script in a ./scala-scripts
directory).
The interface would be basically Unit => Unit
, maybe with extra context passed as environment variables.
Some possible things I'd like to see passed:
- a way to gather all the sources used in the build (e.g.
:
-separated list of source paths) - the path to a directory where I can output files that'll be included in the compilation. Alternatively I could write to anywhere I want and these paths would be added manually in a directive. Not sure how this would work with cross-compilation.
- pwd (or something like a workspace root, in case of bsp? I don't know how exactly that protocol works though)
- build metadata (in theory I could read the directives myself, but having this passed would be much better), e.g. deps, resolved scala version, target platform)
Note that this would be triggered on IDE compilations as well.
There should be a way to customize the script beyond the runnable name. Ideas:
- Passing args within the directive, e.g.
//> build script echo foo bar
- Wrapping the script with another, and using the other script in the directive. E.g. script
echow
runsecho foo bar
, and I do//> build script echow
Unfortunately, any kind of scripts would mean that builds can't be shared via e.g. gists. Personally I'm fine with this.
Describe alternatives you've considered
Making my own build tool wrapping scala-cli :)
Additional context
Not much to write here.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status