-
Notifications
You must be signed in to change notification settings - Fork 14
Description
Currently there is no clean way for a template to import types from another template that isn't a child
proj/
├── mod1
│ └── Foo.tmpl
└── mod2
└── Bar.tmpl
Bar.tmpl should be able to reference types from Foo.tmpl with import mod1.Foo. However,
codegen -m scala -o output proj/mod1/Foo.tmpl proj/mod2/Bar.tmplwould fail with mod1.Foo not found since there is no mod1 folder in mod2 which is where codegen would look. We could resolve this two ways. One would be to compile Bar.tmpl separately from Foo.tmpl and include the mod1 folder.
codegen -m scala -o output -I proj/mod1 proj/mod2/Bar.tmplBut that would only work if Bar.tmpl had import Foo not import mod1.Foo. And that what would we do if mod2.Foo existed?
The best solution is also a silly one:
codegen -m scala -o output -I proj/ proj/mod1/Foo.tmpl proj/mod2/Bar.tmplIncluding the source files which we are compiling as though they were external sources is silly. We should just have a flag to say "compile all templates in this folder and include them all in each others scope."