Skip to content

Commit 39466f7

Browse files
author
Julien Blond
committed
Fixed #224: added sites managment.
It adds a `[sites]` section in packages' description. In this section, one can declare the sites like `etc = ["conf"]` which will trigger the `etc/<package>/conf` directory. As we follow the general `dune` semantic, only the following root sites are available: - `lib` - `bin` - `sbin` - `toplevel` - `share` - `etc` - `stublibs` - `doc` For `lib` and `share`, additionnal specification must be provided : ``` [[sites.lib]] root = false exec = true dir = "foo" [[sites.share]] root = true dir = "www" ``` `root` means that `<package>` subdir shall be ignored (default is `false`) and `exec` means that executable flag must be set for files installed here (ignored in `share` and default is `false`). By default, the generated dynamic sites modules is "Sites" accessible through `<package module>.Sites`. One can modify this name in `name` field : ``` [sites] name = "mysites" ``` will provide the `Mysites` module instead of `Sites`.
1 parent 61aee33 commit 39466f7

34 files changed

+807
-69
lines changed

.drom

+39-19
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ version:0.9.0
55

66
# hash of toml configuration files
77
# used for generation of all files
8-
cfa41e62814087cf2f340eab496a6542:.
8+
cfd502831bbf686b41df41219629c1c4:.
99
# end context for .
1010

1111
# begin context for .github/workflows/workflow.yml
1212
# file .github/workflows/workflow.yml
13-
533318fb1c01b0861406a644a7d9f39c:.github/workflows/workflow.yml
13+
eee26f5d13b222b48706c4fcbd98a19a:.github/workflows/workflow.yml
1414
# end context for .github/workflows/workflow.yml
1515

1616
# begin context for .gitignore
1717
# file .gitignore
18-
33c88a25e8b40f3683f6c03ec26be5db:.gitignore
18+
f7a24abcad0ba9301c03bb64464b1718:.gitignore
1919
# end context for .gitignore
2020

2121
# begin context for .ocamlformat
@@ -48,6 +48,11 @@ cfa41e62814087cf2f340eab496a6542:.
4848
9018881cf0682f4f7f262417b0d4f9ff:Makefile
4949
# end context for Makefile
5050

51+
# begin context for Makefile.drom
52+
# file Makefile.drom
53+
2b07c62bfabf8f45733eafbc696c6146:Makefile.drom
54+
# end context for Makefile.drom
55+
5156
# begin context for README.md
5257
# file README.md
5358
616ddd2660258447be65bdb664b9241d:README.md
@@ -90,7 +95,7 @@ c8281f46ba9a11d0b61bc8ef67eaa357:docs/style.css
9095

9196
# begin context for drom.toml
9297
# file drom.toml
93-
b7b7b8f4a370e3c1b425b7a9316c3e0f:drom.toml
98+
9949d65b87e55480a30122e9e77ae7d3:drom.toml
9499
# end context for drom.toml
95100

96101
# begin context for dune
@@ -100,22 +105,22 @@ e850a13c004f963e9f5a568eac93c217:dune
100105

101106
# begin context for dune-project
102107
# file dune-project
103-
47416b4e7b7e7febc8da32932cae0d54:dune-project
108+
c063288437da29a5a21e8c76c1906adc:dune-project
104109
# end context for dune-project
105110

106111
# begin context for opam/drom.opam
107112
# file opam/drom.opam
108-
d3c8882f1742f865c2987dea6c7c83e2:opam/drom.opam
113+
ff84198ff87fa46b8ac39ed2951d2d26:opam/drom.opam
109114
# end context for opam/drom.opam
110115

111116
# begin context for opam/drom_lib.opam
112117
# file opam/drom_lib.opam
113-
8b323689fcc28f9783fa85ca4a4fac55:opam/drom_lib.opam
118+
788b17212e259bbb8fe7c22c85c76d35:opam/drom_lib.opam
114119
# end context for opam/drom_lib.opam
115120

