Skip to content

Commit

Permalink
Generate french_law artifacts through dune
Browse files Browse the repository at this point in the history
The files where manually generated through Makefile rules, and
versionned (with an outdated version).

The issue was that we had:
- `dune` building Catala
- Makefiles calling `catala` to build and copy the `french_law/ocaml/law_source`
  files
- then `dune` again to build `french_law`

The result was that `dune build` (without running `make` first) would
return a weird error. Also, it's better to avoid versionning artifacts
when we can.

The proposed solution adds ad-hoc dune rules to call the catala
binary, so that it can handle the whole pipeline correctly. If OCaml
is purely a backend, though, a simpler solution that makes us less
dependent on dune would be to handle the compilation of `french_law`
manually.
  • Loading branch information
AltGr committed Jul 29, 2022
1 parent 44cadac commit f8abb1c
Show file tree
Hide file tree
Showing 11 changed files with 39 additions and 53,760 deletions.
4 changes: 2 additions & 2 deletions dune
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(dirs runtimes compiler french_law build_system)
(dirs runtimes compiler french_law build_system examples)

(data_only_dirs tests examples syntax_highlighting)
(data_only_dirs tests syntax_highlighting)

(alias
(name exec)
Expand Down
11 changes: 11 additions & 0 deletions examples/aides_logement/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
(rule
(targets aides_logement.ml aides_logement_api_web.ml)
(deps
(source_tree ..))
(action
(run
catala
jsoo
-t
--plugin-dir=../../compiler/plugins
aides_logement.catala_fr)))
11 changes: 11 additions & 0 deletions examples/allocations_familiales/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
(rule
(targets allocations_familiales.ml allocations_familiales_api_web.ml)
(deps
(source_tree ..))
(action
(run
catala
jsoo
-t
--plugin-dir=../../compiler/plugins
allocations_familiales.catala_fr)))
6 changes: 6 additions & 0 deletions examples/allocations_familiales/tests/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
(rule
(targets tests_allocations_familiales.ml)
(deps
(source_tree .))
(action
(run catala OCaml -t tests_allocations_familiales.catala_fr)))
1 change: 1 addition & 0 deletions french_law/ocaml/law_source/.ocamlformat_ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*
Loading

0 comments on commit f8abb1c

Please sign in to comment.