diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2019-04-30 22:37:29 +0200 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2019-04-30 22:37:29 +0200 |
commit | 2a48664afc5f634157d9c383f605d0d2541ca1d9 (patch) | |
tree | b56713b30c7b7a0b76c9666d285ca6e75031ff26 /src/ee | |
parent | f8703ee3820431ec0dbff4c9e10f0cb75a4da03c (diff) | |
download | ee-python-2a48664afc5f634157d9c383f605d0d2541ca1d9.tar.gz ee-python-2a48664afc5f634157d9c383f605d0d2541ca1d9.tar.bz2 ee-python-2a48664afc5f634157d9c383f605d0d2541ca1d9.tar.xz ee-python-2a48664afc5f634157d9c383f605d0d2541ca1d9.zip |
ninja: Generate everything to 'ee.ninja', generate 'build.ninja' only if
it is missing. A stub build.ninja which includes ee.ninja will be
generated once. This makes it easier for the user to do custom stuff in
the standard Ninja file.
Diffstat (limited to 'src/ee')
-rw-r--r-- | src/ee/tools/ninja.py | 11 |
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)) |