diff --git a/.drom b/.drom
index 307147cc..d529c116 100644
--- a/.drom
+++ b/.drom
@@ -2,17 +2,17 @@
# hash of toml configuration files
# used for generation of all files
-a559d065eaaccf4da2420d8599285242:.
+dff636cbe399e29f256a1483400e4c29:.
# end context for .
# begin context for .github/workflows/doc-deploy.yml
# file .github/workflows/doc-deploy.yml
-fa97e8d29135d03ad98579323218d9ce:.github/workflows/doc-deploy.yml
+2960a63902d7a6b19edf86535c775979:.github/workflows/doc-deploy.yml
# end context for .github/workflows/doc-deploy.yml
# begin context for .github/workflows/workflow.yml
# file .github/workflows/workflow.yml
-2578e01a3fd098263d6d8506582058bd:.github/workflows/workflow.yml
+1d44e24a3d8eedd52b9d7fe98b717f42:.github/workflows/workflow.yml
# end context for .github/workflows/workflow.yml
# begin context for .gitignore
@@ -37,7 +37,7 @@ c4217a22064a4a18f9587b930b250fbe:LICENSE.md
# begin context for Makefile
# file Makefile
-e75cd58a1a17c1c8db2fc32884d8edcb:Makefile
+29c25a9a205de631c328133a9a7fabfe:Makefile
# end context for Makefile
# begin context for README.md
@@ -62,7 +62,7 @@ b091dd96e8b553dd7a7df285279d7d9e:README.md
# begin context for docs/index.html
# file docs/index.html
-0f8b4e9f9f5fdd8a79cf4053ace6d538:docs/index.html
+6b67a3189c8c2cb0b83e86a7bd5ebd6f:docs/index.html
# end context for docs/index.html
# begin context for docs/sphinx/index.html
@@ -72,12 +72,12 @@ b091dd96e8b553dd7a7df285279d7d9e:README.md
# begin context for docs/style.css
# file docs/style.css
-0085152add896d7bab7b1a744d2a9af7:docs/style.css
+1eb62145308aed80e0f86b959d6f7fd0:docs/style.css
# end context for docs/style.css
# begin context for drom.opam
# file drom.opam
-7f00a37ed8231d6524f873c63fbf1d5c:drom.opam
+921f270eed0e5dee73153c852aff0a1d:drom.opam
# end context for drom.opam
# begin context for drom.toml
@@ -87,17 +87,17 @@ b091dd96e8b553dd7a7df285279d7d9e:README.md
# begin context for drom_lib.opam
# file drom_lib.opam
-f23add29b54c9b6db85faedc1e1c331b:drom_lib.opam
+9e3add3dce40d01537aa6258731c2bdd:drom_lib.opam
# end context for drom_lib.opam
# begin context for dune
# file dune
-ff0b2308dfc7350e6ac7d519836f9e47:dune
+7efb0eaa6d77cffd7d13712278f31b30:dune
# end context for dune
# begin context for dune-project
# file dune-project
-467f046c5e5e73fae0fe4884b82c82e0:dune-project
+8ef5717bd75c05ee5d5fdff782e782fc:dune-project
# end context for dune-project
# begin context for dune_
@@ -117,7 +117,7 @@ a44c87f3a364dd95f55427fe40b2c5d1:sphinx/about.rst
# begin context for sphinx/conf.py
# file sphinx/conf.py
-38bd7d44a9d086cc3e76743118ef4b5e:sphinx/conf.py
+c5e0b1e03c5491a779d30531d85721c0:sphinx/conf.py
# end context for sphinx/conf.py
# begin context for sphinx/index.rst
@@ -132,7 +132,7 @@ a44c87f3a364dd95f55427fe40b2c5d1:sphinx/about.rst
# begin context for sphinx/license.rst
# file sphinx/license.rst
-cf3f86e8f7d8e90e663c3cb7e438057d:sphinx/license.rst
+fcee58f602925845277cb358d934aa5f:sphinx/license.rst
# end context for sphinx/license.rst
# begin context for src/drom/dune
@@ -147,7 +147,7 @@ cf3f86e8f7d8e90e663c3cb7e438057d:sphinx/license.rst
# begin context for src/drom/index.mld
# file src/drom/index.mld
-d947d2a8c369bc5ff232874cc3b568ac:src/drom/index.mld
+19901e0000918a468551ef403741bf9f:src/drom/index.mld
# end context for src/drom/index.mld
# begin context for src/drom/main.ml
@@ -165,14 +165,9 @@ a8b8d27eed41f01c76e6535dbd620f52:src/drom/main.ml
383504e764043311ed98d2cf09924c35:src/drom_lib/dune
# end context for src/drom_lib/dune
-# begin context for src/drom_lib/dune_
-# file src/drom_lib/dune_
-6fbe050e4f0c8f0f7fc290b66d3389ae:src/drom_lib/dune_
-# end context for src/drom_lib/dune_
-
# begin context for src/drom_lib/index.mld
# file src/drom_lib/index.mld
-dfda02aaec08f18742582243e9cd6748:src/drom_lib/index.mld
+dcdcd597bf92e2c3ed6f84f1e6d5e5cb:src/drom_lib/index.mld
# end context for src/drom_lib/index.mld
# begin context for src/drom_lib/package.toml
@@ -182,7 +177,7 @@ dfda02aaec08f18742582243e9cd6748:src/drom_lib/index.mld
# begin context for src/drom_lib/version.mlt
# file src/drom_lib/version.mlt
-58164b9f0eeeaedc5270ba6f2d52b654:src/drom_lib/version.mlt
+6f158b069dd55ebfb458416aa1a4ba51:src/drom_lib/version.mlt
# end context for src/drom_lib/version.mlt
# begin context for test/expect-tests/dune
diff --git a/.github/workflows/doc-deploy.yml b/.github/workflows/doc-deploy.yml
index 94000dfa..4b5ec9cf 100644
--- a/.github/workflows/doc-deploy.yml
+++ b/.github/workflows/doc-deploy.yml
@@ -1,4 +1,3 @@
-
name: doc-deploy
on:
push:
diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml
index 6d89a215..6ac747b1 100644
--- a/.github/workflows/workflow.yml
+++ b/.github/workflows/workflow.yml
@@ -1,4 +1,3 @@
-
name: Main Workflow
on:
diff --git a/Makefile b/Makefile
index 0a54ca47..5c08c296 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,5 @@
-
# Generated by "drom project"
-.PHONY: all build build-deps sphinx doc-common odoc view fmt fmt-check install dev-deps test
+.PHONY: all build build-depsfmt fmt-check install dev-deps test
.PHONY: clean distclean
DEV_DEPS := merlin ocamlformat odoc ppx_expect ppx_inline_test
@@ -17,6 +16,8 @@ build-deps:
fi
opam install ./*.opam --deps-only
+
+.PHONY: doc-common odoc view sphinx
doc-common:
opam exec -- dune build @doc
mkdir -p _drom/docs
diff --git a/docs/index.html b/docs/index.html
index 480361a3..bcfe035d 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -1,4 +1,3 @@
-
diff --git a/docs/style.css b/docs/style.css
index dc73dfd3..309f581f 100644
--- a/docs/style.css
+++ b/docs/style.css
@@ -1,4 +1,3 @@
-
body {
color: #444;
background-color: #EEEEEE;
diff --git a/drom.opam b/drom.opam
index 772ed039..433c94ef 100644
--- a/drom.opam
+++ b/drom.opam
@@ -2,7 +2,7 @@
# Do not modify, or add to the `skip` field of `drom.toml`.
opam-version: "2.0"
name: "drom"
-version: "0.2.1"
+version: "0.2.2"
license: "LGPL-2.1-only with OCaml-LGPL-linking-exception"
synopsis:
"The drom tool is a wrapper over opam/dune in an attempt to provide a cargo-like user experience"
diff --git a/drom.toml b/drom.toml
index 7446396d..cf17753b 100644
--- a/drom.toml
+++ b/drom.toml
@@ -10,7 +10,7 @@ license = "LGPL2"
min-edition = "4.07.0"
name = "drom"
synopsis = "The drom tool is a wrapper over opam/dune in an attempt to provide a cargo-like user experience"
-version = "0.2.1"
+version = "0.2.2"
windows-ci = true
# keys that you could also define:
diff --git a/drom_lib.opam b/drom_lib.opam
index c5191cdc..9f91dc15 100644
--- a/drom_lib.opam
+++ b/drom_lib.opam
@@ -2,7 +2,7 @@
# Do not modify, or add to the `skip` field of `drom.toml`.
opam-version: "2.0"
name: "drom_lib"
-version: "0.2.1"
+version: "0.2.2"
license: "LGPL-2.1-only with OCaml-LGPL-linking-exception"
synopsis:
"The drom tool is a wrapper over opam/dune in an attempt to provide a cargo-like user experience"
diff --git a/dune b/dune
index 73ad04b0..61ffa732 100644
--- a/dune
+++ b/dune
@@ -28,6 +28,8 @@
as "skeletons/README.md")
( "share/drom/skeletons/packages/driver/files/dune_"
as "skeletons/packages/driver/files/dune_")
+ ( "share/drom/skeletons/packages/driver/files/index.mld"
+ as "skeletons/packages/driver/files/index.mld")
( "share/drom/skeletons/packages/driver/files/main.ml"
as "skeletons/packages/driver/files/main.ml")
( "share/drom/skeletons/packages/driver/package.toml"
@@ -36,12 +38,24 @@
as "skeletons/packages/driver/skeleton.toml")
( "share/drom/skeletons/packages/library/files/dune_"
as "skeletons/packages/library/files/dune_")
+ ( "share/drom/skeletons/packages/library/files/index.mld"
+ as "skeletons/packages/library/files/index.mld")
( "share/drom/skeletons/packages/library/files/main.ml"
as "skeletons/packages/library/files/main.ml")
( "share/drom/skeletons/packages/library/package.toml"
as "skeletons/packages/library/package.toml")
( "share/drom/skeletons/packages/library/skeleton.toml"
as "skeletons/packages/library/skeleton.toml")
+ ( "share/drom/skeletons/packages/ppx_deriver/files/dune_"
+ as "skeletons/packages/ppx_deriver/files/dune_")
+ ( "share/drom/skeletons/packages/ppx_deriver/files/index.mld"
+ as "skeletons/packages/ppx_deriver/files/index.mld")
+ ( "share/drom/skeletons/packages/ppx_deriver/files/main.ml"
+ as "skeletons/packages/ppx_deriver/files/main.ml")
+ ( "share/drom/skeletons/packages/ppx_deriver/package.toml"
+ as "skeletons/packages/ppx_deriver/package.toml")
+ ( "share/drom/skeletons/packages/ppx_deriver/skeleton.toml"
+ as "skeletons/packages/ppx_deriver/skeleton.toml")
( "share/drom/skeletons/packages/program/files/dune_"
as "skeletons/packages/program/files/dune_")
( "share/drom/skeletons/packages/program/files/main.ml"
@@ -58,6 +72,18 @@
as "skeletons/projects/library/project.toml")
( "share/drom/skeletons/projects/library/skeleton.toml"
as "skeletons/projects/library/skeleton.toml")
+ ( "share/drom/skeletons/projects/mini-lib/project.toml"
+ as "skeletons/projects/mini-lib/project.toml")
+ ( "share/drom/skeletons/projects/mini-lib/skeleton.toml"
+ as "skeletons/projects/mini-lib/skeleton.toml")
+ ( "share/drom/skeletons/projects/mini-prg/project.toml"
+ as "skeletons/projects/mini-prg/project.toml")
+ ( "share/drom/skeletons/projects/mini-prg/skeleton.toml"
+ as "skeletons/projects/mini-prg/skeleton.toml")
+ ( "share/drom/skeletons/projects/ppx_deriver/project.toml"
+ as "skeletons/projects/ppx_deriver/project.toml")
+ ( "share/drom/skeletons/projects/ppx_deriver/skeleton.toml"
+ as "skeletons/projects/ppx_deriver/skeleton.toml")
( "share/drom/skeletons/projects/program/project.toml"
as "skeletons/projects/program/project.toml")
( "share/drom/skeletons/projects/program/skeleton.toml"
@@ -94,6 +120,8 @@
as "skeletons/projects/virtual/files/dot_ocamlformat-ignore")
( "share/drom/skeletons/projects/virtual/files/dot_ocp-indent"
as "skeletons/projects/virtual/files/dot_ocp-indent")
+ ( "share/drom/skeletons/projects/virtual/files/dune-project_"
+ as "skeletons/projects/virtual/files/dune-project_")
( "share/drom/skeletons/projects/virtual/files/dune_"
as "skeletons/projects/virtual/files/dune_")
( "share/drom/skeletons/projects/virtual/files/sphinx/about.rst"
diff --git a/dune-project b/dune-project
index b7c71321..96b14769 100644
--- a/dune-project
+++ b/dune-project
@@ -3,7 +3,7 @@
(name drom)
(allow_approximate_merlin)
(generate_opam_files false)
-(version 0.2.1)
+(version 0.2.2)
(formatting (enabled_for ocaml reason))
(package
@@ -37,3 +37,4 @@
odoc
ocamlformat
))
+
diff --git a/share/drom/skeletons/packages/driver/skeleton.toml b/share/drom/skeletons/packages/driver/skeleton.toml
index 3bfed52d..6f4dd0e8 100644
--- a/share/drom/skeletons/packages/driver/skeleton.toml
+++ b/share/drom/skeletons/packages/driver/skeleton.toml
@@ -3,7 +3,7 @@ name = "driver"
inherits = "virtual"
[file]
-dune_ = { file = "dune" }
+dune_ = { file = "dune", skips = [ "dune" ] }
"index.mld" = { skips = [ "docs" ] }
"main.ml" = { skips = [ "code" ] }
diff --git a/share/drom/skeletons/packages/library/skeleton.toml b/share/drom/skeletons/packages/library/skeleton.toml
index 35198a59..d96bcda0 100644
--- a/share/drom/skeletons/packages/library/skeleton.toml
+++ b/share/drom/skeletons/packages/library/skeleton.toml
@@ -3,7 +3,7 @@ name = "library"
inherits = "virtual"
[file]
-dune_ = { file = "dune" }
+dune_ = { file = "dune", skips = "dune" }
"index.mld" = { skips = [ "docs" ] }
"main.ml" = { skips = [ "code" ] }
diff --git a/share/drom/skeletons/packages/ppx_deriver/skeleton.toml b/share/drom/skeletons/packages/ppx_deriver/skeleton.toml
index 3e91e4c0..c9cdf40e 100644
--- a/share/drom/skeletons/packages/ppx_deriver/skeleton.toml
+++ b/share/drom/skeletons/packages/ppx_deriver/skeleton.toml
@@ -3,7 +3,7 @@ name = "ppx_deriver"
inherits = "virtual"
[file]
-dune_ = { file = "dune" }
+dune_ = { file = "dune", skips = [ "dune" ] }
"index.mld" = { skips = [ "docs" ] }
"main.ml" = { skips = [ "code" ] }
diff --git a/share/drom/skeletons/packages/program/files/dune_ b/share/drom/skeletons/packages/program/files/dune_
index 141fed66..e7d58b17 100644
--- a/share/drom/skeletons/packages/program/files/dune_
+++ b/share/drom/skeletons/packages/program/files/dune_
@@ -1,4 +1,4 @@
-![file:dune]; generated by drom from package skeleton 'driver'
+; generated by drom from package skeleton 'driver'
(executable
(name main)
(public_name !{name})
diff --git a/share/drom/skeletons/packages/program/skeleton.toml b/share/drom/skeletons/packages/program/skeleton.toml
index 5ac0751a..69ca0b76 100644
--- a/share/drom/skeletons/packages/program/skeleton.toml
+++ b/share/drom/skeletons/packages/program/skeleton.toml
@@ -1,3 +1,8 @@
[skeleton]
name = "program"
inherits = "virtual"
+
+[files]
+dune_ = { file = "dune", skips = [ "dune" ] }
+"main.ml" = { skips = "code" }
+
diff --git a/share/drom/skeletons/projects/virtual/files/Makefile b/share/drom/skeletons/projects/virtual/files/Makefile
index 72f317e9..a44d52b3 100644
--- a/share/drom/skeletons/projects/virtual/files/Makefile
+++ b/share/drom/skeletons/projects/virtual/files/Makefile
@@ -1,5 +1,5 @@
# Generated by "drom project"
-.PHONY: all build build-depsfmt fmt-check install dev-deps test
+.PHONY: all build build-deps fmt fmt-check install dev-deps test
.PHONY: clean distclean
DEV_DEPS := merlin ocamlformat odoc![if:gen:test] ppx_expect ppx_inline_test![fi]
diff --git a/share/drom/skeletons/projects/virtual/files/dune-project_ b/share/drom/skeletons/projects/virtual/files/dune-project_
new file mode 100644
index 00000000..a363d37e
--- /dev/null
+++ b/share/drom/skeletons/projects/virtual/files/dune-project_
@@ -0,0 +1,8 @@
+(lang dune 2.0)
+; This file was generated by drom, using drom.toml
+(name !{name})
+(allow_approximate_merlin)
+(generate_opam_files false)
+(version !{version})
+(formatting (enabled_for ocaml reason))
+!{dune-packages}
diff --git a/share/drom/skeletons/projects/virtual/skeleton.toml b/share/drom/skeletons/projects/virtual/skeleton.toml
index 549e1462..bc15eab2 100644
--- a/share/drom/skeletons/projects/virtual/skeleton.toml
+++ b/share/drom/skeletons/projects/virtual/skeleton.toml
@@ -3,16 +3,28 @@ name = "virtual"
[file]
"Makefile" = { skips = [ "make" ] }
+"dune-project_" = { file = "dune-project", skips = [ "dune" ] }
-"dot_ocp-indent" = { file = ".ocp-indent", create = true, skips = [ "ocamlformat" ] }
+"dot_ocp-indent" = {
+ file = ".ocp-indent", create = true,
+ skips = [ "ocamlformat" ] }
-"dot_ocamlformat" = { file = ".ocamlformat", create = true, skips = [ "ocamlformat" ] }
-"dot_ocamlformat-ignore" = { file = ".ocamlformat-ignore", skips = [ "ocamlformat" ] }
+"dot_ocamlformat" = {
+ file = ".ocamlformat",
+ create = true,
+ skips = [ "ocamlformat" ] }
+"dot_ocamlformat-ignore" = {
+ file = ".ocamlformat-ignore",
+ skips = [ "ocamlformat" ] }
-"dot_github/workflows/workflow.yml" = { file = ".github/workflows/workflow.yml", skips = [ "github", "workflows" ] }
-"dot_github/workflows/doc-deploy.yml" = { file = ".github/workflows/doc-deploy.yml", skips = [ "github", "workflows" ] }
+"dot_github/workflows/workflow.yml" = {
+ file = ".github/workflows/workflow.yml",
+ skips = [ "github", "workflows" ] }
+"dot_github/workflows/doc-deploy.yml" = {
+ file = ".github/workflows/doc-deploy.yml",
+ skips = [ "github", "workflows" ] }
-"dog_gitignore" = { file = ".gitignore", skips = [ "git" ] }
+"dot_gitignore" = { file = ".gitignore", skips = [ "git" ] }
"docs/index.html" = { skips = "docs" }
"docs/favicon.png" = { skips = [ "docs" ], subst = false }
@@ -21,7 +33,10 @@ name = "virtual"
"sphinx/about.rst" = { skips = [ "sphinx", "docs" ] }
"sphinx/conf.py" = { skips = [ "sphinx", "docs" ] }
-"sphinx/under_static/css/fixes.css" = { skips = [ "sphinx", "docs" ], file = "sphinx/_static/css/fixes.css", create = true }
+"sphinx/under_static/css/fixes.css" = {
+ skips = [ "sphinx", "docs" ],
+ file = "sphinx/_static/css/fixes.css",
+ create = true }
"sphinx/index.rst" = { skips = [ "sphinx", "docs" ] }
"sphinx/install.rst" = { skips = [ "sphinx", "docs" ] }
"sphinx/license.rst" = { skips = [ "sphinx", "docs" ] }
@@ -29,13 +44,19 @@ name = "virtual"
"docs/doc/index.html" = { skips = "docs", create = true }
"docs/sphinx/index.html" = { skips = "docs", create = true }
-"test/expect-tests/dune_" = { file = "test/expect-tests/dune", skips = "test" }
+"test/expect-tests/dune_" = {
+ file = "test/expect-tests/dune",
+ skips = [ "test", "dune" ] }
"test/expect-tests/test.ml" = { skips = "test" }
-"test/inline-tests/dune_" = { file = "test/inline-tests/dune", skips = "test" }
+"test/inline-tests/dune_" = {
+ file = "test/inline-tests/dune",
+ skips = [ "test" , "dune" ] }
"test/inline-tests/test.ml" = { skips = "test" }
-"test/output-tests/dune_" = { file = "test/output-tests/dune", skips = "test" }
+"test/output-tests/dune_" = {
+ file = "test/output-tests/dune",
+ skips = [ "test", "dune" ] }
"test/output-tests/test2.ml" = { skips = "test" }
"test/output-tests/test1.expected" = { skips = "test" }
"test/output-tests/test2.expected" = { skips = "test" }
diff --git a/sphinx/about.rst b/sphinx/about.rst
index df06105f..8e6da016 100644
--- a/sphinx/about.rst
+++ b/sphinx/about.rst
@@ -27,4 +27,4 @@ With help and advises from:
* Raja Boujbel
* Albin Coquereau
* Guillaume Bury
-
+* Maxime Levillain
diff --git a/sphinx/commands.rst b/sphinx/commands.rst
index 8dddcceb..3af2e697 100644
--- a/sphinx/commands.rst
+++ b/sphinx/commands.rst
@@ -43,6 +43,9 @@ Overview of sub-commands::
odoc
Generate API documentation using odoc in the _drom/docs/doc directory
+ opam-plugin (since version 0.2.1)
+ Install drom as an opam plugin (called by 'opam drom')
+
package
Manage a package within a project
@@ -115,6 +118,8 @@ Where options are:
* :code:`--locked` (since version 0.2.1) Use .locked file if it exists
+* :code:`--profile PROFILE` Build profile to use
+
* :code:`--switch OPAM_SWITCH` Use global switch SWITCH instead of creating a local switch
* :code:`--upgrade` Upgrade project files from drom.toml
@@ -142,6 +147,8 @@ Where options are:
* :code:`--locked` (since version 0.2.1) Use .locked file if it exists
+* :code:`--profile PROFILE` Build profile to use
+
* :code:`--switch OPAM_SWITCH` Use global switch SWITCH instead of creating a local switch
* :code:`--upgrade` Upgrade project files from drom.toml
@@ -271,6 +278,8 @@ Where options are:
* :code:`--locked` (since version 0.2.1) Use .locked file if it exists
+* :code:`--profile PROFILE` Build profile to use
+
* :code:`--switch OPAM_SWITCH` Use global switch SWITCH instead of creating a local switch
* :code:`--upgrade` Upgrade project files from drom.toml
@@ -298,6 +307,8 @@ Where options are:
* :code:`--locked` (since version 0.2.1) Use .locked file if it exists
+* :code:`--profile PROFILE` Build profile to use
+
* :code:`--switch OPAM_SWITCH` Use global switch SWITCH instead of creating a local switch
* :code:`--upgrade` Upgrade project files from drom.toml
@@ -329,6 +340,8 @@ Where options are:
* :code:`--locked` (since version 0.2.1) Use .locked file if it exists
+* :code:`--profile PROFILE` Build profile to use
+
* :code:`--switch OPAM_SWITCH` Use global switch SWITCH instead of creating a local switch
* :code:`--upgrade` Upgrade project files from drom.toml
@@ -356,6 +369,8 @@ Where options are:
* :code:`--locked` (since version 0.2.1) Use .locked file if it exists
+* :code:`--profile PROFILE` Build profile to use
+
* :code:`--switch OPAM_SWITCH` Use global switch SWITCH instead of creating a local switch
* :code:`--upgrade` Upgrade project files from drom.toml
@@ -391,6 +406,8 @@ Where options are:
* :code:`--locked` (since version 0.2.1) Use .locked file if it exists
+* :code:`--profile PROFILE` Build profile to use
+
* :code:`--switch OPAM_SWITCH` Use global switch SWITCH instead of creating a local switch
* :code:`--upgrade` Upgrade project files from drom.toml
@@ -483,6 +500,8 @@ Where options are:
* :code:`--locked` (since version 0.2.1) Use .locked file if it exists
+* :code:`--profile PROFILE` Build profile to use
+
* :code:`--switch OPAM_SWITCH` Use global switch SWITCH instead of creating a local switch
* :code:`--upgrade` Upgrade project files from drom.toml
@@ -492,6 +511,35 @@ Where options are:
* :code:`-y` or :code:`--yes` Reply yes to all questions
+drom opam-plugin (since version 0.2.1)
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Install drom as an opam plugin (called by 'opam drom')
+
+
+
+**DESCRIPTION**
+
+
+This command performs the following actions:
+
+* 1.
+ Install drom executable in **$OPAMROOT/plugins/bin/opam-drom**
+
+* 2.
+ Install drom share files in **$OPAMROOT/plugins/opam-drom**, removing former files
+
+**USAGE**
+::
+
+ drom opam-plugin [OPTIONS]
+
+Where options are:
+
+
+* :code:`--remove` Remove drom as an opam plugin
+
+
drom package
~~~~~~~~~~~~~~
@@ -606,6 +654,8 @@ Where options are:
* :code:`--locked` (since version 0.2.1) Use .locked file if it exists
+* :code:`--profile PROFILE` Build profile to use
+
* :code:`--switch OPAM_SWITCH` Use global switch SWITCH instead of creating a local switch
* :code:`--upgrade` Upgrade project files from drom.toml
@@ -719,6 +769,8 @@ Where options are:
* :code:`-p PACKAGE` Package to run
+* :code:`--profile PROFILE` Build profile to use
+
* :code:`--switch OPAM_SWITCH` Use global switch SWITCH instead of creating a local switch
* :code:`--upgrade` Upgrade project files from drom.toml
@@ -764,6 +816,8 @@ Where options are:
* :code:`--locked` (since version 0.2.1) Use .locked file if it exists
+* :code:`--profile PROFILE` Build profile to use
+
* :code:`--switch OPAM_SWITCH` Use global switch SWITCH instead of creating a local switch
* :code:`--upgrade` Upgrade project files from drom.toml
@@ -809,6 +863,8 @@ Where options are:
* :code:`--locked` (since version 0.2.1) Use .locked file if it exists
+* :code:`--profile PROFILE` Build profile to use
+
* :code:`--switch OPAM_SWITCH` Use global switch SWITCH instead of creating a local switch
* :code:`--upgrade` Upgrade project files from drom.toml
@@ -878,6 +934,8 @@ Where options are:
* :code:`--locked` (since version 0.2.1) Use .locked file if it exists
+* :code:`--profile PROFILE` Build profile to use
+
* :code:`--switch OPAM_SWITCH` Use global switch SWITCH instead of creating a local switch
* :code:`--upgrade` Upgrade project files from drom.toml
@@ -923,6 +981,8 @@ Where options are:
* :code:`--locked` (since version 0.2.1) Use .locked file if it exists
+* :code:`--profile PROFILE` Build profile to use
+
* :code:`--switch OPAM_SWITCH` Use global switch SWITCH instead of creating a local switch
* :code:`--upgrade` Upgrade project files from drom.toml
diff --git a/sphinx/conf.py b/sphinx/conf.py
index 187d384c..a9b6662c 100644
--- a/sphinx/conf.py
+++ b/sphinx/conf.py
@@ -1,4 +1,3 @@
-
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
diff --git a/sphinx/index.rst b/sphinx/index.rst
index 070cbc55..f507ef8c 100644
--- a/sphinx/index.rst
+++ b/sphinx/index.rst
@@ -20,6 +20,7 @@ Welcome to drom doc
github
licenses
install
+ skeletons
API doc
license
diff --git a/sphinx/license.rst b/sphinx/license.rst
index 9fc75851..6b3a59c2 100644
--- a/sphinx/license.rst
+++ b/sphinx/license.rst
@@ -1,4 +1,3 @@
-
Copyright and License
=====================
diff --git a/sphinx/reference.rst b/sphinx/reference.rst
index bd167037..78c4fb0f 100644
--- a/sphinx/reference.rst
+++ b/sphinx/reference.rst
@@ -56,7 +56,7 @@ To get a feeling of what is in this file, we can look at the one used for
will generate files for Github Actions CI and Github pages.
"""
- [drom]
+ [project]
skip = "sphinx/about.rst src/drom_lib/main.ml sphinx/index.rst CHANGES.md test/expect-tests/test.ml ocamlformat"
[dependencies]
@@ -138,7 +138,54 @@ is specified, but can be overriden:
* :code:`doc-gen`: the URL where the general documentation can be found.
* :code:`homepage`: the URL of the project main homepage
+Another important field is the :code:`skip` field:
+
+* :code:`skip` contains a space-separated list of files, that
+ should not be modified anymore by :code:`drom`. By default,
+ :code:`drom` will generate any missing file, and upgrade any file
+ that was previously generated by :code:`drom` and not modified since
+ then. :code:`drom` will print a warning everytime it finds a
+ modified file. This option can be used to avoid this warning, or to
+ prevent :code:`drom` from recreating an unwanted file. :code:`drom`
+ generates a file :code:`_drom/maximum-skip-field.txt` showing all
+ the values that can appear in this field.
+
+ There is an exception for :code:`drom.toml` and :code:`package.toml`
+ files, that are only modified when the user configuration has been
+ changed, a changing option passed to :code:`drom project`, or the
+ :code:`--upgrade` option to benefit from a more recent version of
+ :code:`drom`.
+
+ :code:`skip` can also contains *tags*: such tags can be used to
+ reference several files, related to the tag itself. For example,
+ current skeletons use the following tags: :code:`code` (source
+ files), :code:`docs` (documentation), :code:`sphinx` (sphinx
+ documentation), :code:`test` (test files), :code:`github` (github
+ pages and workflows). More tags may be defined in the future.
+
+ To detect modifications of its files, :code:`drom` generates a file
+ `.drom` in the project. This file should be committed in the
+ repository with the files, so that :code:`drom` can always use it to
+ detect changes.
+
+ Every time :code:`drom` skips a file because it has been modified,
+ it saves the new version in the :code:`_drom/skipped/` directory.
+
+ For example, if :code:`drom` outputs::
+ [...]
+ Skipping modified file dune-project
+ [...]
+
+ You can use the command::
+
+ $ diff dune-project _drom/skipped/dune-project
+
+ to see the differences. if the differences are meaningless, you may
+ then decide to promote the new file by removing your file and
+ restarting :code:`drom`.
+
+
The :code:`[dependencies]` table
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -216,49 +263,6 @@ fields in the documentation of :code:`package.toml`.
-The :code:`[drom]` table
-~~~~~~~~~~~~~~~~~~~~~~~~
-
-This section contains fields changing the behavior of :code:`drom` for
-this project.
-
-* :code:`skip` contains a space-separated list of files, that should
- not be modified anymore by :code:`drom`. By default, :code:`drom`
- will generate any missing file, and upgrade any file that was
- previously generated by :code:`drom` and not modified since
- then. :code:`drom` will print a warning everytime it finds a
- modified file. This option can be used to avoid this warning, or to
- prevent :code:`drom` from recreating an unwanted file. :code:`drom`
- generates a file :code:`_drom/maximum-skip-field.txt` showing all
- the values that can appear in this field.
-
- An exception is the :code:`drom.toml` file itself. It is only
- modified when the user configuration has been changed, a changing
- option passed to :code:`drom project`, or the :code:`--upgrade` option
- to benefit from a more recent version of :code:`drom`.
-
- To detect modifications of its files, :code:`drom` generates a file
- `.drom` in the project. This file should be committed in the
- repository with the files, so that :code:`drom` can always use it to
- detect changes.
-
- Every time :code:`drom` skips a file because it has been modified,
- it saves the new version in the :code:`_drom/skipped/` directory.
-
- For example, if :code:`drom` outputs::
-
- [...]
- Skipping modified file dune-project
- [...]
-
- You can use the command::
-
- $ diff dune-project _drom/skipped/dune-project
-
- to see the differences. if the differences are meaningless, you may
- then decide to promote the new file by removing your file and
- restarting :code:`drom`.
-
The :code:`package.toml` Files
------------------------------
@@ -320,8 +324,8 @@ if not specified:
* :code:`synopsis`: the one-line description of the package
* :code:`version`: the version of this package
-Finally, there is a table :code:`[package.fields]` within a
-package. Currently, the following fields can be used by skeletons:
+Finally, there is a table :code:`[fields]` within a
+package. Currently, the following fields are used by skeletons:
* :code:`dune-libraries`: extra libraries that can be added in the
:code:`libraries` field of :code:`dune`. Typically for internal libraries.
@@ -330,7 +334,10 @@ package. Currently, the following fields can be used by skeletons:
:code:`dune` file.
* :code:`opam-trailer`: a string that is added at the end of the
:code:`opam` file for the package.
-
+
+In skeletons, *fields* are referenced using parens (for example
+:code:`!(dune-stanzas)`).
+
Skeletons
---------
@@ -345,10 +352,6 @@ There are two kinds of skeletons:
* *Package skeletons* are used to create and update package specific
files, mostly :code:`dune` and sources files
-Every skeleton is composed of a tree of files (possibly empty), a file
-:code:`SKELETON.toml` and a possible inheritance of another skeleton
-(in which case it inherits the tree of files and toml file).
-
When :code:`drom` is called in a project, it generates a file
:code:`_drom/known-skeletons.txt` listing all the skeletons it knows
about. Beware that, if you create a new skeleton, you will have to
@@ -361,9 +364,6 @@ Project Skeletons
Default project skeletons are defined in the source tree in:
`https://github.com/OCamlPro/drom/tree/master/src/drom_lib/skeletons/projects `__
-Additionally, the :code:`dune-trailer` rules in
-`https://github.com/OCamlPro/drom/blob/master/drom.toml `__ specify inheritance between skeletons.
-
The following project skeletons are available by default:
* The :code:`virtual` skeleton is for a "meta" project, i.e. a project
@@ -372,13 +372,186 @@ The following project skeletons are available by default:
be seen as the root of the inheritance tree between project
skeletons.
+ Files::
+
+ $ drom new VIRTUAL --skeleton virtual
+ └── VIRTUAL/
+ ├── .drom (drom state, do not edit)
+ ├── .github/
+ │ └── workflows/
+ │ ├── doc-deploy.yml
+ │ └── workflow.yml
+ ├── .gitignore
+ ├── .ocamlformat
+ ├── .ocamlformat-ignore
+ ├── .ocp-indent
+ ├── CHANGES.md
+ ├── LICENSE.md
+ ├── Makefile
+ ├── README.md
+ ├── docs/
+ │ ├── README.txt
+ │ ├── doc/
+ │ │ └── index.html
+ │ ├── favicon.png
+ │ ├── index.html
+ │ ├── sphinx/
+ │ │ └── index.html
+ │ └── style.css
+ ├── drom.toml <────────── project config EDIT !
+ ├── dune
+ ├── dune-project
+ ├── sphinx/
+ │ ├── _static/
+ │ │ └── css/
+ │ │ └── fixes.css
+ │ ├── about.rst
+ │ ├── conf.py
+ │ ├── index.rst
+ │ ├── install.rst
+ │ └── license.rst
+ ├── src/
+ │ └── VIRTUAL/
+ │ └── package.toml <────────── package config EDIT !
+ └── test/
+ ├── expect-tests/
+ │ ├── dune
+ │ └── test.ml
+ ├── inline-tests/
+ │ ├── dune
+ │ └── test.ml
+ └── output-tests/
+ ├── dune
+ ├── test1.expected
+ ├── test2.expected
+ └── test2.ml
+
+ Notice that there are no :code:`.opam` file generated by default
+ in the :code:`virtual` skeleton, until you add other packages using
+ :code:`drom package XXX --new SKELETON`
+
* The :code:`library` skeleton contains only a library package. It
inherits from the :code:`virtual` skeleton.
+ Files::
+
+ $ drom new LIBRARY --skeleton library
+ └── LIBRARY/
+ │
+ . (same as virtual )
+ .
+ ├── LIBRARY.opam
+ ├── src/
+ │ └── LIBRARY/
+ │ ├── dune
+ │ ├── index.mld
+ │ ├── main.ml
+ │ ├── package.toml <────────── package config EDIT !
+ │ └── version.mlt
+ └── test/
+ .
+ . (same as virtual )
+
* The :code:`program` skeleton contains both a library and a driver
packages. It inherits from the :code:`virtual` skeleton. It is the
default project skeleton used when nothing is specified.
+ Files::
+
+ $ drom new PROGRAM --skeleton program
+ └── PROGRAM/
+ │
+ . (same as virtual )
+ .
+ ├── PROGRAM.opam
+ ├── PROGRAM_lib.opam
+ ├── src/
+ │ ├── PROGRAM/
+ │ │ ├── dune
+ │ │ ├── index.mld
+ │ │ ├── main.ml
+ │ │ └── package.toml <────────── package config EDIT !
+ │ └── PROGRAM_lib/
+ │ ├── dune
+ │ ├── index.mld
+ │ ├── main.ml
+ │ ├── package.toml <────────── package config EDIT !
+ │ └── version.mlt
+ └── test/
+ .
+ . (same as virtual )
+
+* The :code:`mini-lib` skeleton contains a library package, with a minimal
+ set of files (no test, no docs, etc.) (since version 0.2.2)
+
+ Files::
+
+ $ drom new MINI-LIB --skeleton mini-lib
+ └── MINI-LIB/
+ ├── .drom (drom state, do not edit)
+ ├── .gitignore
+ ├── CHANGES.md
+ ├── LICENSE.md
+ ├── MINI-LIB.opam
+ ├── Makefile
+ ├── README.md
+ ├── drom.toml <────────── project config EDIT !
+ ├── dune
+ ├── dune-project
+ └── src/
+ └── MINI-LIB/
+ ├── dune
+ ├── package.toml <────────── package config EDIT !
+ └── version.mlt
+
+* The :code:`mini-prg` skeleton contains a program package, with a minimal
+ set of files (no test, no docs, etc.) (since version 0.2.2)
+
+ Files::
+
+ $ drom new MINI-PRG --skeleton mini-prg
+ └── MINI-PRG/
+ ├── .drom (drom state, do not edit)
+ ├── .gitignore
+ ├── CHANGES.md
+ ├── LICENSE.md
+ ├── MINI-PRG.opam
+ ├── MINI-PRG_lib.opam
+ ├── Makefile
+ ├── README.md
+ ├── drom.toml <────────── project config EDIT !
+ ├── dune
+ ├── dune-project
+ └── src/
+ ├── MINI-PRG/
+ │ ├── dune
+ │ └── package.toml <────────── package config EDIT !
+ └── MINI-PRG_lib/
+ ├── dune
+ ├── package.toml <────────── package config EDIT !
+ └── version.mlt
+
+* The :code:`ppx_deriver` skeleton contains a library package that defines
+ a *ppx_deriver*, with a minimal example of code. (since version 0.2.2)
+
+ Files::
+
+ $ drom new PPX_DERIVER --skeleton ppx_deriver
+ └── PPX_DERIVER/
+ │
+ . (same as virtual )
+ .
+ ├── PPX_DERIVER.opam
+ ├── src/
+ │ └── PPX_DERIVER/
+ │ ├── dune
+ │ ├── index.mld
+ │ ├── main.ml
+ │ ├── package.toml <────────── package config EDIT !
+ │ └── version.mlt
+ └── test/
+ .
+ . (same as virtual )
Package Skeletons
~~~~~~~~~~~~~~~~~
@@ -386,9 +559,6 @@ Package Skeletons
Default package skeletons are defined in the source tree in:
`https://github.com/OCamlPro/drom/tree/master/src/drom_lib/skeletons/packages `__
-Additionally, the :code:`dune-trailer` rules in
-`https://github.com/OCamlPro/drom/blob/master/drom.toml `__ specify inheritance between skeletons.
-
The following package skeletons are available by default:
* The :code:`virtual` skeleton is an empty skeleton.
@@ -396,6 +566,8 @@ The following package skeletons are available by default:
* The :code:`program` skeleton contains a simple program.
* The :code:`driver` skeleton contains a simple program that only
calls the main entry point of an associated library.
+* The :code:`ppx_deriver` skeleton contains a simple library that defines
+ a *ppx_deriver*.
Note that the project :code:`program` skeleton combines a
:code:`library` package skeleton with a :code:`driver` package
@@ -404,4 +576,4 @@ skeleton.
User-specified skeletons
~~~~~~~~~~~~~~~~~~~~~~~~
-Users can create their own skeleton... Need documentation.
+Users can create their own skeletons. Check the documentation on :ref:`Contributing skeletons`
diff --git a/sphinx/skeletons.rst b/sphinx/skeletons.rst
new file mode 100644
index 00000000..b3abc17e
--- /dev/null
+++ b/sphinx/skeletons.rst
@@ -0,0 +1,242 @@
+
+.. _Contributing skeletons:
+
+Contributing Your Own Skeletons
+===============================
+
+Overview
+--------
+
+There are 2 kinds of skeletons used to create and update :code:`drom`
+project:
+
+* *project skeletons* define a whole project composed of one or more packages
+* *package skeletons* define only one package, corresponding to every opam
+ package generated in the project
+
+:code:`drom` comes with a set of predefined skeletons. Users can
+contribute their own skeletons, either by adding them to their local
+configuration, or by submitting them to the :code:`drom` project.
+
+Skeleton Locations
+------------------
+
+When building its set of skeletons, :code:`drom` will search them in two
+directories:
+
+* A system directory. It is the first existing one in the following list:
+
+ * :code:`$DROM_SHARE_DIR/skeletons/`, i.e. using the :code:`$DROM_SHARED_DIR` environment variable
+ * any directory :code:`./share/drom/skeletons/` in one of the ancestor directories (:code:`.`, :code:`..`, :code:`../..`, etc.). This is used to test new skeletons directly from :code:`drom` sources.
+ * :code:`$OPAMROOT/plugins/opam-drom/skeletons/`, where :code:`$OPAMROOT` defaults to :code:`$HOME/.opam/` if undefined. This is used when :code:`drom` is installed as an :code:`opam` plugin, but can also be used when installed globally by the user.
+ * :code:`$OPAM_SWITCH_PREFIX/share/drom/skeletons/`. This is used when :code:`drom` is installed in the local switch only.
+ * :code:`${share-dir}/skeletons`, where :code:`${share-dir}` is the value of that variable in the user configuration file (:code:`$HOME/.config/drom/config`)
+
+* A user directory: :code:`$HOME/.config/drom/skeletons/`
+
+If a skeleton exists in both directories, the one in the user directory overwrites the one in the system directory. :code:`drom` will then complain about it.
+
+The Skeleton Format
+-------------------
+
+The :code:`skeletons/` folder is divided in two directories
+:code:`projects/` and :code:`packages/` for the two kinds of skeletons.
+
+Each directory contains one directory per skeleton, containing the
+following files:
+
+* :code:`skeleton.toml`: some information on the skeleton (name,
+ inheritance, additionnal information on files)
+* :code:`files/`: the template files, that will be instantiated for
+ that skeleton. For a project skeleton, the files are expected to be
+ instantiated at the root of the project (:code:`drom.toml`
+ location). For a package skeleton, the files are expected to be
+ instantiated in the package directory (:code:`package.toml` location)
+* :code:`project.toml`: for project skeletons, this file contains an
+ initial configuration for the project variables and packages. If the
+ skeleton is inherited from another one, the ancester configuration
+ is completed with the child configuration, with priority to the
+ child configuration, and so recursively. Note that this file
+ contains also the configuration of the packages, since no package
+ configuration is read from package skeletons for now.
+* :code:`package.toml`: this file is not used.
+
+Let's take an excerpt of a :code:`skeleton.toml` file::
+
+ [skeleton]
+ name = "program"
+ inherits = "virtual"
+
+ [file]
+ "Makefile" = { skips = [ "make" ] }
+ "dune-project_" = { file = "dune-project", skips = [ "dune" ] }
+ ...
+
+The file contains the following fields:
+
+* :code:`name` (mandatory): the name of the skeleton
+* :code:`inherits` (optional): the name of a skeleton from which this
+ skeleton inherits
+* :code:`[file]` section (optional): a set of fields to configure the
+ use of one of the files in the :code:`files/` directory. Currently,
+ the following fields are availble:
+
+ * :code:`file`: the name under which the file should be
+ instantiated. This is useful if you cannot use the real name of
+ the file in the skeleton, for example because the name would
+ conflict with tools used in the project (dot files, :code:`dune`
+ files, etc)
+ * :code:`skips`: a list of tags that can be used in the
+ :code:`drom.toml` :code:`skip` option or :code:`--skip` argument to
+ skip this file.
+ * :code:`create`: whether the file should only be created if it
+ doesn't exist yet (:code:`true`) or every time (:code:`false`,
+ default).
+ * :code:`subst`: whether substitutions should happen on the file
+ (:code:`true`, default) or not (:code:`false`). Useful for binary
+ files for example to avoid accidental substitutions.
+ * :code:`skip`: whether the file should be always skipped
+ (:code:`true`) or not (:code:`false`, default). Useful for a
+ documentation file in the skeleton files.
+ * :code:`record`: whether the file should recorded in :code:`git`
+ files and in the :code:`.drom` state file (:code:`true`,
+ default). Useful for documentation files that are only to help the
+ user, not to remain in the project.
+
+The Skeleton Substitution Language
+----------------------------------
+
+Substitutions are performed on files in skeletons if the :code:`subst`
+field is not set to :code:`false` in the :code:`skeleton.toml` file
+(see above).
+
+There are 3 kinds of substitutions happening:
+
+* Brace substitutions (:code:`!{xxx}`): these substitutions are
+ hardcoded in :code:`drom` to generate specific information for the
+ project or package.
+* Paren substitutions (:code:`!(xxx)`): these substitutions replace
+ the variable with its value, respectively, for a project, in the
+ :code:`[fields]` section of the :code:`drom.toml`, or for a package,
+ in the :code:`[fields]` section of the :code:`package.toml` or in
+ the :code:`[package.fields]` section of the package in the
+ :code:`drom.toml` file.
+* Bracket substitutions (:code:`![xxx]`): these substitutions always
+ return an empty string. They are used for side-effects on the
+ substitutions (conditional substitutions, setting flags, etc.)
+
+Brace and paren substitutions can be combined with encodings by using
+a :code:`:ENCODING` extension. For example, :code:`!{name:upp}` is
+replaced by the name of the project/package in uppercase.
+
+The following encodings are available:
+* :code:`html`: html encoding (:code:`&` is replaced by :code:`&`, etc.)
+* :code:`cap`: set the first char to uppercase
+* :code:`uncap`: set the first char to lowercase
+* :code:`low`: lowercase
+* :code:`uncap`: uppercase
+* :code:`alpha`: replace all non-alpha chars by underscores
+
+For *package* substitutions, brace and paren substitutions for the
+*project* are used if no substitution was found for the *package*. It
+is possible to force *project* substitution in a *package* using the
+:code:`project-` prefix (:code:`!{project-name}` for example in a
+package file for the :code:`name` substitution of the
+project). Reciprocally, it is possible to use a :code:`package-`
+prefix in a Paren (field) substitution to prevent a project
+substitution if the field is not defined in the package.
+
+Brace Substitutions
+~~~~~~~~~~~~~~~~~~~
+
+The ultimate source of information for Brace substitutions is the
+`subst.ml module
+`__
+in the :code:`project_brace` and :code:`package_brace` fuctions.
+
+Currently, the following *project* substitutions are available:
+
+* :code:`!{escape:true}`... :code:`!{escape:false}`: makes :code:`\!{`
+ be replaced by :code:`!{` instead of starting a substitution.
+* :code:`!{name}`: the project name
+* :code:`!{synopsis}`: the project synopsis
+* :code:`!{description}`: the project description
+* :code:`!{version}`: the project version
+* :code:`!{edition}`: the default OCaml version to use
+* :code:`!{min-edition}`: the minimal OCaml version
+* :code:`!{github-organization}`: the current github-organization
+* :code:`!{authors-as-strings}`: the list of authors
+* :code:`!{authors-for-toml}`: the list of authors in TOML
+* :code:`!{authors-ampersand}`: the authors separated by ampersands
+* :code:`!{copyright}`: the project copyright
+* :code:`!{license}`: the project full license file
+* :code:`!{license-name}`: the SPDF name of the project license
+* :code:`!{header-ml}`: the header for an ML file (also MLL file)
+* :code:`!{header-c}`: the header for a C file (also MLY file)
+* :code:`!{year}`, :code:`!{month}`, :code:`!{day}`: current date
+* There are many other substitutions, for example specific to Dune
+ files (like :code:`!{dune-packages}` for the :code:`dune-project`
+ file). Some of them will disappear because they can be generated
+ using conditionals (:code:`![if:...]`, see bracket substitutions),
+ some of them will be documented later (TODO).
+
+Currently, the following *package* substitutions are available:
+
+* :code:`!{name}`: the package name
+* :code:`!{dir}`: the package dir
+* :code:`!{skeleton}`: the package skeleton
+* :code:`!{library-name}`: the package library name (uncapitalized version of
+ the :code:`pack` option or underscorified version of the package name)
+* :code:`!{library-module}`: the package module name (:code:`pack` option
+ or capitalized version of the package name)
+
+Paren Substitutions (project and package fields)
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Paren substitutions are substituted by the :code:`[fields]` variables
+in the project/package description files. If the field is not defined,
+the substitution is replaced by the empty string. Such fields are
+often used for trailers in generated files, to keep using :code:`drom`
+to update them while still adding specific information by hand.
+
+Currently, the following paren substitutions are used in *project*
+skeletons:
+
+* :code:`!(dot-gitignore-trailer)`: a trailer added at the end of the
+ :code:`.gitignore` file
+* :code:`!(dune-dirs)`: a string added in the :code:`(dirs ...)`
+ stanza of the root :code:`dune` files to specify which dirs should
+ be scanned.
+* :code:`!(makefile-trailer)`: a trailer added at the end of the
+ generated :code:`Makefile`
+
+Currently, the following paren substitutions are used in *package*
+skeletons:
+
+* :code:`!(dune-libraries)`: a string added in the :code:`(libraries
+ ...)` stanza of the generated :code:`dune` file
+* :code:`!(dune-stanzas)`: a string added in the :code:`(executable
+ ...)` or :code:`(library ...)` stanza of the generated
+ :code:`dune` file
+* :code:`!(dune-trailer)`: a string added at the end of the generated
+ :code:`dune` file
+
+Bracket Substitutions
+~~~~~~~~~~~~~~~~~~~~~
+
+The following bracket substitutions are currently available:
+
+* :code:`![if:CONDITION]`... :code:`![else]` ... :code:`![fi]`:
+ depending on the condition, replace by the first or second part.
+ The condition can be:
+
+ * :code:`not:CONDITION`: negation of a condition
+ * :code:`skip:TAG`: true if the tag should be skipped
+ * :code:`gen:TAG`: true if the tag should not be skipped
+ * :code:`true` and :code:`false`: constants
+ * :code:`skeleton:is:SKELETON`: true is the current skeleton is the argument
+ * :code:`kind:is:KIND`: true if the kind of the *package* is the argument (kind is one of :code:`library`, :code:`program` or :code:`virtual`)
+ * :code:`pack`: true if the *package* should be packed
+ * :code:`windows-ci`: true if the *project* should run Windows CI
+ * :code:`github-organization`, :code:`homepage`, :code:`copyright`, :code:`bug-reports`, :code:`dev-repo`, :code:`doc-gen`, :code:`doc-api`, :code:`sphinx-target`, :code:`profile`: true if the corresponding value is defined for the project
+ * :code:`project:CONDITION`: in a *package*, check if the condition is true for the project instead
diff --git a/src/drom/index.mld b/src/drom/index.mld
index c4240a80..91b000e0 100644
--- a/src/drom/index.mld
+++ b/src/drom/index.mld
@@ -1,4 +1,3 @@
-
{1 Program drom}
The drom tool is a wrapper over opam/dune in an attempt to provide a cargo-like
diff --git a/src/drom_lib/dune.ml b/src/drom_lib/dune.ml
index 71efabd0..abc0f44e 100644
--- a/src/drom_lib/dune.ml
+++ b/src/drom_lib/dune.ml
@@ -57,19 +57,8 @@ let package_dune_files package =
end;
Buffer.contents b
-let template_dune_project p =
+let packages p =
let b = Buffer.create 100000 in
- Printf.bprintf b
- {|(lang dune 2.0)
-; This file was generated by drom, using drom.toml
-(name %s)
-(allow_approximate_merlin)
-(generate_opam_files false)
-(version %s)
-(formatting (enabled_for ocaml reason))
-|}
- p.package.name p.version;
-
let add_package package =
Printf.bprintf b {|
(package
@@ -120,33 +109,3 @@ let template_dune_project p =
List.iter add_package p.packages;
Buffer.contents b
-
-(*
-let template_dune p =
- let b = Buffer.create 1000 in
- Printf.bprintf b "; This file was generated by drom, using drom.toml\n";
- Printf.bprintf b "(env\n";
- StringMap.iter
- (fun name profile ->
- Printf.bprintf b " (%s\n" name;
- StringMap.iter
- (fun name value ->
- Printf.bprintf b " (%s %s%s)\n"
- ( match name with
- | "ocaml" -> "flags (:standard"
- | "odoc" -> "odoc"
- | "coq" -> "coq ("
- | tool -> tool ^ "_flags" )
- value
- ( match name with
- | "coq" -> ")" (* (coq (flags XXX)) *)
- | "ocaml" -> ")"
- | _ -> "" ))
- profile.flags;
- Printf.bprintf b " )\n")
- p.profiles;
- Printf.bprintf b ")\n";
- if p.skip_dirs <> [] then
- Printf.bprintf b "(data_only_dirs %s)\n" (String.concat " " p.skip_dirs);
- Buffer.contents b
-*)
diff --git a/src/drom_lib/index.mld b/src/drom_lib/index.mld
index 4ebaed21..d536a680 100644
--- a/src/drom_lib/index.mld
+++ b/src/drom_lib/index.mld
@@ -1,4 +1,3 @@
-
{1 Library drom_lib}
The drom tool is a wrapper over opam/dune in an attempt to provide a cargo-like
@@ -7,4 +6,6 @@ sphinx and odoc documentation. It has specific knowledge of Github and
will generate files for Github Actions CI and Github pages.
+
The entry point of this library is the module: {!Drom_lib}.
+
diff --git a/src/drom_lib/license.ml b/src/drom_lib/license.ml
index 85ba1f53..f8dcfe30 100644
--- a/src/drom_lib/license.ml
+++ b/src/drom_lib/license.ml
@@ -143,6 +143,8 @@ let header_mll p = header p
let header_mly p = header ~sep:c_sep p
+let header_c p = header ~sep:c_sep p
+
let license p =
let key = p.license in
try
diff --git a/src/drom_lib/misc.ml b/src/drom_lib/misc.ml
index f63ba421..27d9283f 100644
--- a/src/drom_lib/misc.ml
+++ b/src/drom_lib/misc.ml
@@ -323,3 +323,12 @@ let string_of_kind = function
| Program -> "program"
| Library -> "library"
| Virtual -> "virtual"
+
+let project_skeleton = function
+ | None -> "program"
+ | Some skeleton -> skeleton
+
+let package_skeleton package =
+ match package.p_skeleton with
+ | Some skeleton -> skeleton
+ | None -> string_of_kind package.kind
diff --git a/src/drom_lib/skeleton.ml b/src/drom_lib/skeleton.ml
index 46c523d9..ba8185af 100644
--- a/src/drom_lib/skeleton.ml
+++ b/src/drom_lib/skeleton.ml
@@ -217,29 +217,30 @@ let backup_skeleton file content =
EzFile.make_dir ~p:true (Filename.dirname drom_file);
EzFile.write_file drom_file content
-let project_skeleton = function
- | None -> "program"
- | Some skeleton -> skeleton
-
-let package_skeleton package =
- match package.p_skeleton with
- | Some skeleton -> skeleton
- | None -> Misc.string_of_kind package.kind
-
let lookup_project skeleton =
- lookup_skeleton project_skeletons (project_skeleton skeleton)
+ lookup_skeleton project_skeletons (Misc.project_skeleton skeleton)
let lookup_package skeleton = lookup_skeleton package_skeletons skeleton
let rec eval_project_cond p cond =
match cond with
| [ "skeleton" ; "is" ; skeleton ] ->
- project_skeleton p.skeleton = skeleton
+ Misc.project_skeleton p.skeleton = skeleton
| [ "skip" ; skip ] -> List.mem skip p.skip
| [ "gen" ; skip ] -> not ( List.mem skip p.skip )
| "not" :: cond -> not ( eval_project_cond p cond )
| [ "true" ] -> true
| [ "false" ] -> false
+ | [ "windows-ci" ] -> p.windows_ci
+ | [ "github-organization"] -> p.github_organization <> None
+ | [ "homepage"] -> Misc.homepage p <> None
+ | [ "copyright"] -> p.copyright <> None
+ | [ "bug-reports"] -> Misc.bug_reports p <> None
+ | [ "dev-repo"] -> Misc.dev_repo p <> None
+ | [ "doc-gen"] -> Misc.doc_gen p <> None
+ | [ "doc-api"] -> Misc.doc_api p <> None
+ | [ "sphinx-target"] -> p.sphinx_target <> None
+ | [ "profile"] -> p.profile <> None
| _ ->
Printf.kprintf failwith "eval_project_cond: unknown condition %S\n%!"
( String.concat ":" cond )
@@ -247,7 +248,7 @@ let rec eval_project_cond p cond =
let rec eval_package_cond p cond =
match cond with
| [ "skeleton" ; "is" ; skeleton ] ->
- package_skeleton p = skeleton
+ Misc.package_skeleton p = skeleton
| [ "kind" ; "is" ; kind ] -> kind = Misc.string_of_kind p.kind
| [ "pack" ] -> Misc.p_pack_modules p
| [ "skip" ; skip ] -> List.mem skip p.project.skip
@@ -255,6 +256,7 @@ let rec eval_package_cond p cond =
| "not" :: cond -> not ( eval_package_cond p cond )
| [ "true" ] -> true
| [ "false" ] -> false
+ | "project" :: cond -> eval_project_cond p.project cond
| _ ->
Printf.kprintf failwith "eval_package_cond: unknown condition %S\n%!"
( String.concat ":" cond )
@@ -305,7 +307,7 @@ let write_project_files write_file p =
()
let write_package_files write_file package =
- let skeleton = lookup_package (package_skeleton package) in
+ let skeleton = lookup_package (Misc.package_skeleton package) in
List.iter
(fun (file, content) ->
diff --git a/src/drom_lib/subst.ml b/src/drom_lib/subst.ml
index 9ea7dddc..426282d6 100644
--- a/src/drom_lib/subst.ml
+++ b/src/drom_lib/subst.ml
@@ -35,6 +35,7 @@ let project_brace (_, p) v =
| "name" -> p.package.name
| "synopsis" -> p.synopsis
| "description" -> p.description
+ | "skeleton" -> Misc.project_skeleton p.skeleton
| "version" -> p.version
| "edition" -> p.edition
| "min-edition" -> p.min_edition
@@ -50,8 +51,9 @@ let project_brace (_, p) v =
| "license" -> License.license p
| "license-name" -> p.license
| "header-ml" -> License.header_ml p
- | "header-mll" -> License.header_mll p
+ | "header-c" -> License.header_c p
| "header-mly" -> License.header_mly p
+ | "header-mll" -> License.header_mll p
| "authors-ampersand" -> String.concat " & " p.authors
(* general *)
| "year" -> (Misc.date ()).Unix.tm_year |> string_of_int
@@ -284,6 +286,8 @@ let project_brace (_, p) v =
) p.packages;
) p.share_dirs;
Buffer.contents b
+
+ | "dune-packages" -> Dune.packages p
| s ->
Printf.eprintf "Error: no project substitution for %S\n%!" s;
raise Not_found
@@ -298,14 +302,14 @@ let project_paren (_, p) name =
let package_brace (context, package) v =
match v with
| "name"
- | "package-name" ->
- package.name
+ | "package-name" -> package.name
+ | "skeleton" -> Misc.package_skeleton package
| "library-name" -> Misc.library_name package
| "pack" -> Misc.library_module package
+ | "kind" -> Misc.string_of_kind package.kind
| "modules" -> String.concat " " (Misc.modules package)
| "dir"
- | "package-dir" ->
- package.dir
+ | "package-dir" -> package.dir
| "pack-modules" -> string_of_bool (Misc.p_pack_modules package)
| "dune-libraries" ->
let dependencies =
diff --git a/src/drom_lib/update.ml b/src/drom_lib/update.ml
index 44f1b9c6..246c9273 100644
--- a/src/drom_lib/update.ml
+++ b/src/drom_lib/update.ml
@@ -245,8 +245,6 @@ let update_files ?args ?mode ?(git = false) ?(create = false) p =
Git.call [ "commit"; "--allow-empty"; "-m"; "Initial commit" ];
);
- write_file hashes "dune-project" (Dune.template_dune_project p);
-
List.iter
(fun package ->
match package.kind with
diff --git a/src/drom_lib/version.mlt b/src/drom_lib/version.mlt
index 62a92eb7..68bfbbf6 100644
--- a/src/drom_lib/version.mlt
+++ b/src/drom_lib/version.mlt
@@ -13,7 +13,7 @@ let query cmd =
let commit_hash = query "git show -s --pretty=format:%H"
let commit_date = query "git show -s --pretty=format:%ci"
-let version = "0.2.1"
+let version = "0.2.2"
let version =
match commit_hash with
| Some commit_hash ->