116121
# begin context for opam/drom_toml.opam
117122
# file opam/drom_toml.opam
118-
81116a1889e6414dee5c2e921961aa77:opam/drom_toml.opam
123+
e55d659410b556d7bc60183d8ff1f788:opam/drom_toml.opam
119124
# end context for opam/drom_toml.opam
120125

121126
# begin context for scripts/after.sh
@@ -130,12 +135,12 @@ d3c8882f1742f865c2987dea6c7c83e2:opam/drom.opam
130135

131136
# begin context for scripts/copy-bin.sh
132137
# file scripts/copy-bin.sh
133-
bb3a9d286f0dc64021db4194427263ee:scripts/copy-bin.sh
138+
7fe4ada2a2fc5a0ebf9a2f483679a0ae:scripts/copy-bin.sh
134139
# end context for scripts/copy-bin.sh
135140

136141
# begin context for scripts/static-build.sh
137142
# file scripts/static-build.sh
138-
2a405479b3313d79d421c2e7fc282304:scripts/static-build.sh
143+
cda3f8bad69d9c6e8cbeab1c720d739a:scripts/static-build.sh
139144
# end context for scripts/static-build.sh
140145

141146
# begin context for sphinx/_static/css/fixes.css
@@ -170,7 +175,7 @@ a44c87f3a364dd95f55427fe40b2c5d1:sphinx/about.rst
170175

171176
# begin context for src/drom/dune
172177
# file src/drom/dune
173-
efad88968955023a354f16469eb1ae15:src/drom/dune
178+
68aec4169671c0163b98bb38205d2e4d:src/drom/dune
174179
# end context for src/drom/dune
175180

176181
# begin context for src/drom/index.mld
@@ -180,7 +185,7 @@ efad88968955023a354f16469eb1ae15:src/drom/dune
180185

181186
# begin context for src/drom/linking_flags.sh
182187
# file src/drom/linking_flags.sh
183-
9a3b02ff1d99723e9ee2f3c0e97d7b30:src/drom/linking_flags.sh
188+
9fdfca3cc53df639758ff04fe09d3243:src/drom/linking_flags.sh
184189
# end context for src/drom/linking_flags.sh
185190

186191
# begin context for src/drom/main.ml
@@ -190,12 +195,12 @@ efad88968955023a354f16469eb1ae15:src/drom/dune
190195

191196
# begin context for src/drom/package.toml
192197
# file src/drom/package.toml
193-
5bdfaa2663247cad045abb018d576a5e:src/drom/package.toml
198+
bb6803d414fd5a5479ed6381914604de:src/drom/package.toml
194199
# end context for src/drom/package.toml
195200

196201
# begin context for src/drom_lib/dune
197202
# file src/drom_lib/dune
198-
a97be0d7328e7c15eb149c454844646a:src/drom_lib/dune
203+
103b365e9f24dbbae02b6be22b3efd0a:src/drom_lib/dune
199204
# end context for src/drom_lib/dune
200205

201206
# begin context for src/drom_lib/index.mld
@@ -205,17 +210,17 @@ a97be0d7328e7c15eb149c454844646a:src/drom_lib/dune
205210

206211
# begin context for src/drom_lib/package.toml
207212
# file src/drom_lib/package.toml
208-
18ae084348cbfdbb80ca1469113e0e9f:src/drom_lib/package.toml
213+
c4d6597dc5b0966758c213bfffb9d594:src/drom_lib/package.toml
209214
# end context for src/drom_lib/package.toml
210215

211216
# begin context for src/drom_lib/version.mlt
212217
# file src/drom_lib/version.mlt
213-
fc09abbaf032f775d148928fa1398cf9:src/drom_lib/version.mlt
218+
a3e5d8a00664ceaa6addf376bedf6de1:src/drom_lib/version.mlt
214219
# end context for src/drom_lib/version.mlt
215220

216221
# begin context for src/toml.7.1.0/dune
217222
# file src/toml.7.1.0/dune
218-
229a5f90ef7f812db6f3560ccb3d131f:src/toml.7.1.0/dune
223+
0841a2e47118b9fcd9b900f84ff66c34:src/toml.7.1.0/dune
219224
# end context for src/toml.7.1.0/dune
220225

221226
# begin context for src/toml.7.1.0/index.mld
@@ -230,19 +235,24 @@ d1b05207fce876a1b44a8b268bcaf226:src/toml.7.1.0/index.mld
230235

231236
# begin context for src/toml.7.1.0/package.toml
232237
# file src/toml.7.1.0/package.toml
233-
706b170edac8a3051745f05ece52fb62:src/toml.7.1.0/package.toml
238+
16c1103a2b8042862d209fc275b52f65:src/toml.7.1.0/package.toml
234239
# end context for src/toml.7.1.0/package.toml
235240

236241
# begin context for src/toml.7.1.0/version.mlt
237242
# file src/toml.7.1.0/version.mlt
238-
fc09abbaf032f775d148928fa1398cf9:src/toml.7.1.0/version.mlt
243+
a3e5d8a00664ceaa6addf376bedf6de1:src/toml.7.1.0/version.mlt
239244
# end context for src/toml.7.1.0/version.mlt
240245

241246
# begin context for test/expect-tests/dune
242247
# file test/expect-tests/dune
243248
d7e2675a767e30edf28d061c94f0ec62:test/expect-tests/dune
244249
# end context for test/expect-tests/dune
245250

251+
# begin context for test/expect-tests/dune.drom
252+
# file test/expect-tests/dune.drom
253+
6d2c689d437f17d4e99e01df3f4515c6:test/expect-tests/dune.drom
254+
# end context for test/expect-tests/dune.drom
255+
246256
# begin context for test/expect-tests/dune_
247257
# file test/expect-tests/dune_
248258
f15fedac6f43c154bcd0348b776ac08c:test/expect-tests/dune_
@@ -258,6 +268,11 @@ f15fedac6f43c154bcd0348b776ac08c:test/expect-tests/dune_
258268
a0d7baa94246a5122e55a255dcefa9d0:test/inline-tests/dune
259269
# end context for test/inline-tests/dune
260270

271+
# begin context for test/inline-tests/dune.drom
272+
# file test/inline-tests/dune.drom
273+
4cd12cd1258c38ccd44b225323601ff5:test/inline-tests/dune.drom
274+
# end context for test/inline-tests/dune.drom
275+
261276
# begin context for test/inline-tests/dune_
262277
# file test/inline-tests/dune_
263278
75d7504f9c8002ec5ccdd2458f01da09:test/inline-tests/dune_
@@ -273,6 +288,11 @@ a0d7baa94246a5122e55a255dcefa9d0:test/inline-tests/dune
273288
b5ea41e29d37e997b482b1bf7f5953d7:test/output-tests/dune
274289
# end context for test/output-tests/dune
275290

291+
# begin context for test/output-tests/dune.drom
292+
# file test/output-tests/dune.drom
293+
a3371489c9d6aee62aeba112ecfddcf0:test/output-tests/dune.drom
294+
# end context for test/output-tests/dune.drom
295+
276296
# begin context for test/output-tests/dune_
277297
# file test/output-tests/dune_
278298
28db2068920c1259cbd67a7c322730ed:test/output-tests/dune_

.github/workflows/workflow.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525

2626
include:
2727
- os: ubuntu-latest
28-
ocaml-compiler: 4.07.0
28+
ocaml-compiler: 4.08.0
2929
skip_test: true
3030

3131

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
*~
33
_build
44
.merlin
5-
.vscode
65
/_drom
76
/_opam
87
/_build

