Disable subparts of a project
Nobody has claimed this yet.
- Dominant language
- OCaml
- Stars
- 1.9k
- Forks
- 500
- Avg merge
- 15h 21m
- Merged PRs (30d)
- 277
Description
Desired Behavior
I try to replace a configure file with dune-configurator. One important feature of our configure file is the ability to disable parts of the complete system:
$ ./configure --disable-foo
It prevents feature foo to be compiled, tested, and installed. Which is useful for both users and (mostly) developers.
We have the following architecture:
- dune project
- dune
- src/plugins/
- p1
- dune-project
- dune
- p2
...
...
Currently, when at least one plugin is disabled, the configure generates a dune file in src/plugins, that contains:
(include_subdirs no)
(data_only_dirs <disabled-plugins-directories>)
But, as far as i understand, it is not possible to do that with dune-configurator since we cannot generate a dune file that would be immediately used by the current build process.
Example
My initial idea was to generate a .enabled file in each plugin directory (each containing true or false), and to modify plugins dune file like this:
(library
(name p1)
(optional)
(public_name proj-p1.core)
(enabled_if %{read:.enabled}) ; << added line
(libraries proj.kernel))
However, it happens that dune does not like it, and asks me to file this issue:
File "src/plugins/p1/dune", line 38, characters 14-30:
38 | (enabled_if %{read:.enabled})
^^^^^^^^^^^^^^^^
Error: Only architecture, system, model, os_type, ccomp_type, profile,
ocaml_version and context_name variables are allowed in this 'enabled_if'
field. If you think that read should also be allowed, please file an issue
about it.
Is there something we can do about it? Did I miss a simpler solution?
(FYI @bobot)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the plugin layout under src/plugins/, the plugin dune files such as src/plugins/p1/dune, and the generated src/plugins/dune described in the issue. Investigate how dune-configurator output is consumed during the current build and the restrictions on enabled_if; done should provide a supported way to disable a plugin from compilation, testing, and installation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ocaml
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100