Skip to content

Commit

Permalink
Replace [bash] by dune's built-in [run] in rules
Browse files Browse the repository at this point in the history
- Use built-in [pipe-stdout] pipelines when appropriate
  • Loading branch information
mbarbin committed Apr 4, 2024
1 parent f96ebf2 commit e665814
Show file tree
Hide file tree
Showing 57 changed files with 273 additions and 224 deletions.
2 changes: 1 addition & 1 deletion doc/reference/dune
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
(with-stdout-to
%{target}
(pipe-stdout
(bash "%{bin:bopkit} fmt gen-dune -- \%{bin:bopkit} fmt file")
(run %{bin:bopkit} fmt gen-dune -- "\%{bin:bopkit}" fmt file)
(run dune format-dune-file)))))

(cram
Expand Down
6 changes: 3 additions & 3 deletions doc/reference/dune.inc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
(rule
(with-stdout-to
and2_recursive.bop.pp.output
(bash "%{bin:bopkit} fmt file %{dep:and2_recursive.bop}")))
(run %{bin:bopkit} fmt file %{dep:and2_recursive.bop})))

(rule
(alias fmt)
Expand All @@ -13,7 +13,7 @@
(rule
(with-stdout-to
one-of-each.bop.pp.output
(bash "%{bin:bopkit} fmt file %{dep:one-of-each.bop}")))
(run %{bin:bopkit} fmt file %{dep:one-of-each.bop})))

(rule
(alias fmt)
Expand All @@ -23,7 +23,7 @@
(rule
(with-stdout-to
parametrized-block.bop.pp.output
(bash "%{bin:bopkit} fmt file %{dep:parametrized-block.bop}")))
(run %{bin:bopkit} fmt file %{dep:parametrized-block.bop})))

(rule
(alias fmt)
Expand Down
16 changes: 10 additions & 6 deletions project/digital-watch/dune
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
(package bopkit)
watch.bop)
(action
(bash "%{bin:bopkit} simu %{dep:main.bop}")))
(run %{bin:bopkit} simu %{dep:main.bop})))

(rule
(with-stdout-to
Expand All @@ -30,8 +30,10 @@
(rule
(with-stdout-to
"watch.via-bop.output"
(bash
"%{bin:bopkit} counter -ni -N 1 -c 345600 | %{bin:bopkit} simu %{dep:watch.bop} -o | ./%{dep:remove_duplicates.exe}")))
(pipe-stdout
(run %{bin:bopkit} counter -ni -N 1 -c 345600)
(run %{bin:bopkit} simu %{dep:watch.bop} -o)
(run %{dep:remove_duplicates.exe}))))

(rule
(target watch_in_c.c)
Expand All @@ -50,8 +52,10 @@
(rule
(with-stdout-to
"watch.via-bop2c.output"
(bash
"%{bin:bopkit} counter -ni -N 1 -c 345600 | ./%{dep:watch_in_c} 345600 | ./%{dep:remove_duplicates.exe}")))
(pipe-stdout
(run %{bin:bopkit} counter -ni -N 1 -c 345600)
(run %{dep:watch_in_c} 345600)
(run %{dep:remove_duplicates.exe}))))

(rule
(alias runtest)
Expand All @@ -75,7 +79,7 @@
(with-stdout-to
%{target}
(pipe-stdout
(bash "%{bin:bopkit} fmt gen-dune -- \%{bin:bopkit} fmt file")
(run %{bin:bopkit} fmt gen-dune -- "\%{bin:bopkit}" fmt file)
(run dune format-dune-file)))))

(cram
Expand Down
6 changes: 3 additions & 3 deletions project/digital-watch/dune.inc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
(rule
(with-stdout-to
main.bop.pp.output
(bash "%{bin:bopkit} fmt file %{dep:main.bop}")))
(run %{bin:bopkit} fmt file %{dep:main.bop})))

