Skip to content

Commit 4c4968d

Browse files
authored
Don't let dune forget html pages (#153)
1 parent 23de080 commit 4c4968d

File tree

2 files changed

+22
-24
lines changed

2 files changed

+22
-24
lines changed

examples/configure.ml

+16-11
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ let has_jsoo =
1111
maj > 3 || maj = 3 && min >= 6
1212
with _ -> false
1313

14-
let add_executable name assets =
14+
let htmls = ref []
15+
16+
let add_executable ?(custom_html=false) name assets =
17+
if not custom_html then
18+
htmls := (name^".html")::!htmls;
1519
Printf.printf {|
1620
(executable
1721
(name %s)
@@ -27,7 +31,6 @@ let add_executable name assets =
2731
(rule
2832
(target %s-extfs.js)
2933
(action (run js_of_ocaml build-fs -o %%{target} -I ../assets%t)))
30-
3134
|} name name (fun oc ->
3235
List.iter (fun a ->
3336
Printf.printf {|
@@ -39,14 +42,6 @@ let add_executable name assets =
3942

4043
let () =
4144
set_binary_mode_out stdout true;
42-
if has_jsoo then
43-
Printf.printf {|
44-
(rule
45-
(target index.html)
46-
(deps (glob_files *.js))
47-
(action (run ./make_index/make_index.exe %%{target})))
48-
49-
|};
5045
add_executable "hello" [ "frog.png" ];
5146
add_executable "ppm_dump" [];
5247
add_executable "arcs" [];
@@ -62,7 +57,7 @@ let () =
6257
add_executable "spritesheet" [ "spritesheet.png" ];
6358
add_executable "draw" [ "colors.png" ];
6459
add_executable "window_with_textbox" [];
65-
add_executable "suncities" [];
60+
add_executable ~custom_html:true "suncities" [];
6661

6762
add_executable "demo1" [];
6863
add_executable "demo2" [];
@@ -71,3 +66,13 @@ let () =
7166
add_executable "demo5" [];
7267
add_executable "demo6" [];
7368
add_executable "saucisse" [];
69+
70+
if has_jsoo then
71+
Printf.printf {|
72+
(rule
73+
(targets index.html %s)
74+
(deps (glob_files *.js))
75+
(action (run ./make_index/make_index.exe %%{targets})))
76+
77+
|}
78+
(String.concat " " !htmls);

examples/dune.inc

+6-13
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
11

2-
(rule
3-
(target index.html)
4-
(deps (glob_files *.js))
5-
(action (run ./make_index/make_index.exe %{target})))
6-
7-
82
(executable
93
(name hello)
104
(public_name ocaml-canvas-hello)
@@ -19,7 +13,6 @@
1913
(action (run js_of_ocaml build-fs -o %{target} -I ../assets
2014
frog.png:/static/assets/)))
2115

22-
2316
(executable
2417
(name ppm_dump)
2518
(public_name ocaml-canvas-ppm_dump)
@@ -83,7 +76,6 @@
8376
fabric.png:/static/assets/
8477
dragon.png:/static/assets/)))
8578

86-
8779
(executable
8880
(name aim_with_mouse)
8981
(public_name ocaml-canvas-aim_with_mouse)
@@ -106,7 +98,6 @@
10698
(action (run js_of_ocaml build-fs -o %{target} -I ../assets
10799
dragon.png:/static/assets/)))
108100

109-
110101
(executable
111102
(name hexagon_grid)
112103
(public_name ocaml-canvas-hexagon_grid)
@@ -121,7 +112,6 @@
121112
(action (run js_of_ocaml build-fs -o %{target} -I ../assets
122113
hexagon.png:/static/assets/)))
123114

124-
125115
(executable
126116
(name ball)
127117
(public_name ocaml-canvas-ball)
@@ -136,7 +126,6 @@
136126
(action (run js_of_ocaml build-fs -o %{target} -I ../assets
137127
dragon.png:/static/assets/)))
138128

139-
140129
(executable
141130
(name spritesheet)
142131
(public_name ocaml-canvas-spritesheet)
@@ -151,7 +140,6 @@
151140
(action (run js_of_ocaml build-fs -o %{target} -I ../assets
152141
spritesheet.png:/static/assets/)))
153142

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

169-
170157
(executable
171158
(name window_with_textbox)
172159
(public_name ocaml-canvas-window_with_textbox)
@@ -238,3 +225,9 @@
238225
(modules saucisse)
239226
(libraries ocaml-canvas react))
240227

228+
229+
(rule
230+
(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)
231+
(deps (glob_files *.js))
232+
(action (run ./make_index/make_index.exe %{targets})))
233+

0 commit comments

Comments
 (0)