scalameta / scalagen

WIP - Scalameta powered code generation
Apache License 2.0
40 stars 5 forks source link

Generator discovery #53

Open DavidDudson opened 6 years ago

DavidDudson commented 6 years ago

This will be the main task for 0.2

Basically, I would like the following....

- src
 |- gen
   |-scala 

To contain generators....

The idea I have is the following.

  1. Use scalameta semanticDB with semanticdb attached to compile a list of generators and their fully qualified names
    • This will allow us to synthetically generate the name parameter of all generators
    • The generator will then look something like object HelloWorld extends Generator
  2. Synthetically generate an object with a method that takes a single Term.Select and returns a generator
  3. Compile the generator sourceset into a jar.
  4. Allow a list of "generator dependencies" which are dependencies available to sbt, as well as compile.
  5. Create a larger map which is the composition of all generator libraries
  6. Use the larger maps keyset to list all available generators, use it's apply method to retrieve generators
  7. Run expansion