Include generation of json_schema artifacts

(plus other small Makefile improvements)
This commit is contained in:
Louis Gesbert 2022-08-01 15:37:06 +02:00
parent 0600501ec6
commit 9db038812c
7 changed files with 62 additions and 33 deletions

View File

@ -82,11 +82,11 @@ check-promoted:
dune build @update-parser-messages @fmt dune build @update-parser-messages @fmt
compiler/surface/parser.messages: compiler/surface/tokens.mly compiler/surface/parser.mly compiler/surface/parser.messages: compiler/surface/tokens.mly compiler/surface/parser.mly
dune build @update-parser-messages --auto-promote || true -dune build @update-parser-messages --auto-promote
parser-messages: compiler/surface/parser.messages parser-messages: compiler/surface/parser.messages
format: format:
dune build @fmt --auto-promote 2>/dev/null || true -dune build @fmt --auto-promote 2>/dev/null
########################################## ##########################################
# Syntax highlighting rules # Syntax highlighting rules
@ -196,48 +196,45 @@ literate_examples: literate_allocations_familiales literate_code_general_impots
# OCaml # OCaml
#----------------------------------------- #-----------------------------------------
FRENCH_LAW_OCAML_LIB_DIR=french_law/ocaml FRENCH_LAW_OCAML_LIB_DIR = french_law/ocaml
$(FRENCH_LAW_OCAML_LIB_DIR)/law_source/allocations_familiales_api_web.ml: FRENCH_LAW_LIBRARY_OCAML = \
dune build $@ $(FRENCH_LAW_OCAML_LIB_DIR)/law_source/allocations_familiales_api_web.ml \
$(FRENCH_LAW_OCAML_LIB_DIR)/law_source/unit_tests/tests_allocations_familiales.ml \
$(FRENCH_LAW_OCAML_LIB_DIR)/law_source/aides_logement_api_web.ml
$(FRENCH_LAW_OCAML_LIB_DIR)/law_source/aides_logement_api_web.ml: $(addprefix _build/default/,$(FRENCH_LAW_LIBRARY_OCAML)) :
dune build $@
$(FRENCH_LAW_OCAML_LIB_DIR)/law_source/unit_tests/tests_allocations_familiales.ml:
dune build $@ dune build $@
#> generate_french_law_library_ocaml : Generates the French law library OCaml sources from Catala #> generate_french_law_library_ocaml : Generates the French law library OCaml sources from Catala
generate_french_law_library_ocaml: plugins \ generate_french_law_library_ocaml:
$(FRENCH_LAW_OCAML_LIB_DIR)/law_source/allocations_familiales_api_web.ml \ dune build $(FRENCH_LAW_LIBRARY_OCAML)
$(FRENCH_LAW_OCAML_LIB_DIR)/law_source/unit_tests/tests_allocations_familiales.ml \
$(FRENCH_LAW_OCAML_LIB_DIR)/law_source/aides_logement_api_web.ml
$(MAKE) format
#> build_french_law_library_ocaml : Builds the OCaml French law library #> build_french_law_library_ocaml : Builds the OCaml French law library
build_french_law_library_ocaml: generate_french_law_library_ocaml format build_french_law_library_ocaml:
dune build $(FRENCH_LAW_OCAML_LIB_DIR)/api.a dune build $(FRENCH_LAW_OCAML_LIB_DIR)/api.a
run_french_law_library_benchmark_ocaml: generate_french_law_library_ocaml run_french_law_library_benchmark_ocaml:
dune exec --profile release $(FRENCH_LAW_OCAML_LIB_DIR)/bench.exe dune exec --profile release $(FRENCH_LAW_OCAML_LIB_DIR)/bench.exe
run_french_law_library_ocaml_tests: build_french_law_library_ocaml run_french_law_library_ocaml_tests:
dune exec $(FRENCH_LAW_OCAML_LIB_DIR)/law_source/unit_tests/run_tests.exe dune exec $(FRENCH_LAW_OCAML_LIB_DIR)/law_source/unit_tests/run_tests.exe
#----------------------------------------- #-----------------------------------------
# JSON schemas # JSON schemas
#----------------------------------------- #-----------------------------------------
JSON_SCHEMAS = \
$(AIDES_LOGEMENT_DIR)/aides_logement_schema.json \
$(ALLOCATIONS_FAMILIALES_DIR)/allocations_familiales_schema.json
#> generate_french_law_json_schemas : Generates the French law library JSON schemas #> generate_french_law_json_schemas : Generates the French law library JSON schemas
generate_french_law_json_schemas: plugins $(addprefix _build/default/,$(JSON_SCHEMAS)):
CATALA_OPTS="$(CATALA_OPTS) -t" \ dune build $@
SCOPE=CalculetteAidesAuLogementGardeAlternée \
$(MAKE) -C \ generate_french_law_json_schemas:
$(AIDES_LOGEMENT_DIR) aides_logement_schema.json dune build $(JSON_SCHEMAS)
CATALA_OPTS="$(CATALA_OPTS) -t" \
SCOPE=InterfaceAllocationsFamiliales \
$(MAKE) -C \
$(ALLOCATIONS_FAMILIALES_DIR) allocations_familiales_schema.json
#----------------------------------------- #-----------------------------------------
# JS # JS
#----------------------------------------- #-----------------------------------------
@ -381,6 +378,10 @@ help_catala:
########################################## ##########################################
# Special targets # Special targets
########################################## ##########################################
.PHONY: inspect clean all literate_examples english allocations_familiales pygments \ .PHONY: inspect clean all literate_examples english allocations_familiales \
install build_dev build doc format dependencies dependencies-ocaml \ pygments install build_dev build doc format dependencies \
catala.html help parser-messages plugins dependencies-ocaml catala.html help parser-messages plugins \
generate_french_law_json_schemas generate_french_law_library_python \
generate_french_law_library_ocaml \
run_french_law_library_benchmark_python \
run_french_law_library_benchmark_js run_french_law_library_ocaml_tests

