ocaml / ocaml/dune

Controlling precedence of data_only_dirs vs vendored_dirs

Open
#7,589 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

build
Dominant language
OCaml
Stars
1.9k
Forks
500
Avg merge
15h 21m
Merged PRs (30d)
277

Description

  • The current stage of dune about directory status is:

    You can't have data_only_dirs and vendored_dirs at the same time and that is logic.

    > cat dune
    (vendored_dirs subproject)
    (data_only_dirs subproject)
    
    > dune build 
    Error: Directory subproject was marked as data_only and vendored, it can't be
    marked as both.
    

    But you can have (dirs :standard \ subproject) combine with (data_only_dirs subproject) or (vendored_dirs subproject).

    The status (data_only_dirs subproject) or (vendored_dirs subproject) override (dirs :standard \ subproject), why this specification ?

    And what is weird to me is (dirs :standard \ subproject) is equivalent to (data_only_dirs subproject).

  • The need we have is at the moment is:
    A possibility, (dirs :standard \ subproject) override data_only_dirs and/or vendored_dirs instead inverse. This avoids the conflict(ocaml-dockerfile) described below.

    An example: this is a partial tree of solver-service

    > tree solver-service
    solver-service
        |_ dune
        |_ dune-project
        |_ ocaml-dockerfile
            |_ dune-project
        |_ ocaml-ci
            |_ dune
            |_ dune-project
            |_ ocaml-dockerfile
                 |_ dune-project
         
    > cat solver-service/dune
    (vendored_dirs ocaml-dockerfile) ...
    > cat soler-service/ocaml-ci/dune
    (vendored_dirs ocaml-dockerfile) ...
    
    > cd solver-service
    > dune build
    Error: Too many opam files for package "dockerfile-opam":
    - ocaml-ci/ocaml-dockerfile/dockerfile-opam.opam
    - ocaml-dockerfile/dockerfile-opam.opam
    
  • The central point of this PR is to introduce or improve the spec around statuses:

    Getting the prioritization as following (dirs :standard \ subproject) -> (data_only_dirs subproject) -> (vendored_dirs subproject) .

    It is opened to modification, to get the possibility that (dirs :standard \ subproject) override data_only_dirs and/or vendored_dirs without touching the previous relation between data_only_dirs and vendored_dirs.

Originally posted by @moyodiallo in https://github.com/ocaml/dune/issues/6577#issuecomment-1514553706

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No implementation files or tests are named. Start by reproducing the two dune build examples from issue #7589, then trace how dirs, data_only_dirs, and vendored_dirs statuses are specified and prioritized. Done means the precedence is explicitly specified and the nested ocaml-dockerfile case no longer produces the conflicting package-discovery result.

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
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.