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

check opam switch - compatible #11569

Merged
merged 10 commits into from
Aug 29, 2022

Conversation

ylecornec
Copy link
Collaborator

@ylecornec ylecornec commented Jul 26, 2022

See #11570 for the develop version of this PR.

This PR enables the check_opam_switch tool, that provides two binaries to check that the current opam switch contains the packages from the opam.export file (at the same version):

  • check_opam_switch simply does the check,
  • dune_wrapper does the check before invoking dune (so it is possible to keep using dune as usual (with an alias) but notice early when the switch needs to be updated).

Other changes:

  • The opam.export file was moved to the root of the dune project, as expected by dune_wrapper by default (this way it is simpler to use dune_wrapper in multiple projects).

  • The check was added to the ocaml_checks rule of the makefile (to notice early that the switch needs to be updated when compiling the project from the makefile).

See issue #10982 and PR #11450 for context.

@ylecornec ylecornec added Tweag ci-build-me Add this label to trigger a circle+buildkite build for this branch labels Jul 26, 2022
@ylecornec ylecornec force-pushed the ylecornec/check_opam_switch-compatible branch from 3f31097 to e71ce26 Compare July 26, 2022 16:26
@ylecornec ylecornec marked this pull request as ready for review July 27, 2022 08:15
@ylecornec ylecornec requested review from a team as code owners July 27, 2022 08:15
@ylecornec ylecornec requested a review from mimoo July 27, 2022 08:15
Makefile Show resolved Hide resolved
README-dev.md Outdated Show resolved Hide resolved
Copy link
Contributor

@mimoo mimoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great!

Copy link
Member

@mrmr1993 mrmr1993 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but see question in comments.

@@ -51,6 +51,7 @@ inputs: pkgs: {
buildPhase = "make check-format";
installPhase = "touch $out";
meta.checkDescription = "that OCaml code is formatted properly";
DISABLE_CHECK_OPAM_SWITCH = "true";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not entirely convinced that we should skip the check here: using the wrong opam.export may give us different formatting, depending on the version of ocamlformat.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(btw I think the ocamlformat version should be enforced with an .ocamlformat file)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this check, the environment is managed via nix and not opam, so the check_opam_switch tool does not work in this case.

It should not be needed however as nix directly reads the opam.export file to setup the environment.

@ylecornec ylecornec merged commit df61b67 into compatible Aug 29, 2022
@ylecornec ylecornec deleted the ylecornec/check_opam_switch-compatible branch August 29, 2022 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci-build-me Add this label to trigger a circle+buildkite build for this branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants