Quantcast
Channel: OCaml - Topics tagged dune
Viewing all articles
Browse latest Browse all 527

Working on a local project with opam

$
0
0

Hello :slightly_smiling_face:

Disclaimer:
I am a total beginner with opam as I am normally using esy as my package manager. But I wanted to try out opam just as a learning experience.

I did setup a local development environment as follows:

  1. I downloaded and installed opam 2.1.2 on my mac
  2. I am installing my projects dependencies with the following makefile command:
    if ! [ -e _opam ]; then \
      opam switch create . --empty --yes &&
      opam install --yes ocaml.4.14.0 ;
    fi
    opam install ./*.opam --deps-only --locked --with-test --yes
    
  3. I want to build my project with the following command:
    opam exec --working-dir -- dune build --root . --profile=release @all
    

This works for all files, which are already checked in to the git repository.
If I however want to add new files and build the project locally, dune doesn’t seem to know of the new files:
(creating a new file test.ml)

34 |   open Test
            ^^^^
Error: Unbound module Test

I thought the --working-dir flag is used to tell opam to look into the source files for changes as opposed to looking into the git repository, but this doesn’t seem to be the case.

So my question(s) would be:
How do I test the changes I made to my library locally (before committing them into git)?
And more generally, why does opam even care about the current state of my git repository?

Thank you for your help!
- Torben

3 posts - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 527

Trending Articles