Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion demo_ref.eliom
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ open%shared Eliom.Content.Html.F
Ocsigen Start is creating a session group for each user.
*)
let%server last_visit =
Eliom.Reference.eref ~persistent:"demo_last_visit"
Eliom.Reference.eref
~persistent:("demo_last_visit", [%json: Os.Date.local_calendar option])
~scope:Eliom.Common.default_group_scope None

(* Read & reset last_visit *)
Expand Down
28 changes: 27 additions & 1 deletion tools/gen_dune.ml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,33 @@ let handle_file_client nm =
nm nm

let () =
Array.concat (List.map Sys.readdir [".."; "../assets"])
let root = Sys.readdir ".." in
let assets = Sys.readdir "../assets" in
(* The build directory mirrors the sources but also holds generated files,
which must not be enumerated or their client rule would be emitted twice:
- .pp.eliom/.pp.eliomi: preprocessing artifacts;
- the i18n modules produced from assets/*.tsv (the .tsv already emits the
rule) and the static config produced from *.eliom.in. *)
let generated_eliom = Hashtbl.create 16 in
Array.iter
(fun nm ->
if Filename.check_suffix nm ".tsv"
then Hashtbl.replace generated_eliom (Filename.chop_suffix nm ".tsv") ())
assets;
Array.iter
(fun nm ->
if Filename.check_suffix nm ".eliom.in"
then
Hashtbl.replace generated_eliom (Filename.chop_suffix nm ".eliom.in") ())
root;
let is_generated nm =
Filename.check_suffix nm ".pp.eliom"
|| Filename.check_suffix nm ".pp.eliomi"
|| (Filename.check_suffix nm ".eliom"
&& Hashtbl.mem generated_eliom (Filename.chop_suffix nm ".eliom"))
in
Array.concat [root; assets]
|> Array.to_list |> List.sort compare
|> List.filter (fun nm -> nm.[0] <> '.')
|> List.filter (fun nm -> not (is_generated nm))
|> List.iter handle_file_client