Skip to content

Commit

Permalink
Don't let dune forget html pages (#153)
Browse files Browse the repository at this point in the history
  • Loading branch information
Keryan-dev authored Jun 14, 2024
1 parent 23de080 commit 4c4968d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 24 deletions.
27 changes: 16 additions & 11 deletions examples/configure.ml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ let has_jsoo =
maj > 3 || maj = 3 && min >= 6
with _ -> false

let add_executable name assets =
let htmls = ref []

let add_executable ?(custom_html=false) name assets =
if not custom_html then
htmls := (name^".html")::!htmls;
Printf.printf {|
(executable
(name %s)
Expand All @@ -27,7 +31,6 @@ let add_executable name assets =
(rule
(target %s-extfs.js)
(action (run js_of_ocaml build-fs -o %%{target} -I ../assets%t)))

|} name name (fun oc ->
List.iter (fun a ->
Printf.printf {|
Expand All @@ -39,14 +42,6 @@ let add_executable name assets =

let () =
set_binary_mode_out stdout true;
if has_jsoo then
Printf.printf {|
(rule
(target index.html)
(deps (glob_files *.js))
(action (run ./make_index/make_index.exe %%{target})))

|};
add_executable "hello" [ "frog.png" ];
add_executable "ppm_dump" [];
add_executable "arcs" [];
Expand All @@ -62,7 +57,7 @@ let () =
add_executable "spritesheet" [ "spritesheet.png" ];
add_executable "draw" [ "colors.png" ];
add_executable "window_with_textbox" [];
add_executable "suncities" [];
add_executable ~custom_html:true "suncities" [];

add_executable "demo1" [];
add_executable "demo2" [];
Expand All @@ -71,3 +66,13 @@ let () =
add_executable "demo5" [];
add_executable "demo6" [];
add_executable "saucisse" [];

if has_jsoo then
Printf.printf {|
(rule
(targets index.html %s)
(deps (glob_files *.js))
(action (run ./make_index/make_index.exe %%{targets})))

|}
(String.concat " " !htmls);
19 changes: 6 additions & 13 deletions examples/dune.inc
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@

(rule
(target index.html)
(deps (glob_files *.js))
(action (run ./make_index/make_index.exe %{target})))


(executable
(name hello)
(public_name ocaml-canvas-hello)
Expand All @@ -19,7 +13,6 @@
(action (run js_of_ocaml build-fs -o %{target} -I ../assets
frog.png:/static/assets/)))


(executable
(name ppm_dump)
(public_name ocaml-canvas-ppm_dump)
Expand Down Expand Up @@ -83,7 +76,6 @@
fabric.png:/static/assets/
dragon.png:/static/assets/)))


(executable
(name aim_with_mouse)
(public_name ocaml-canvas-aim_with_mouse)
Expand All @@ -106,7 +98,6 @@
(action (run js_of_ocaml build-fs -o %{target} -I ../assets
dragon.png:/static/assets/)))


(executable
(name hexagon_grid)
(public_name ocaml-canvas-hexagon_grid)
Expand All @@ -121,7 +112,6 @@
(action (run js_of_ocaml build-fs -o %{target} -I ../assets
hexagon.png:/static/assets/)))


(executable
(name ball)
(public_name ocaml-canvas-ball)
Expand All @@ -136,7 +126,6 @@
(action (run js_of_ocaml build-fs -o %{target} -I ../assets
dragon.png:/static/assets/)))


(executable
(name spritesheet)
(public_name ocaml-canvas-spritesheet)
Expand All @@ -151,7 +140,6 @@
(action (run js_of_ocaml build-fs -o %{target} -I ../assets
spritesheet.png:/static/assets/)))


(executable
(name draw)
(public_name ocaml-canvas-draw)
Expand All @@ -166,7 +154,6 @@
(action (run js_of_ocaml build-fs -o %{target} -I ../assets
colors.png:/static/assets/)))


(executable
(name window_with_textbox)
(public_name ocaml-canvas-window_with_textbox)
Expand Down Expand Up @@ -238,3 +225,9 @@
(modules saucisse)
(libraries ocaml-canvas react))


(rule
(targets index.html saucisse.html demo6.html demo5.html demo4.html demo3.html demo2.html demo1.html window_with_textbox.html draw.html spritesheet.html ball.html hexagon_grid.html clipping.html aim_with_mouse.html compositions.html dashing_line.html thicklines.html snake.html gradients.html arcs.html ppm_dump.html hello.html)
(deps (glob_files *.js))
(action (run ./make_index/make_index.exe %{targets})))

0 comments on commit 4c4968d

Please sign in to comment.