Skip to content

Commit

Permalink
Fixed #224: added sites managment.
Browse files Browse the repository at this point in the history
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`.
  • Loading branch information
Julien Blond committed Jul 16, 2024
1 parent 61aee33 commit 984b206
Show file tree
Hide file tree
Showing 36 changed files with 994 additions and 70 deletions.
58 changes: 39 additions & 19 deletions .drom
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ version:0.9.0

# hash of toml configuration files
# used for generation of all files
cfa41e62814087cf2f340eab496a6542:.
cfd502831bbf686b41df41219629c1c4:.
# end context for .

# begin context for .github/workflows/workflow.yml
# file .github/workflows/workflow.yml
533318fb1c01b0861406a644a7d9f39c:.github/workflows/workflow.yml
eee26f5d13b222b48706c4fcbd98a19a:.github/workflows/workflow.yml
# end context for .github/workflows/workflow.yml

# begin context for .gitignore
# file .gitignore
33c88a25e8b40f3683f6c03ec26be5db:.gitignore
f7a24abcad0ba9301c03bb64464b1718:.gitignore
# end context for .gitignore

# begin context for .ocamlformat
Expand Down Expand Up @@ -48,6 +48,11 @@ cfa41e62814087cf2f340eab496a6542:.
9018881cf0682f4f7f262417b0d4f9ff:Makefile
# end context for Makefile

# begin context for Makefile.drom
# file Makefile.drom
2b07c62bfabf8f45733eafbc696c6146:Makefile.drom
# end context for Makefile.drom

# begin context for README.md
# file README.md
616ddd2660258447be65bdb664b9241d:README.md
Expand Down Expand Up @@ -90,7 +95,7 @@ c8281f46ba9a11d0b61bc8ef67eaa357:docs/style.css

# begin context for drom.toml
# file drom.toml
b7b7b8f4a370e3c1b425b7a9316c3e0f:drom.toml
9949d65b87e55480a30122e9e77ae7d3:drom.toml
# end context for drom.toml

# begin context for dune
Expand All @@ -100,22 +105,22 @@ e850a13c004f963e9f5a568eac93c217:dune

# begin context for dune-project
# file dune-project
47416b4e7b7e7febc8da32932cae0d54:dune-project
c063288437da29a5a21e8c76c1906adc:dune-project
# end context for dune-project

# begin context for opam/drom.opam
# file opam/drom.opam
d3c8882f1742f865c2987dea6c7c83e2:opam/drom.opam
ff84198ff87fa46b8ac39ed2951d2d26:opam/drom.opam
# end context for opam/drom.opam

# begin context for opam/drom_lib.opam
# file opam/drom_lib.opam
8b323689fcc28f9783fa85ca4a4fac55:opam/drom_lib.opam
788b17212e259bbb8fe7c22c85c76d35:opam/drom_lib.opam
# end context for opam/drom_lib.opam

# begin context for opam/drom_toml.opam
# file opam/drom_toml.opam
81116a1889e6414dee5c2e921961aa77:opam/drom_toml.opam
e55d659410b556d7bc60183d8ff1f788:opam/drom_toml.opam
# end context for opam/drom_toml.opam

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

# begin context for scripts/copy-bin.sh
# file scripts/copy-bin.sh
bb3a9d286f0dc64021db4194427263ee:scripts/copy-bin.sh
7fe4ada2a2fc5a0ebf9a2f483679a0ae:scripts/copy-bin.sh
# end context for scripts/copy-bin.sh

# begin context for scripts/static-build.sh
# file scripts/static-build.sh
2a405479b3313d79d421c2e7fc282304:scripts/static-build.sh
cda3f8bad69d9c6e8cbeab1c720d739a:scripts/static-build.sh
# end context for scripts/static-build.sh

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

# begin context for src/drom/dune
# file src/drom/dune
efad88968955023a354f16469eb1ae15:src/drom/dune
68aec4169671c0163b98bb38205d2e4d:src/drom/dune
# end context for src/drom/dune

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

# begin context for src/drom/linking_flags.sh
# file src/drom/linking_flags.sh
9a3b02ff1d99723e9ee2f3c0e97d7b30:src/drom/linking_flags.sh
9fdfca3cc53df639758ff04fe09d3243:src/drom/linking_flags.sh
# end context for src/drom/linking_flags.sh

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

# begin context for src/drom/package.toml
# file src/drom/package.toml
5bdfaa2663247cad045abb018d576a5e:src/drom/package.toml
bb6803d414fd5a5479ed6381914604de:src/drom/package.toml
# end context for src/drom/package.toml

# begin context for src/drom_lib/dune
# file src/drom_lib/dune
a97be0d7328e7c15eb149c454844646a:src/drom_lib/dune
103b365e9f24dbbae02b6be22b3efd0a:src/drom_lib/dune
# end context for src/drom_lib/dune

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

# begin context for src/drom_lib/package.toml
# file src/drom_lib/package.toml
18ae084348cbfdbb80ca1469113e0e9f:src/drom_lib/package.toml
c4d6597dc5b0966758c213bfffb9d594:src/drom_lib/package.toml
# end context for src/drom_lib/package.toml

# begin context for src/drom_lib/version.mlt
# file src/drom_lib/version.mlt
fc09abbaf032f775d148928fa1398cf9:src/drom_lib/version.mlt
a3e5d8a00664ceaa6addf376bedf6de1:src/drom_lib/version.mlt
# end context for src/drom_lib/version.mlt

# begin context for src/toml.7.1.0/dune
# file src/toml.7.1.0/dune
229a5f90ef7f812db6f3560ccb3d131f:src/toml.7.1.0/dune
0841a2e47118b9fcd9b900f84ff66c34:src/toml.7.1.0/dune
# end context for src/toml.7.1.0/dune

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

# begin context for src/toml.7.1.0/package.toml
# file src/toml.7.1.0/package.toml
706b170edac8a3051745f05ece52fb62:src/toml.7.1.0/package.toml
16c1103a2b8042862d209fc275b52f65:src/toml.7.1.0/package.toml
# end context for src/toml.7.1.0/package.toml

# begin context for src/toml.7.1.0/version.mlt
# file src/toml.7.1.0/version.mlt
fc09abbaf032f775d148928fa1398cf9:src/toml.7.1.0/version.mlt
a3e5d8a00664ceaa6addf376bedf6de1:src/toml.7.1.0/version.mlt
# end context for src/toml.7.1.0/version.mlt

# begin context for test/expect-tests/dune
# file test/expect-tests/dune
d7e2675a767e30edf28d061c94f0ec62:test/expect-tests/dune
# end context for test/expect-tests/dune

# begin context for test/expect-tests/dune.drom
# file test/expect-tests/dune.drom
6d2c689d437f17d4e99e01df3f4515c6:test/expect-tests/dune.drom
# end context for test/expect-tests/dune.drom

# begin context for test/expect-tests/dune_
# file test/expect-tests/dune_
f15fedac6f43c154bcd0348b776ac08c:test/expect-tests/dune_
Expand All @@ -258,6 +268,11 @@ f15fedac6f43c154bcd0348b776ac08c:test/expect-tests/dune_
a0d7baa94246a5122e55a255dcefa9d0:test/inline-tests/dune
# end context for test/inline-tests/dune

# begin context for test/inline-tests/dune.drom
# file test/inline-tests/dune.drom
4cd12cd1258c38ccd44b225323601ff5:test/inline-tests/dune.drom
# end context for test/inline-tests/dune.drom

# begin context for test/inline-tests/dune_
# file test/inline-tests/dune_
75d7504f9c8002ec5ccdd2458f01da09:test/inline-tests/dune_
Expand All @@ -273,6 +288,11 @@ a0d7baa94246a5122e55a255dcefa9d0:test/inline-tests/dune
b5ea41e29d37e997b482b1bf7f5953d7:test/output-tests/dune
# end context for test/output-tests/dune

# begin context for test/output-tests/dune.drom
# file test/output-tests/dune.drom
a3371489c9d6aee62aeba112ecfddcf0:test/output-tests/dune.drom
# end context for test/output-tests/dune.drom

# begin context for test/output-tests/dune_
# file test/output-tests/dune_
28db2068920c1259cbd67a7c322730ed:test/output-tests/dune_
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:

include:
- os: ubuntu-latest
ocaml-compiler: 4.07.0
ocaml-compiler: 4.08.0
skip_test: true


Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
*~
_build
.merlin
.vscode
/_drom
/_opam
/_build
Expand Down
83 changes: 83 additions & 0 deletions Makefile.drom
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Maintained by "drom project"
.PHONY: $(DROMNS)build $(DROMNS)build-deps $(DROMNS)fmt $(DROMNS)fmt-check
.PHONY: $(DROMNS)install $(DROMNS)dev-deps $(DROMNS)test
.PHONY: $(DROMNS)clean $(DROMNS)distclean

DROM_DEV_DEPS := merlin ocamlformat odoc ppx_expect ppx_inline_test $(DEV_DEPS)


SPHINX_TARGET:=_drom/docs/sphinx

ODOC_TARGET:=_drom/docs/doc/.


$(DROMNS)build:
./scripts/before.sh build
opam exec -- dune build @install
./scripts/copy-bin.sh drom drom_lib drom_toml
./scripts/after.sh build

$(DROMNS)build-deps:
if ! [ -e _opam ]; then \
opam switch create . 4.14.1 ; \
fi
opam install ./opam/*.opam --deps-only


.PHONY: $(DROMNS)doc-common $(DROMNS)odoc $(DROMNS)view
.PHONY: $(DROMNS)sphinx
$(DROMNS)doc-common: $(DROMNS)build
mkdir -p _drom/docs
rsync -auv docs/. _drom/docs/.

$(DROMNS)sphinx: $(DROMNS)doc-common
./scripts/before.sh sphinx ${SPHINX_TARGET}
sphinx-build sphinx ${SPHINX_TARGET}
./scripts/after.sh sphinx ${SPHINX_TARGET}

$(DROMNS)odoc: $(DROMNS)doc-common
mkdir -p ${ODOC_TARGET}
./scripts/before.sh odoc ${ODOC_TARGET}
opam exec -- dune build @doc
rsync -auv --delete _build/default/_doc/_html/. ${ODOC_TARGET}
./scripts/after.sh odoc ${ODOC_TARGET}

$(DROMNS)doc: $(DROMNS)doc-common $(DROMNS)odoc $(DROMNS)sphinx

$(DROMNS)view:
xdg-open file://$$(pwd)/_drom/docs/index.html

$(DROMNS)fmt:
opam exec -- dune build @fmt --auto-promote

$(DROMNS)fmt-check:
opam exec -- dune build @fmt

$(DROMNS)install:
opam pin -y --no-action -k path .
opam install -y .

$(DROMNS)opam:
opam pin -k path .

$(DROMNS)uninstall:
opam uninstall .

$(DROMNS)dev-deps:
opam install ./opam/*.opam --deps-only --with-doc --with-test

$(DROMNS)test:
./scripts/before.sh test
opam exec -- dune build @runtest
./scripts/after.sh test

$(DROMNS)clean:
rm -rf _build
rm -f *.exe *~
./scripts/after.sh clean

$(DROMNS)distclean: $(DROMNS)clean
rm -rf _opam _drom
./scripts/after.sh distclean


8 changes: 5 additions & 3 deletions drom.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[project]
create-project = false
drom-version = "0.1"
drom-version = "0.9.2"
share-repo = "https://github.com/OCamlPro/drom-share"
share-version = "0.9.0"
share-version = "branch:ninjapouet:prepare_sites"

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

# project-wide tools dependencies (not for package-specific deps)
[tools]
dune = ">=2.8"
[tools.ocamlformat]
for-test = true
[tools.odoc]
Expand Down
31 changes: 27 additions & 4 deletions dune-project
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
(lang dune 2.7)
(lang dune 2.8)
(using dune_site 0.1)
; This file was generated by drom, using drom.toml

(cram enable)
Expand All @@ -13,23 +14,38 @@
(name drom)
(synopsis "The drom tool is a wrapper over opam/dune in an attempt to provide a cargo-like user experience")
(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")

(sites

)

(depends
(ocaml (>= 4.07.0))
(ocaml (>= 4.08.0))
(drom_lib (= version))
ppx_inline_test
ppx_expect
odoc
ocamlformat
(dune ( >= 2.8 ))
)
)

(package
(name drom_lib)
(synopsis "The drom tool is a wrapper over opam/dune in an attempt to provide a cargo-like user experience")
(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")

(sites

)

(depends
(ocaml (>= 4.07.0))
(ocaml (>= 4.08.0))
(ppx_protocol_conv ( >= 5.2.1 ))
(otoml ( >= 1.0.4 ))
(omd ( >= 2.0 ))
(jingoo ( >= 1.5.0 ))
(fmt ( >= 0.9.0 ))
(ez_subst ( >= 0.1 ))
(ez_opam_file (and (>= 0.1.0) (< 1.0.0)))
(ez_file (and (>= 0.3.0) (< 1.0.0)))
Expand All @@ -40,22 +56,29 @@
ppx_expect
odoc
ocamlformat
(dune ( >= 2.8 ))
)
)

(package
(name drom_toml)
(synopsis "The drom tool is a wrapper over opam/dune in an attempt to provide a cargo-like user experience")
(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")

(sites

)

(depends
(ocaml (>= 4.07.0))
(ocaml (>= 4.08.0))
(menhirLib ( > 2019 ))
(ISO8601 ( >= 0.2 ))
(menhir ( > 2019 ))
ppx_inline_test
ppx_expect
odoc
ocamlformat
(dune ( >= 2.8 ))
)
)

Expand Down
Loading

0 comments on commit 984b206

Please sign in to comment.