Skip to content

Commit

Permalink
[opam] Move the opam files to an opam directory at repo root
Browse files Browse the repository at this point in the history
Summary:
This diff renames and moves the opam package definition files to
`<package>.opam` in an `opam` directory at the root of the
repository. This enables opam pinning the different packages contained
in the repo. It is necessary for these files to be either at the root
of the repo or in a directory named `opam` at the root of the repo, or
else opam cannot find them.

Reviewed By: skcho

Differential Revision: D27326495

fbshipit-source-id: 4c95c6955
  • Loading branch information
jberdine authored and facebook-github-bot committed Mar 29, 2021
1 parent 3783c52 commit 673c944
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ jobs:
uses: actions/cache@v2
with:
path: ~/.opam
key: opam-${{ runner.os }}-${{ hashFiles('opam.locked') }}
key: opam-${{ runner.os }}-${{ hashFiles('opam/infer.opam.locked') }}

- name: Use OCaml ${{ matrix.ocaml-version }}
uses: avsm/setup-ocaml@v1
Expand Down
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,13 +225,13 @@ $ infer --debug -- clang -c examples/hello.c
$ firefox infer-out/captured/hello.c.*.html
```

## Updating opam and opam.locked
## Updating infer.opam and infer.opam.locked

tl; dr: Run `make opam.locked`.
tl; dr: Run `make opam/infer.opam.locked`.

opam.locked records fixed versions of the opam dependencies known to work with infer and to respect
infer.opam.locked records fixed versions of the opam dependencies known to work with infer and to respect
the constraints in opam. This prevents unpredictable breakages of infer or its dependencies,
especially for infer releases, for which it is more difficult to change their package constraints
after the fact.

To add an opam package or update its version constraints, edit 'opam' then run `make opam.locked`.
To add an opam package or update its version constraints, edit 'infer.opam' then run `make infer.opam.locked`.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -845,14 +845,14 @@ conf-clean: clean


# phony because it depends on opam's internal state
.PHONY: opam.locked
opam.locked: opam
.PHONY: opam/infer.opam.locked
opam/infer.opam.locked: opam/infer.opam
# allow users to not force a run of opam update since it's very slow
ifeq ($(NO_OPAM_UPDATE),)
$(QUIET)$(call silent_on_success,opam update,$(OPAM) update)
endif
$(QUIET)$(call silent_on_success,generating opam.locked,\
$(OPAM) lock .)
$(QUIET)$(call silent_on_success,generating opam/infer.opam.locked,\
$(OPAM) lock opam/infer.opam)

OPAM_DEV_DEPS = ocp-indent merlin utop webbrowser

Expand Down
4 changes: 2 additions & 2 deletions build-infer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function usage() {
echo
echo " options:"
echo " -h,--help show this message"
echo " --no-opam-lock do not use the opam.locked file and let opam resolve dependencies"
echo " --no-opam-lock do not use the opam/infer.opam.locked file and let opam resolve dependencies"
echo " --only-setup-opam initialize opam, install the opam dependencies of infer, and exit"
echo " --user-opam-switch use the current opam switch to install infer (default: $INFER_OPAM_DEFAULT_SWITCH)"
echo " -y,--yes automatically agree to everything"
Expand Down Expand Up @@ -135,7 +135,7 @@ install_opam_deps () {
if [ "$USE_OPAM_LOCK" == yes ]; then
locked=--locked
fi
opam install --deps-only infer "$INFER_ROOT" $locked &&
opam install --deps-only "$INFER_ROOT"/opam/infer.opam $locked &&
if [ -n "$SANDCASTLE" ]; then
opam pin list | grep yojson || opam pin add yojson "${DEPENDENCIES_DIR}/yojson-1.7.0fix"
fi
Expand Down
2 changes: 1 addition & 1 deletion m4/ac_assert_ocaml_pkg.m4
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ AC_DEFUN([AC_ASSERT_OCAML_PKG],
If you are using opam, please run
opam update
opam install --deps-only infer .])
opam install --deps-only opam/infer.opam])
])
])
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion sledge/sledge.opam → opam/sledge.opam
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ bug-reports: "https://github.com/facebook/infer/issues/new?template=sledge_issue
dev-repo: "git://github.com/facebook/infer.git"
license: "MIT"
build: [
[make "release"]
[make "-C" "sledge" "release"]
]
depends: [
"ocaml"
Expand Down

0 comments on commit 673c944

Please sign in to comment.