(rule
(alias fmt)
Expand All @@ -13,7 +13,7 @@
(rule
(with-stdout-to
watch.bop.pp.output
(bash "%{bin:bopkit} fmt file %{dep:watch.bop}")))
(run %{bin:bopkit} fmt file %{dep:watch.bop})))

(rule
(alias fmt)
Expand All @@ -23,7 +23,7 @@
(rule
(with-stdout-to
watch_with_bopboard.bop.pp.output
(bash "%{bin:bopkit} fmt file %{dep:watch_with_bopboard.bop}")))
(run %{bin:bopkit} fmt file %{dep:watch_with_bopboard.bop})))

(rule
(alias fmt)
Expand Down
4 changes: 2 additions & 2 deletions project/subleq/circuit/dune
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
(glob_files *.exe)
(glob_files test/*.input))
(action
(bash "%{bin:bopkit} simu %{dep:main.bop} -parameter 'WithPulse=1'")))
(run %{bin:bopkit} simu %{dep:main.bop} -parameter 'WithPulse=1')))

(cram
(deps
Expand All @@ -52,5 +52,5 @@
(with-stdout-to
%{target}
(pipe-stdout
(bash "%{bin:bopkit} fmt gen-dune -- \%{bin:bopkit} fmt file")
(run %{bin:bopkit} fmt gen-dune -- "\%{bin:bopkit}" fmt file)
(run dune format-dune-file)))))
4 changes: 2 additions & 2 deletions project/subleq/circuit/dune.inc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
(rule
(with-stdout-to
main.bop.pp.output
(bash "%{bin:bopkit} fmt file %{dep:main.bop}")))
(run %{bin:bopkit} fmt file %{dep:main.bop})))

(rule
(alias fmt)
Expand All @@ -13,7 +13,7 @@
(rule
(with-stdout-to
subleq.bop.pp.output
(bash "%{bin:bopkit} fmt file %{dep:subleq.bop}")))
(run %{bin:bopkit} fmt file %{dep:subleq.bop})))

(rule
(alias fmt)
Expand Down
42 changes: 28 additions & 14 deletions project/visa/circuit/dune
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
(with-stdout-to
%{target}
(pipe-stdout
(bash "%{bin:visa} fmt gen-dune -- \%{bin:visa} fmt file")
(run %{bin:visa} fmt gen-dune -- "\%{bin:visa}" fmt file)
(run dune format-dune-file)))))

(rule
Expand All @@ -25,14 +25,22 @@
(with-stdout-to
%{target}
(pipe-stdout
(bash
"%{bin:bopkit} fmt gen-dune --exclude div10.bop -- \%{bin:bopkit} fmt file")
(run
%{bin:bopkit}
fmt
gen-dune
--exclude
div10.bop
--
"\%{bin:bopkit}"
fmt
file)
(run dune format-dune-file)))))

(rule
(with-stdout-to
calendar.sexp.corrected
(bash "%{bin:visa} parse %{dep:calendar.asm}")))
(run %{bin:visa} parse %{dep:calendar.asm})))

(rule
(alias runtest)
Expand All @@ -42,7 +50,7 @@
(rule
(with-stdout-to
calendar.processed.corrected
(bash "%{bin:visa} process %{dep:calendar.asm} --quiet")))
(run %{bin:visa} process %{dep:calendar.asm} --quiet)))

(rule
(alias runtest)
Expand All @@ -52,7 +60,7 @@
(rule
(with-stdout-to
calendar.bin.corrected
(bash "%{bin:visa} assemble %{dep:calendar.asm}")))
(run %{bin:visa} assemble %{dep:calendar.asm})))

(rule
(alias runtest)
Expand All @@ -62,7 +70,7 @@
(rule
(with-stdout-to
calendar.processed.bin.corrected
(bash "%{bin:visa} assemble %{dep:test/calendar.processed} --quiet")))
(run %{bin:visa} assemble %{dep:test/calendar.processed} --quiet)))

(rule
(alias runtest)
Expand All @@ -72,7 +80,7 @@
(rule
(with-stdout-to
calendar.processed.processed
(bash "%{bin:visa} process %{dep:test/calendar.processed} --quiet")))
(run %{bin:visa} process %{dep:test/calendar.processed} --quiet)))

(rule
(alias runtest)
Expand All @@ -82,7 +90,7 @@
(rule
(with-stdout-to
calendar.disassembled
(bash "%{bin:visa} disassemble %{dep:calendar.bin} --quiet")))
(run %{bin:visa} disassemble %{dep:calendar.bin} --quiet)))

(rule
(alias runtest)
Expand All @@ -105,8 +113,10 @@
initial-memory.txt
(package bopkit))
(action
(bash
"%{bin:bopkit} simu %{dep:visa.bop} -output-only-on-change | %{bin:bopkit} digital-calendar map-raw-input | %{bin:bopkit} digital-calendar display -no")))
(pipe-stdout
(run %{bin:bopkit} simu %{dep:visa.bop} -output-only-on-change)
(run %{bin:bopkit} digital-calendar map-raw-input)
(run %{bin:bopkit} digital-calendar display -no))))

(rule
(alias visa-simulation)
Expand All @@ -115,8 +125,10 @@
initial-memory.txt
(package bopkit))
(action
(bash
"%{bin:bopkit} simu %{dep:visa.bop} -output-only-on-change | %{bin:bopkit} simu %{dep:calendar-output.bop} -p | %{bin:bopkit} digital-calendar display -no")))
(pipe-stdout
(run %{bin:bopkit} simu %{dep:visa.bop} -output-only-on-change)
(run %{bin:bopkit} simu %{dep:calendar-output.bop} -p)
(run %{bin:bopkit} digital-calendar display -no))))

(rule
(target div10.txt)
Expand All @@ -125,7 +137,9 @@
(action
(with-stdout-to
%{target}
(bash "%{bin:bopkit} counter -ni -c 100 -N 7 | ./%{dep:div10.exe}"))))
(pipe-stdout
(run %{bin:bopkit} counter -ni -c 100 -N 7)
(run %{dep:div10.exe})))))

(rule
(target div10.bop)
Expand Down
2 changes: 1 addition & 1 deletion project/visa/circuit/dune.asm.inc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
(rule
(with-stdout-to
calendar.asm.pp.output
(bash "%{bin:visa} fmt file %{dep:calendar.asm}")))
(run %{bin:visa} fmt file %{dep:calendar.asm})))

(rule
(alias fmt)
Expand Down
6 changes: 3 additions & 3 deletions project/visa/circuit/dune.bop.inc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
(rule
(with-stdout-to
calendar-output.bop.pp.output
(bash "%{bin:bopkit} fmt file %{dep:calendar-output.bop}")))
(run %{bin:bopkit} fmt file %{dep:calendar-output.bop})))

(rule
(alias fmt)
Expand All @@ -13,7 +13,7 @@
(rule
(with-stdout-to
main.bop.pp.output
(bash "%{bin:bopkit} fmt file %{dep:main.bop}")))
(run %{bin:bopkit} fmt file %{dep:main.bop})))

(rule
(alias fmt)
Expand All @@ -23,7 +23,7 @@
(rule
(with-stdout-to
visa.bop.pp.output
(bash "%{bin:bopkit} fmt file %{dep:visa.bop}")))
(run %{bin:bopkit} fmt file %{dep:visa.bop})))

(rule
(alias fmt)
Expand Down
2 changes: 1 addition & 1 deletion project/visa/test/assembler/error/dune
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
(with-stdout-to
%{target}
(pipe-stdout
(bash "%{bin:visa} fmt gen-dune -- \%{bin:visa} fmt file")
(run %{bin:visa} fmt gen-dune -- "\%{bin:visa}" fmt file)
(run dune format-dune-file)))))

(cram
Expand Down
Loading

0 comments on commit e665814

Please sign in to comment.