View File

@ -96,4 +96,4 @@ include .depend
clean: clean:
rm -rf $(CACHE_DIR) rm -rf $(CACHE_DIR)
rm .depend rm -f .depend

View File

@ -2,6 +2,6 @@ syntax.pdf: syntax.tex
latexmk -pdf -halt-on-error -shell-escape -pvc syntax.tex latexmk -pdf -halt-on-error -shell-escape -pvc syntax.tex
clean: clean:
latexmk -C syntax.tex latexmk -f -C syntax.tex
.PRECIOUS .SECONDARY: syntax.pdf .PRECIOUS .SECONDARY: syntax.pdf

View File

@ -10,3 +10,17 @@
-t -t
--plugin-dir=../../compiler/plugins --plugin-dir=../../compiler/plugins
aides_logement.catala_fr))) aides_logement.catala_fr)))
(rule
(targets aides_logement_schema.json)
(deps
(source_tree ..)
../../compiler/plugins/json_schema%{ext_plugin})
(action
(run
catala
json_schema
-t
--plugin-dir=../../compiler/plugins
"--scope=CalculetteAidesAuLogementGardeAltern\195\169e"
aides_logement.catala_fr)))

View File

@ -10,3 +10,17 @@
-t -t
--plugin-dir=../../compiler/plugins --plugin-dir=../../compiler/plugins
allocations_familiales.catala_fr))) allocations_familiales.catala_fr)))
(rule
(targets allocations_familiales_schema.json)
(deps
(source_tree ..)
../../compiler/plugins/json_schema%{ext_plugin})
(action
(run
catala
json_schema
-t
--plugin-dir=../../compiler/plugins
--scope=InterfaceAllocationsFamiliales
allocations_familiales.catala_fr)))

View File

@ -1,6 +1,7 @@
(rule (rule
(targets tests_allocations_familiales.ml) (targets tests_allocations_familiales.ml)
(deps (deps
(source_tree .)) (source_tree .)
../allocations_familiales.ml)
(action (action
(run catala OCaml -t tests_allocations_familiales.catala_fr))) (run catala OCaml -t tests_allocations_familiales.catala_fr)))

View File

@ -1 +0,0 @@
tests_allocations_familiales.ml