aboutsummaryrefslogtreecommitdiff
path: root/src/ee/tools
diff options
context:
space:
mode:
Diffstat (limited to 'src/ee/tools')
-rw-r--r--src/ee/tools/ninja.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/ee/tools/ninja.py b/src/ee/tools/ninja.py
index 2c8a88a..ffc80c9 100644
--- a/src/ee/tools/ninja.py
+++ b/src/ee/tools/ninja.py
@@ -86,6 +86,7 @@ def generate(project: Project):
# ee_dir = sch_path.parent / "ee"
build_ninja = project.project_dir / "build.ninja"
+ ee_ninja = project.project_dir / "ee.ninja"
parts_yaml_files = [path for path in project.project_dir.iterdir() if str(path).endswith("-parts.yaml")]
params["parts_yaml_files"] = parts_yaml_files
@@ -94,7 +95,15 @@ def generate(project: Project):
part_dbs.extend([parent_dir_filter(p) / noext_filter(p) for p in parts_yaml_files])
part_dbs.extend([Path("ee") / d / "parts" for d in distributors])
- with build_ninja.open("w") as f:
+ if not build_ninja.exists():
+ with build_ninja.open("w") as f:
+ f.writelines(["# This file was generated by eetools. Add your own rules and build commands\n",
+ "# here, but keep the include line as we'll update ee.ninja for you when your\n",
+ "# configuration changes\n",
+ "\n",
+ "include ee.ninja\n"])
+
+ with ee_ninja.open("w") as f:
env = _create_env()
template = env.get_template("build.ninja.j2")
f.write(template.render(**params))