aboutsummaryrefslogtreecommitdiff
path: root/src/ee/tools/templates
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2019-05-27 08:52:38 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2019-05-27 08:52:38 +0200
commit0259c6f907875b54e5d1df4bc89efa1c293d2812 (patch)
treed27f62ac6eb6fc09d8e989088978d959176ca6dd /src/ee/tools/templates
parent101d17f0993795769fa125d26ceec71ccfecd057 (diff)
downloadee-python-0259c6f907875b54e5d1df4bc89efa1c293d2812.tar.gz
ee-python-0259c6f907875b54e5d1df4bc89efa1c293d2812.tar.bz2
ee-python-0259c6f907875b54e5d1df4bc89efa1c293d2812.tar.xz
ee-python-0259c6f907875b54e5d1df4bc89efa1c293d2812.zip
Adding Soufflé based reasoning on parts. Replacing default configuration
with applying python function with this new reasoner.
Diffstat (limited to 'src/ee/tools/templates')
-rw-r--r--src/ee/tools/templates/build.ninja.j238
1 files changed, 36 insertions, 2 deletions
diff --git a/src/ee/tools/templates/build.ninja.j2 b/src/ee/tools/templates/build.ninja.j2
index 6ff4e0a..894365b 100644
--- a/src/ee/tools/templates/build.ninja.j2
+++ b/src/ee/tools/templates/build.ninja.j2
@@ -30,6 +30,15 @@ rule pn-part-search-list
rule part-apply-function
command = $ee part-apply-function --execution $execution --in $in --out $out $functions $arguments
+rule part-apply-souffle-pre
+ command = $ee part-apply-souffle-pre --in $in --work $work
+
+rule souffle
+ command = souffle -F $work/in -D $work/out -I $work -I "{{ souffle_ee_src }}" $in
+
+rule part-apply-souffle-post
+ command = $ee part-apply-souffle-post --in $in_sch --out $out --work $work
+
rule part-find-requirements
description = part-find-requirements
command = $ee part-find-requirements --in $in --out $out $report
@@ -74,8 +83,9 @@ build {{ gerber_zip }}: kicad-gerber $pcb
{% 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
+build ee/kicad/sch.xml: kicad-make-bom $sch
+{#
+build ee/sch.xml: part-apply-function ee/kicad/sch.xml
execution = kicad
{%- if cfg and "functions" in cfg and cfg["functions"] %}
functions = --function {{ cfg["functions"] }}
@@ -83,6 +93,17 @@ build ee/sch.xml: part-apply-function ee/kicad-sch.xml
{%- if cfg and "function-arguments" in cfg and cfg["function-arguments"] %}
arguments = --argument {{ cfg["function-arguments"] }}
{%- endif %}
+#}
+
+build ee/kicad/souffle/facts.dl: part-apply-souffle-pre ee/kicad/sch.xml
+ work = ee/kicad/souffle
+
+build ee/kicad/souffle/out/fact.csv: souffle {{ souffle_ee_src }}/kicad.dl | ee/kicad/souffle/facts.dl
+ work = ee/kicad/souffle
+
+build ee/sch.xml: part-apply-souffle-post ee/kicad/souffle/out/fact.csv
+ in_sch = ee/kicad/sch.xml
+ work = ee/kicad/souffle
{%- endif %}
build $report_dir/part-validate-parts.rst: part-validate-parts ee/sch.xml
@@ -101,6 +122,7 @@ build ee/{{ s }}/pn-part-search-list.xml: pn-part-search-list ee/sch.xml
build ee/{{ s }}/downloaded.xml | ee/{{ s }}/downloaded.rst: {{ s }}-search-parts ee/{{ s }}/pn-part-search-list.xml
{%- set reports=reports+["$report_dir/" + s + "/downloaded.rst"] %}
+{#
build ee/{{ s }}/parts.xml: part-apply-function ee/{{ s }}/downloaded.xml
execution = {{ s }}
{%- if cfg and "functions" in cfg and cfg["functions"] %}
@@ -109,6 +131,16 @@ build ee/{{ s }}/parts.xml: part-apply-function ee/{{ s }}/downloaded.xml
{%- if cfg and "function-arguments" in cfg and cfg["function-arguments"] %}
arguments = --argument {{ cfg["function-arguments"] }}
{%- endif %}
+#}
+build ee/{{ s }}/souffle/facts.dl: part-apply-souffle-pre ee/{{ s }}/downloaded.xml
+ work = ee/{{ s }}/souffle
+
+build ee/{{ s }}/souffle/out/fact.csv: souffle {{ souffle_ee_src }}/{{ s }}.dl | ee/{{ s }}/souffle/facts.dl
+ work = ee/{{ s }}/souffle
+
+build ee/{{ s }}/parts.xml: part-apply-souffle-post ee/{{ s }}/souffle/out/fact.csv
+ in_sch = ee/{{ s }}/downloaded.xml
+ work = ee/{{ s }}/souffle
{%- endfor %}
{%- for f in parts_yaml_files %}
@@ -149,3 +181,5 @@ build ee/seeed/opl/{{ opl }}.xml: seeed-download-opl
# Reports
build ee-reports: phony {{ " ".join(reports) }}
+build part-dbs: phony {%- for p in part_dbs %} {{ p }}.xml{% endfor %}
+build ee-all: phony ee-reports part-dbs