Skip to content

Commit

Permalink
Use dune-site to locate backends (partial).
Browse files Browse the repository at this point in the history
Signed-off-by: Karolis Petrauskas <k.petrauskas@gmail.com>
  • Loading branch information
kape1395 committed Jun 1, 2023
1 parent 7826dec commit 9fe5a8d
Show file tree
Hide file tree
Showing 13 changed files with 49 additions and 10 deletions.
8 changes: 8 additions & 0 deletions deps/isabelle/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ $(ISABELLE_DIR).sexp: $(ISABELLE_TGZ)
cd $(ISABELLE_DIR) && echo "ISABELLE_OUTPUT=$(ISABELLE_OUT)" >> etc/settings
cd $(ISABELLE_DIR) && cp -r $(DUNE_SOURCEROOT)/isabelle src/TLA+
cd $(ISABELLE_DIR)/src/TLA+ && $(ISABELLE_EXE) usedir -b Pure TLA+
# ...
# TODO: Workaround BEGIN, until https://github.com/ocaml/dune/issues/7831 is resolved.
# Here we remove symlinks to directories, because dune install fails on them for now.
cd $(ISABELLE_DIR) && rm ./contrib/jre1.6.0_27_x86-linux/jre1.6.0_27/man/ja
cd $(ISABELLE_DIR) && rm ./contrib/polyml-5.4.0/src
cd $(ISABELLE_DIR) && rm ./contrib/polyml && mv ./contrib/polyml-5.4.0 ./contrib/polyml
# TODO: Workaround END
#
(echo "(" && (find $(ISABELLE_DIR) -type f) && echo ")") > $(ISABELLE_DIR).sexp

.PHONY: all
7 changes: 3 additions & 4 deletions deps/isabelle/dune
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

(data_only_dirs Isabelle)

; TODO: Blocked by <https://github.com/ocaml/dune/issues/7831>
; (install
; (section lib)
; (dirs "Isabelle"))
(install
(section (site (tlapm backends)))
(dirs "Isabelle"))
2 changes: 1 addition & 1 deletion deps/ls4/dune
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
(action (run "make" "-C" "." "ls4")))

(install
(section libexec)
(section (site (tlapm backends)))
(files (ls4 as bin/ls4)))
2 changes: 1 addition & 1 deletion deps/z3/dune
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
(action (run "make" "-C" "." "z3")))

(install
(section libexec)
(section (site (tlapm backends)))
(files (z3 as bin/z3)))
2 changes: 1 addition & 1 deletion deps/zenon/dune
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
(action (run "make" "-C" ".")))

(install
(section libexec)
(section (site (tlapm backends)))
(files (zenon as bin/zenon)))
3 changes: 3 additions & 0 deletions dune-project
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
(lang dune 3.7)

(using dune_site 0.1)

(using directory-targets 0.1)

(name tlapm)
Expand All @@ -12,4 +14,5 @@
(name tlapm)
(synopsis "TLA+ Proof Manager")
(description "TLA+ Proof Manager")
(sites (lib backends)) ; will contain all the provers, approx lib/tlapm/backends/.
(depends ocaml dune))
9 changes: 7 additions & 2 deletions src/.depend
Original file line number Diff line number Diff line change
Expand Up @@ -663,15 +663,13 @@ proof/p_visit.cmo: proof/p_visit.mlt \
proof/p_t.cmi \
util/ext.cmi \
expr.cmi \
errors.cmi \
util/deque.cmi \
proof/p_visit.cmi
proof/p_visit.cmx: proof/p_visit.mlt \
util/property.cmx \
proof/p_t.cmx \
util/ext.cmx \
expr.cmx \
errors.cmx \
util/deque.cmx \
proof/p_visit.cmi
proof/p_gen.cmo: proof/p_gen.mlt \
Expand Down Expand Up @@ -1836,6 +1834,10 @@ module.cmx: module.mlt \
module/m_elab.cmx \
module/m_dep.cmx \
module.cmi
dune_site_mock/setup_paths.cmo: dune_site_mock/setup_paths.mlt \
dune_site_mock/setup_paths.cmi
dune_site_mock/setup_paths.cmx: dune_site_mock/setup_paths.mlt \
dune_site_mock/setup_paths.cmi
tlapm_args.cmo: tlapm_args.mlt \
version.cmi \
params.cmi \
Expand All @@ -1857,6 +1859,7 @@ tlapm.cmo: tlapm.mlt \
tlapm_args.cmi \
tla_parser.cmi \
util/timing.cmi \
dune_site_mock/setup_paths.cmi \
backend/schedule.cmi \
util/property.cmi \
proof.cmi \
Expand All @@ -1882,6 +1885,7 @@ tlapm.cmx: tlapm.mlt \
tlapm_args.cmx \
tla_parser.cmx \
util/timing.cmx \
dune_site_mock/setup_paths.cmx \
backend/schedule.cmx \
util/property.cmx \
proof.cmx \
Expand Down Expand Up @@ -2217,5 +2221,6 @@ module.cmi : \
expr.cmi \
util/deque.cmi \
ctx.cmi
dune_site_mock/setup_paths.cmi :
tlapm_args.cmi :
tlapm.cmi :
2 changes: 2 additions & 0 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,12 @@ MODULES = \
backend \
${MODULE_PACK} \
module \
dune_site_mock/setup_paths \
tlapm_args \
tlapm

INC0 = \
-I ../dune_site_mock \
-I ../backend \
-I ../frontend \
-I ../expr \
Expand Down
9 changes: 8 additions & 1 deletion src/dune
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
(executable
(name tlapm)
(public_name tlapm)
(libraries unix str)
(modules (:standard setup_paths))
(libraries unix str dune-site)
(foreign_stubs (language c) (names sysconf_stubs)))

(ocamllex alexer)

(generate_sites_module
(module setup_paths)
(sites tlapm))

(dirs (:standard \ dune_site_mock)) ; To avoid including the mocked Setup_paths module.

(include_subdirs unqualified)

(env
Expand Down
4 changes: 4 additions & 0 deletions src/dune_site_mock/setup_paths.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

module Sites = struct
let backends : string list = []
end
4 changes: 4 additions & 0 deletions src/dune_site_mock/setup_paths.mli
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

module Sites: sig
val backends : string list
end
3 changes: 3 additions & 0 deletions src/dune_site_mock/setup_paths.mlt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(*
* Copyright (C) 2008-2013 INRIA and Microsoft Corporation
*)
4 changes: 4 additions & 0 deletions src/tlapm.ml
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,10 @@ let init () =
end;
exit 3

let () = (* TODO: Handle it properly. *)
let x = Setup_paths.Sites.backends in
let _ = List.map (fun u -> (Printf.printf "TODO: path=%s\n" u)) x in
Printf.printf("TODO: paths printed.\n")

exception Stacktrace;;

Expand Down

0 comments on commit 9fe5a8d

Please sign in to comment.