Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is an old PoC for implementing source generators that was supposed to use Bloops capability to run an arbitrary command that would generate the sources.
Bloop.Project.sourceGenerators accepts a list of objects of this shape:
SourceGenerator(sourcesGlobs: List[SourcesGlobs], outputDirectory: PlatformFiles.Path, command: List[String])
By quickly looking at Bloop's code the command gets created like this:
(command :+ outputDirectory.syntax) ++ inputs.keys.map(_.syntax)
, where the inputs are the results of applying sourceGlobsSo trying to work with this, I wanted to run
scala-cli
command on a small app that usesdep "com.thesamet.scalapb::scalapbc:0.11.13"
, which would generate the sources before Bloop's compilation would run.Unfortunately this didn't work, I recall that the command never managed to generate sources even though Bloop would run it (I think). Probably there was a problem with the command also calling Bloop.
I thought about a while ago and IMO for it to work we would need to first build the generator app (potentially without Bloop) and pass the run command to Bloop (sth like
java --cp jar1:jar2:scalapbc-jar MainClass outputDir sourceArg1 sourceArg2 ...
We already do similar stuff in our Run command.
Off the top of my head this generator app could also be released to maven, but I don't see any problems in hardcoding it in our sources.
Additionally I think the easiest way would be to rework the Bloop API to allow more flexibility e.g. for calling ScalaPBC's main without the generator-app from
gen.scala
as it effectively just shuffles arguments around.