generator_lib.py: Add support for importing templates in templates

Previously importing template with {% include %} or {% from %} would
cause issue with the integration with the build system because
generator_lib.py wouldn't know which additional template files to add as
dependencies to the generator task.

Change get_file_renders into get_outputs that return both a list of
FileRenders and a list of templates that will be imported. Use that new
list both in the dependency information of the build systems, and as an
allow list in the PreprocessingLoader (so we don't forget to add new
imported templates in the future).

Fixed: 352690884
Change-Id: I9d63a209d8c82405dec16c8f5baf8b1538cf2760
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/198254
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
diff --git a/generator/dawn_version_generator.py b/generator/dawn_version_generator.py
index 8898c8c..7e2bc8c 100644
--- a/generator/dawn_version_generator.py
+++ b/generator/dawn_version_generator.py
@@ -28,7 +28,7 @@
 
 import os, subprocess, sys, shutil
 
-from generator_lib import Generator, run_generator, FileRender
+from generator_lib import Generator, run_generator, FileRender, GeneratorOutput
 
 def get_git():
     # Will find git, git.exe, git.bat...
@@ -147,13 +147,14 @@
                 return []
         return []
 
-    def get_file_renders(self, args):
+    def get_outputs(self, args):
         params = compute_params(args)
 
-        return [
+        renders = [
             FileRender("dawn/common/Version.h",
                        "src/dawn/common/Version_autogen.h", [params]),
         ]
+        return GeneratorOutput(renders=renders, imported_templates=[])
 
 
 if __name__ == "__main__":