Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a package field to the cinaps stanza #11232

Open
NathanReb opened this issue Dec 19, 2024 · 4 comments
Open

Add a package field to the cinaps stanza #11232

NathanReb opened this issue Dec 19, 2024 · 4 comments

Comments

@NathanReb
Copy link
Collaborator

The cinaps stanza does not support the package field at the moment, making all packages in a multi opam repo depend on cinaps, even if just as a test dep.

It would be nice to have a way to restrict these to a specific package.

@rgrinberg
Copy link
Member

How do all packages in a multi opam repo end up depending on cinaps?

@NathanReb
Copy link
Collaborator Author

When I try running dune runtest -p <pkg-that-does-not-depend-on-cinaps> without cinaps installed, I get a set of errors such as this:

$ dune runtest -p ppxlib-tools
File "astlib/dune", lines 15-17, characters 0-63:
15 | (cinaps
16 |  (files *.ml *.mli)
17 |  (libraries astlib_cinaps_helpers))
Error: Library "cinaps.runtime" not found.
-> required by _build/default/astlib/.cinaps.d65f99e1/cinaps.exe
-> required by alias astlib/cinaps in astlib/dune:15
-> required by alias astlib/runtest

Those files belong to libraries that are part of a different packages but the cinaps rules attached to the @runtest alias are still executed.

Is there another way I could maybe let dune know not to run those outside of a certain package?

@rgrinberg
Copy link
Member

Can you post the entirety of astlib/dune?

@NathanReb
Copy link
Collaborator Author

Sure:

(library
 (name astlib)
 (public_name ppxlib.astlib)
 (libraries ocaml-compiler-libs.common compiler-libs.common)
 (flags -w -9)
 (preprocess
  (action
   (run %{exe:pp/pp.exe} %{read:ast-version} %{input-file}))))

(rule
 (targets ast-version)
 (action
  (run %{ocaml} %{dep:config/gen.ml} %{ocaml_version})))

(cinaps
 (files *.ml *.mli)
 (libraries astlib_cinaps_helpers))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants