diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index b424b4d351..8e3bda886d 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,14 +1,14 @@ # just -opam tag because make setup will install ocaml compiler FROM ocaml/opam:ubuntu-22.04-opam AS dev +# make opam 2.2 default for make setup +RUN sudo ln -sf /usr/bin/opam-2.2 /usr/bin/opam # TODO: use opam depext RUN sudo apt-get update \ && sudo apt-get install -y libgmp-dev libmpfr-dev m4 autoconf gcc-multilib pkg-config ruby gem curl python3-pygments graphviz \ && sudo rm -rf /var/lib/apt/lists/* -# copy only files for make setup to cache docker layers without code changes -COPY --chown=opam Makefile make.sh goblint.opam goblint.opam.locked /home/opam/docker/analyzer/ - +RUN sudo gem install parallel os # remove default Docker git credentials added by opam base image: https://github.com/avsm/ocaml-dockerfile/blob/f184554282a3836bf3f1c34d20e77d0530f8349d/src-opam/dockerfile_linux.ml#L24-L28 # this prevents devcontainer from using outside git credentials: https://code.visualstudio.com/docs/remote/containers#_sharing-git-credentials-with-your-container @@ -22,13 +22,10 @@ USER opam # update local opam repository because base image may be outdated RUN cd /home/opam/opam-repository \ && git pull origin master \ - && opam update + && opam update -y -RUN cd /home/opam/docker/analyzer \ - && OPAMWITHTEST=true make setup +# copy only files for make setup to cache docker layers without code changes +COPY --chown=opam Makefile make.sh goblint.opam goblint.opam.locked /home/opam/docker/analyzer/ RUN cd /home/opam/docker/analyzer \ - && eval $(opam env) \ - && opam install -y ocaml-lsp-server ocamlformat dune=3.19.1 \ - && sudo gem install parallel os - + && OPAMWITHTEST=true OPAMWITHDOC=true OPAMWITHDEVSETUP=true make setup diff --git a/Dockerfile b/Dockerfile index fca746a809..3d335c65e0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,8 +2,8 @@ # just -opam tag because make setup will install ocaml compiler FROM ocaml/opam:ubuntu-22.04-opam AS dev -# make opam 2.1 default for make setup -RUN sudo ln -sf /usr/bin/opam-2.1 /usr/bin/opam +# make opam 2.2 default for make setup +RUN sudo ln -sf /usr/bin/opam-2.2 /usr/bin/opam # copy only files for make setup to cache docker layers without code changes COPY --chown=opam Makefile make.sh goblint.opam goblint.opam.locked /home/opam/analyzer/ diff --git a/README.md b/README.md index 1594095e97..34a0a97b16 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ Both for using an up-to-date version of Goblint or developing it, the best way i For benchmarking Goblint, please follow the [Benchmarking guide on Read the Docs](https://goblint.readthedocs.io/en/latest/user-guide/benchmarking/). ### Linux -1. Install [opam](https://opam.ocaml.org/doc/Install.html). +1. Install [opam](https://opam.ocaml.org/doc/Install.html) 2.2 or newer. 2. Make sure the following are installed: `git`, `patch`, `m4`, `autoconf`, `libgmp-dev`, `libmpfr-dev` and `pkg-config`. 3. Run `make setup` to install OCaml and dependencies via opam. 4. Run `make` to build Goblint itself. diff --git a/docs/developer-guide/releasing.md b/docs/developer-guide/releasing.md index 508b599b8a..d8a5322e34 100644 --- a/docs/developer-guide/releasing.md +++ b/docs/developer-guide/releasing.md @@ -41,9 +41,9 @@ 1. Pull Docker image: `docker pull ocaml/opam:ubuntu-22.04-ocaml-4.14` (or newer). 2. Extract distribution archive. 3. Run Docker container in extracted directory: `docker run -it --rm -v $(pwd):/goblint ocaml/opam:ubuntu-22.04-ocaml-4.14` (or newer). - 4. Update opam-repository from git: `opam-2.1 repository add git git+https://github.com/ocaml/opam-repository.git && opam-2.1 update`. + 4. Update opam-repository from git: `opam-2.2 repository add git git+https://github.com/ocaml/opam-repository.git && opam-2.2 update`. 5. Navigate to distribution archive inside Docker container: `cd /goblint`. - 6. Install and test package from distribution archive: `opam-2.1 install --with-test .`. + 6. Install and test package from distribution archive: `opam-2.2 install --with-test .`. 7. Activate opam environment: `eval $(opam env)`. 8. Check version: `goblint --version`. 9. Check that analysis works: `goblint -v tests/regression/04-mutex/01-simple_rc.c`. diff --git a/dune-project b/dune-project index 3aa8782c63..aa98676909 100644 --- a/dune-project +++ b/dune-project @@ -70,6 +70,8 @@ Goblint includes analyses for assertions, overflows, deadlocks, etc and can be e conf-gcc ; ensures opam-repository CI installs real gcc from homebrew on MacOS domain-local-await domain_shims + (ocaml-lsp-server :with-dev-setup) ; needed for https://github.com/ocamllabs/vscode-ocaml-platform + (ocp-indent :with-dev-setup) ; needed for pre-commit hook ) (depopts apron diff --git a/goblint.opam b/goblint.opam index c885f49033..c0e8695e5c 100644 --- a/goblint.opam +++ b/goblint.opam @@ -72,6 +72,8 @@ depends: [ "conf-gcc" "domain-local-await" "domain_shims" + "ocaml-lsp-server" {with-dev-setup} + "ocp-indent" {with-dev-setup} ] depopts: ["apron" "z3" "domainslib" "memtrace"] conflicts: [ diff --git a/goblint.opam.locked b/goblint.opam.locked index 14359ac300..3c519178a8 100644 --- a/goblint.opam.locked +++ b/goblint.opam.locked @@ -29,7 +29,7 @@ depends: [ "arg-complete" {= "0.2.1"} "astring" {= "0.8.5"} "base-bigarray" {= "base"} - "base-bytes" {= "base"} + "base-bytes" {= "base" & with-dev-setup} "base-threads" {= "base"} "base-unix" {= "base"} "batteries" {= "3.9.0"} @@ -41,7 +41,8 @@ depends: [ "camlp-streams" {= "5.0.1"} "catapult" {= "0.2"} "catapult-file" {= "0.2"} - "cmdliner" {= "1.3.0" & with-doc} + "chrome-trace" {= "3.19.1" & with-dev-setup} + "cmdliner" {= "1.3.0" & (with-doc | with-dev-setup)} "conf-autoconf" {= "0.2"} "conf-findutils" {= "1"} "conf-gcc" {= "1.0"} @@ -49,6 +50,7 @@ depends: [ "conf-gmp-paths" {= "1"} "conf-mpfr-paths" {= "1"} "conf-perl" {= "2"} + "conf-pkg-config" {= "4"} "conf-ruby" {= "1.0.0" & with-test} "cppo" {= "1.6.9"} "cpu" {= "2.0.0"} @@ -62,9 +64,11 @@ depends: [ "dune-build-info" {= "3.19.1"} "dune-configurator" {= "3.19.1"} "dune-private-libs" {= "3.19.1"} + "dune-rpc" {= "3.19.1" & with-dev-setup} "dune-site" {= "3.19.1"} "dyn" {= "3.19.1"} "ez-conf-lib" {= "2"} + "fiber" {= "3.7.0" & with-dev-setup} "fileutils" {= "0.6.4"} "fmt" {= "0.9.0"} "fpath" {= "0.7.3"} @@ -74,16 +78,21 @@ depends: [ "json-data-encoding" {= "1.0.1"} "jsonrpc" {= "1.17.0"} "logs" {= "0.7.0"} + "merlin-lib" {= "4.16-414" & with-dev-setup} "mlgmpidl" {= "1.3.0"} "num" {= "1.5"} "ocaml" {= "4.14.2"} "ocaml-compiler-libs" {= "v0.12.4"} "ocaml-config" {= "2"} + "ocaml-lsp-server" {= "1.17.0" & with-dev-setup} "ocaml-option-flambda" {= "1"} "ocaml-syntax-shims" {= "1.0.0"} "ocaml-variants" {= "4.14.2+options"} "ocamlbuild" {= "0.14.3"} + "ocamlc-loc" {= "3.19.1" & with-dev-setup} "ocamlfind" {= "1.9.8"} + "ocamlformat-rpc-lib" {= "0.29.0" & with-dev-setup} + "ocp-indent" {= "1.8.1" & with-dev-setup} "odoc" {= "3.0.0" & with-doc} "odoc-parser" {= "3.0.0" & with-doc} "ordering" {= "3.19.1"} @@ -95,6 +104,7 @@ depends: [ "ppx_deriving" {= "6.0.2"} "ppx_deriving_hash" {= "0.1.2"} "ppx_deriving_yojson" {= "3.8.0"} + "ppx_yojson_conv_lib" {= "v0.16.0" & with-dev-setup} "ppxlib" {= "0.35.0"} "ptime" {= "1.2.0" & with-doc} "qcheck-core" {= "0.25"} @@ -105,6 +115,7 @@ depends: [ "seq" {= "base"} "sexplib0" {= "v0.16.0"} "sha" {= "1.15.4"} + "spawn" {= "v0.17.0" & with-dev-setup} "stdlib-shims" {= "0.3.0"} "stdune" {= "3.19.1"} "stringext" {= "1.6.0"} @@ -114,6 +125,7 @@ depends: [ "uri" {= "4.4.0"} "uuidm" {= "0.9.8"} "uutf" {= "1.0.3" & with-doc} + "xdg" {= "3.19.1" & with-dev-setup} "yaml" {= "3.2.0"} "yojson" {= "2.2.1"} "zarith" {= "1.14"} diff --git a/make.sh b/make.sh index 1045656179..c944c18d90 100755 --- a/make.sh +++ b/make.sh @@ -74,18 +74,15 @@ rule() { opam upgrade -y $(opam list --pinned -s) } ;; setup) - echo "Make sure you have the following installed: opam >= 2.0.0, git, patch, m4, autoconf, libgmp-dev, libmpfr-dev, pkg-config" + echo "Make sure you have the following installed: opam >= 2.2.0, git, patch, m4, autoconf, libgmp-dev, libmpfr-dev, pkg-config" echo "For the --html output you also need: graphviz and python3-pygments (optional)" echo "For running the regression tests you also need: ruby, gem, curl, and the os gem" echo "For reference see ./Dockerfile or ./scripts/travis-ci.sh" opam_setup ;; dev) eval $(opam env) - echo "Installing opam packages for test and doc..." - opam install -y . --deps-only --locked --with-test --with-doc - echo "Installing opam packages for development..." - opam install -y ocaml-lsp-server ocp-indent - # ocaml-lsp-server is needed for https://github.com/ocamllabs/vscode-ocaml-platform + echo "Installing opam packages for test, doc and dev-setup..." + opam install -y . --deps-only --locked --with-test --with-doc --with-dev-setup echo "Installing Pre-commit hook..." cd .git/hooks; ln -sf ../../scripts/hooks/pre-commit; cd - # Use `git commit -n` to temporarily bypass the hook if necessary.