From c94c94837bb74defa9001688ca32cbb7a8597d99 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Tue, 21 May 2019 11:00:50 +0200 Subject: ninja/init: Let init specify defaults, ninja just drops arguments if not specified. --- src/ee/tools/templates/build.ninja.j2 | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'src/ee/tools/templates') diff --git a/src/ee/tools/templates/build.ninja.j2 b/src/ee/tools/templates/build.ninja.j2 index 4d2e22f..522b010 100644 --- a/src/ee/tools/templates/build.ninja.j2 +++ b/src/ee/tools/templates/build.ninja.j2 @@ -72,18 +72,15 @@ build {{ gerber_zip }}: kicad-gerber $pcb {%- endif %} {% if sch is defined -%} +{%- set cfg = project.cfg["kicad-project"] %} build ee/kicad-sch.xml: kicad-make-bom $sch build ee/sch.xml: part-apply-function ee/kicad-sch.xml execution = kicad -{%- if project.cfg["kicad-project"]["functions"] %} - functions = --function {{ project.cfg["kicad-project"]["functions"] }} -{%- else %} - functions = --function ee.kicad.functions.default +{%- if cfg and "functions" in cfg and cfg["functions"] %} + functions = --function {{ cfg["functions"] }} {%- endif %} -{%- if project.cfg["kicad-project"]["function-arguments"] %} - arguments = --argument {{ project.cfg["kicad-project"]["function-arguments"] }} -{%- else %} - arguments = +{%- if cfg and "function-arguments" in cfg and cfg["function-arguments"] %} + arguments = --argument {{ cfg["function-arguments"] }} {%- endif %} {%- endif %} @@ -103,12 +100,10 @@ build ee/{{ s }}/downloaded.xml | ee/{{ s }}/downloaded.rst: {{ s }}-search-part build ee/{{ s }}/parts.xml: part-apply-function ee/{{ s }}/downloaded.xml execution = {{ s }} -{%- if cfg and "functions" in cfg %} +{%- if cfg and "functions" in cfg and cfg["functions"] %} functions = --function {{ cfg["functions"] }} -{%- else %} - functions = --function ee.{{ s }}.functions.default {%- endif %} -{%- if cfg and "function-arguments" in cfg %} +{%- if cfg and "function-arguments" in cfg and cfg["function-arguments"] %} arguments = --argument {{ cfg["function-arguments"] }} {%- endif %} {%- endfor %} -- cgit v1.2.3