Generate website assets through dune

This commit is contained in:
Louis Gesbert 2022-08-01 19:29:34 +02:00
parent 1dbcc31599
commit c964495c59
7 changed files with 40 additions and 22 deletions

View File

@ -247,9 +247,8 @@ run_french_law_library_benchmark_js: build_french_law_library_js
$(MAKE) -C $(FRENCH_LAW_JS_LIB_DIR) bench
#> build_french_law_library_js : Builds the JS version of the OCaml French law library
build_french_law_library_js: generate_french_law_library_ocaml format
dune build $(FRENCH_LAW_OCAML_LIB_DIR)/api_web.bc.js
cp -f $(ROOT_DIR)/_build/default/$(FRENCH_LAW_OCAML_LIB_DIR)/api_web.bc.js $(FRENCH_LAW_JS_LIB_DIR)/french_law.js
build_french_law_library_js:
dune build $(FRENCH_LAW_JS_LIB_DIR)/french_law.js
#> build_french_law_library_web_api : Builds the web API of the French law library
build_french_law_library_web_api: build_french_law_library_js generate_french_law_json_schemas
@ -335,14 +334,14 @@ tests/%: .FORCE
# Website assets
##########################################
grammar.html: $(COMPILER_DIR)/surface/parser.mly
obelisk html -o $@ $<
WEBSITE_ASSETS = grammar.html catala.html
catala.html: $(COMPILER_DIR)/utils/cli.ml
dune exec $(COMPILER_DIR)/catala.exe -- --help=groff | groff -P -l -P -r -mandoc -Thtml > $@
$(addprefix _build/default/,$(WEBSITE_ASSETS)):
dune build $@
#> website-assets : Builds all the assets necessary for the Catala website
website-assets: js_build literate_examples grammar.html catala.html build_french_law_library_web_api doc
website-assets: js_build literate_examples build_french_law_library_web_api doc
dune build $(WEBSITE_ASSETS)
##########################################
# Misceallenous
@ -387,10 +386,12 @@ help_catala:
##########################################
# Special targets
##########################################
.PHONY: inspect clean all literate_examples english allocations_familiales \
pygments install build_dev build doc format dependencies \
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
.PHONY: inspect clean all literate_examples english allocations_familiales \
pygments install build_dev build doc format dependencies \
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 \
build_french_law_library_js build_french_law_library_web_api \
build_french_law_library_ocaml

View File

@ -38,6 +38,11 @@
(merge_into parser)
(flags --external-tokens Tokens --table --explain))
(rule
(target grammar.html)
(action
(run obelisk html -o %{target} %{dep:parser.mly})))
(documentation
(package catala)
(mld_files surface))

14
dune
View File

@ -2,13 +2,23 @@
(data_only_dirs tests syntax_highlighting)
(copy_files compiler/surface/grammar.html)
(rule
(action
(with-stdout-to
catala.html
(pipe-stdout
(run catala --help=groff)
(run groff -P -l -P -r -mandoc -Thtml)))))
(alias
(name exec)
(deps compiler/catala.exe build_system/clerk.exe))
(rule
(alias runtest)
(package clerk)
(package catala)
(deps
(source_tree tests))
(action
@ -16,7 +26,7 @@
(rule
(alias runtest)
(package clerk)
(package catala)
(deps
(source_tree examples))
(action

View File

@ -1 +1 @@
(dirs ocaml)
(dirs js ocaml)

4
french_law/js/dune Normal file
View File

@ -0,0 +1,4 @@
(rule
(mode promote)
(action
(copy ../ocaml/api_web.bc.js french_law.js)))

View File

@ -21,8 +21,8 @@ rsync $BUILD/examples/us_tax_code/us_tax_code.html $1/
rsync $BUILD/examples/tutorial_en/tutorial_en.html $1/
rsync $BUILD/examples/tutoriel_fr/tutoriel_fr.html $1/
rsync grammar.html $1/
rsync catala.html $1/
rsync $BUILD/grammar.html $1/
rsync $BUILD/catala.html $1/
rsync $BUILD/french_law/js/french_law.js $1/french_law.js
rsync $BUILD/examples/allocations_familiales/allocations_familiales_schema.json $1/

View File

@ -1,4 +1,2 @@
(dirs jsoo ocaml)
(documentation
(package catala))