[opam] Move the opam files to an opam directory at repo root

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
master
Josh Berdine 4 years ago committed by Facebook GitHub Bot
parent 3783c52a76
commit 673c944fc3

@ -99,7 +99,7 @@ jobs:
uses: actions/cache@v2 uses: actions/cache@v2
with: with:
path: ~/.opam path: ~/.opam
key: opam-${{ runner.os }}-${{ hashFiles('opam.locked') }} key: opam-${{ runner.os }}-${{ hashFiles('opam/infer.opam.locked') }}
- name: Use OCaml ${{ matrix.ocaml-version }} - name: Use OCaml ${{ matrix.ocaml-version }}
uses: avsm/setup-ocaml@v1 uses: avsm/setup-ocaml@v1

@ -225,13 +225,13 @@ $ infer --debug -- clang -c examples/hello.c
$ firefox infer-out/captured/hello.c.*.html $ 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, 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 especially for infer releases, for which it is more difficult to change their package constraints
after the fact. 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`.

@ -845,14 +845,14 @@ conf-clean: clean
# phony because it depends on opam's internal state # phony because it depends on opam's internal state
.PHONY: opam.locked .PHONY: opam/infer.opam.locked
opam.locked: opam opam/infer.opam.locked: opam/infer.opam
# allow users to not force a run of opam update since it's very slow # allow users to not force a run of opam update since it's very slow
ifeq ($(NO_OPAM_UPDATE),) ifeq ($(NO_OPAM_UPDATE),)
$(QUIET)$(call silent_on_success,opam update,$(OPAM) update) $(QUIET)$(call silent_on_success,opam update,$(OPAM) update)
endif endif
$(QUIET)$(call silent_on_success,generating opam.locked,\ $(QUIET)$(call silent_on_success,generating opam/infer.opam.locked,\
$(OPAM) lock .) $(OPAM) lock opam/infer.opam)
OPAM_DEV_DEPS = ocp-indent merlin utop webbrowser OPAM_DEV_DEPS = ocp-indent merlin utop webbrowser

@ -35,7 +35,7 @@ function usage() {
echo echo
echo " options:" echo " options:"
echo " -h,--help show this message" 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 " --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 " --user-opam-switch use the current opam switch to install infer (default: $INFER_OPAM_DEFAULT_SWITCH)"
echo " -y,--yes automatically agree to everything" echo " -y,--yes automatically agree to everything"
@ -135,7 +135,7 @@ install_opam_deps () {
if [ "$USE_OPAM_LOCK" == yes ]; then if [ "$USE_OPAM_LOCK" == yes ]; then
locked=--locked locked=--locked
fi fi
opam install --deps-only infer "$INFER_ROOT" $locked && opam install --deps-only "$INFER_ROOT"/opam/infer.opam $locked &&
if [ -n "$SANDCASTLE" ]; then if [ -n "$SANDCASTLE" ]; then
opam pin list | grep yojson || opam pin add yojson "${DEPENDENCIES_DIR}/yojson-1.7.0fix" opam pin list | grep yojson || opam pin add yojson "${DEPENDENCIES_DIR}/yojson-1.7.0fix"
fi fi

@ -38,6 +38,6 @@ AC_DEFUN([AC_ASSERT_OCAML_PKG],
If you are using opam, please run If you are using opam, please run
opam update opam update
opam install --deps-only infer .]) opam install --deps-only opam/infer.opam])
]) ])
]) ])

@ -6,7 +6,7 @@ bug-reports: "https://github.com/facebook/infer/issues/new?template=sledge_issue
dev-repo: "git://github.com/facebook/infer.git" dev-repo: "git://github.com/facebook/infer.git"
license: "MIT" license: "MIT"
build: [ build: [
[make "release"] [make "-C" "sledge" "release"]
] ]
depends: [ depends: [
"ocaml" "ocaml"
Loading…
Cancel
Save