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.tmpl
would 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.tmpl
But 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.tmpl
Including 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."
Currently there is no clean way for a template to import types from another template that isn't a child
Bar.tmplshould be able to reference types fromFoo.tmplwithimport mod1.Foo. However,would fail with
mod1.Foonot found since there is nomod1folder inmod2which is where codegen would look. We could resolve this two ways. One would be to compileBar.tmplseparately fromFoo.tmpland include themod1folder.But that would only work if
Bar.tmplhadimport Foonotimport mod1.Foo. And that what would we do ifmod2.Fooexisted?The best solution is also a silly one:
Including 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."