Makefile.drom

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# Maintained by "drom project"
2+
.PHONY: $(DROMNS)build $(DROMNS)build-deps $(DROMNS)fmt $(DROMNS)fmt-check
3+
.PHONY: $(DROMNS)install $(DROMNS)dev-deps $(DROMNS)test
4+
.PHONY: $(DROMNS)clean $(DROMNS)distclean
5+
6+
DROM_DEV_DEPS := merlin ocamlformat odoc ppx_expect ppx_inline_test $(DEV_DEPS)
7+
8+
9+
SPHINX_TARGET:=_drom/docs/sphinx
10+
11+
ODOC_TARGET:=_drom/docs/doc/.
12+
13+
14+
$(DROMNS)build:
15+
./scripts/before.sh build
16+
opam exec -- dune build @install
17+
./scripts/copy-bin.sh drom drom_lib drom_toml
18+
./scripts/after.sh build
19+
20+
$(DROMNS)build-deps:
21+
if ! [ -e _opam ]; then \
22+
opam switch create . 4.14.1 ; \
23+
fi
24+
opam install ./opam/*.opam --deps-only
25+
26+
27+
.PHONY: $(DROMNS)doc-common $(DROMNS)odoc $(DROMNS)view
28+
.PHONY: $(DROMNS)sphinx
29+
$(DROMNS)doc-common: $(DROMNS)build
30+
mkdir -p _drom/docs
31+
rsync -auv docs/. _drom/docs/.
32+
33+
$(DROMNS)sphinx: $(DROMNS)doc-common
34+
./scripts/before.sh sphinx ${SPHINX_TARGET}
35+
sphinx-build sphinx ${SPHINX_TARGET}
36+
./scripts/after.sh sphinx ${SPHINX_TARGET}
37+
38+
$(DROMNS)odoc: $(DROMNS)doc-common
39+
mkdir -p ${ODOC_TARGET}
40+
./scripts/before.sh odoc ${ODOC_TARGET}
41+
opam exec -- dune build @doc
42+
rsync -auv --delete _build/default/_doc/_html/. ${ODOC_TARGET}
43+
./scripts/after.sh odoc ${ODOC_TARGET}
44+
45+
$(DROMNS)doc: $(DROMNS)doc-common $(DROMNS)odoc $(DROMNS)sphinx
46+
47+
$(DROMNS)view:
48+
xdg-open file://$$(pwd)/_drom/docs/index.html
49+
50+
$(DROMNS)fmt:
51+
opam exec -- dune build @fmt --auto-promote
52+
53+
$(DROMNS)fmt-check:
54+
opam exec -- dune build @fmt
55+
56+
$(DROMNS)install:
57+
opam pin -y --no-action -k path .
58+
opam install -y .
59+
60+
$(DROMNS)opam:
61+
opam pin -k path .
62+
63+
$(DROMNS)uninstall:
64+
opam uninstall .
65+
66+
$(DROMNS)dev-deps:
67+
opam install ./opam/*.opam --deps-only --with-doc --with-test
68+
69+
$(DROMNS)test:
70+
./scripts/before.sh test
71+
opam exec -- dune build @runtest
72+
./scripts/after.sh test
73+
74+
$(DROMNS)clean:
75+
rm -rf _build
76+
rm -f *.exe *~
77+
./scripts/after.sh clean
78+
79+
$(DROMNS)distclean: $(DROMNS)clean
80+
rm -rf _opam _drom
81+
./scripts/after.sh distclean
82+
83+

drom.toml

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[project]
22
create-project = false
3-
drom-version = "0.1"
3+
drom-version = "0.9.2"
44
share-repo = "https://github.com/OCamlPro/drom-share"
5-
share-version = "0.9.0"
5+
share-version = "branch:ninjapouet:prepare_sites"
66

77
[project]
88
authors = ["Fabrice Le Fessant <[email protected]>", "Léo Andrès <[email protected]>"]
@@ -11,7 +11,7 @@ copyright = "OCamlPro SAS"
1111
edition = "4.14.1"
1212
github-organization = "ocamlpro"
1313
license = "LGPL2"
14-
min-edition = "4.07.0"
14+
min-edition = "4.08.0"
1515
name = "drom"
1616
skeleton = "program"
1717
synopsis = "The drom tool is a wrapper over opam/dune in an attempt to provide a cargo-like user experience"
@@ -42,6 +42,8 @@ skip = ["sphinx/about.rst", "src/drom_lib/main.ml", "sphinx/index.rst", "CHANGES
4242
[dependencies]
4343

4444
# project-wide tools dependencies (not for package-specific deps)
45+
[tools]
46+
dune = ">=2.8"
4547
[tools.ocamlformat]
4648
for-test = true
4749
[tools.odoc]

dune-project

+27-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
(lang dune 2.7)
1+
(lang dune 2.8)
2+
(using dune_site 0.1)
23
; This file was generated by drom, using drom.toml
34

45
(cram enable)
@@ -13,23 +14,38 @@
1314
(name drom)
1415
(synopsis "The drom tool is a wrapper over opam/dune in an attempt to provide a cargo-like user experience")
1516
(description "The drom tool is a wrapper over opam/dune in an attempt to provide a cargo-like\nuser experience. It can be used to create full OCaml projects with\nsphinx and odoc documentation. It has specific knowledge of Github and\nwill generate files for Github Actions CI and Github pages.\n")
17+
18+
(sites
19+
20+
)
21+
1622
(depends
17-
(ocaml (>= 4.07.0))
23+
(ocaml (>= 4.08.0))
1824
(drom_lib (= version))
1925
ppx_inline_test
2026
ppx_expect
2127
odoc
2228
ocamlformat
29+
(dune ( >= 2.8 ))
2330
)
2431
)
2532

2633
(package
2734
(name drom_lib)
2835
(synopsis "The drom tool is a wrapper over opam/dune in an attempt to provide a cargo-like user experience")
2936
(description "The drom tool is a wrapper over opam/dune in an attempt to provide a cargo-like\nuser experience. It can be used to create full OCaml projects with\nsphinx and odoc documentation. It has specific knowledge of Github and\nwill generate files for Github Actions CI and Github pages.\n")
37+
38+
(sites
39+
40+
)
41+
3042
(depends
31-
(ocaml (>= 4.07.0))
43+
(ocaml (>= 4.08.0))
44+
(ppx_protocol_conv ( >= 5.2.1 ))
45+
(otoml ( >= 1.0.4 ))
3246
(omd ( >= 2.0 ))
47+
(jingoo ( >= 1.5.0 ))
48+
(fmt ( >= 0.9.0 ))
3349
(ez_subst ( >= 0.1 ))
3450
(ez_opam_file (and (>= 0.1.0) (< 1.0.0)))
3551
(ez_file (and (>= 0.3.0) (< 1.0.0)))
@@ -40,22 +56,29 @@
4056
ppx_expect
4157
odoc
4258
ocamlformat
59+
(dune ( >= 2.8 ))
4360
)
4461
)
4562

4663
(package
4764
(name drom_toml)
4865
(synopsis "The drom tool is a wrapper over opam/dune in an attempt to provide a cargo-like user experience")
4966
(description "The drom tool is a wrapper over opam/dune in an attempt to provide a cargo-like\nuser experience. It can be used to create full OCaml projects with\nsphinx and odoc documentation. It has specific knowledge of Github and\nwill generate files for Github Actions CI and Github pages.\n")
67+
68+
(sites
69+
70+
)
71+
5072
(depends
51-
(ocaml (>= 4.07.0))
73+
(ocaml (>= 4.08.0))
5274
(menhirLib ( > 2019 ))
5375
(ISO8601 ( >= 0.2 ))
5476
(menhir ( > 2019 ))
5577
ppx_inline_test
5678
ppx_expect
5779
odoc
5880
ocamlformat
81+
(dune ( >= 2.8 ))
5982
)
6083
)
6184

0 commit comments

Comments
 (0)