Skip to content

Commit b44422b

Browse files
rv-jenkinsrv-auditorjbertholdgoodlyrottenapple
authored
Update dependency: deps/k_release (#3607)
Also contains changes to the `README.md` Closes #3611 --------- Co-authored-by: devops <[email protected]> Co-authored-by: Jost Berthold <[email protected]> Co-authored-by: Sam Balco <[email protected]>
1 parent a623014 commit b44422b

6 files changed

+108
-193
lines changed

README.md

+28-70
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ stack build kore
4242
cabal build kore
4343
```
4444

45-
If using `cabal`, version 3.0 or later is recommended.
4645
You may pass `--fast` to `stack build` or `-O0` to `cabal build` in order to
4746
disable compiler optimizations and make build faster at the cost of slower runtime.
4847

@@ -52,26 +51,6 @@ Using [make]:
5251
make all # builds all binaries
5352
```
5453

55-
### macOS
56-
57-
Currently, LLVM 13 from Homebrew installs an incompatible version of
58-
`install_name_tool`, which breaks the Haskell backend build on macOS. To resolve
59-
this, uninstall `llvm` and install `llvm@12` from Homebrew, then build from
60-
scratch.
61-
62-
#### Apple Silicon
63-
64-
If you are building the project on an Apple Silicon machine, a temporary
65-
workaround is necessary to install a new enough version of GHC with support for
66-
ARM64 Darwin. To do so, follow the instructions in [this
67-
comment](https://github.com/commercialhaskell/stack/pull/5562#issuecomment-913015550).
68-
The command-line flags for `stack` should then be specified _everywhere_ an
69-
execution of `stack` is required. For `make` invocations in this project, set
70-
the environment variable `STACK_BUILD_OPTS=--compiler ghc-8.10.7 --system-ghc`.
71-
72-
When `stack` and `ghc` merge their full support for ARM64 Darwin in future
73-
releases, it should be possible to remove this workaround.
74-
7554
## Developing
7655

7756
Developers will require all the dependencies listed above,
@@ -82,7 +61,8 @@ in addition to the requirements and recommendations below.
8261
For integration testing, we require:
8362

8463
- GNU [make]
85-
- The [K Framework] frontend.
64+
- The [K Framework] frontend (its version should be the one stated in [/deps/k_release](https://github.com/runtimeverification/haskell-backend/blob/master/deps/k_release))
65+
- Python 3.x with the [`jsonrpcclient`](https://github.com/explodinglabs/jsonrpcclient) library installed
8666

8767
You can install/have access to K by either:
8868
* using [kup]
@@ -109,15 +89,10 @@ For setting up a development environment, we recommend:
10989
- [direnv] to make the project's tools available in shells and editors.
11090
- [ghcup] or [Nix] for managing required Haskell tooling
11191
- [hlint] for compliance with project guidelines.
112-
- [entr] and [fd] for running `./entr.sh` to keep important files up-to-date.
113-
114-
We recommend to keep `./entr.sh` running in the background
115-
to keep important files (such as package descriptions) up-to-date,
116-
especially if the developer is using Cabal.
11792

11893
### Running Haskell Language Server
11994

120-
[ghcup] provides a straight-forward way of installing the language server,
95+
[ghcup] provides a straightforward way of installing the language server,
12196
if you prefer to use [Nix] please refer to the relevant resources on how to
12297
set up your [Nix] environment to build the server.
12398
**Note**: HLS has to be built with the project's GHC version.
@@ -134,7 +109,7 @@ Instructions on integrating with VSCode:
134109

135110
To build and run nix based packages at RV, please follow these instructions to set up nix:
136111

137-
_We are switching to using [nix flakes](https://nixos.wiki/wiki/Flakes) in all our repos. What this means at a high level is that some of the commands for building packages look a bit different._
112+
_We are using [nix flakes](https://nixos.wiki/wiki/Flakes) in all our repos. What this means at a high level is that some of the commands for building packages look a bit different._
138113

139114
To set up nix flakes you will need to install `nix` 2.4 or higher.If you are on a standard Linux distribution, such as Ubuntu, first [install nix](https://nixos.org/download.html#download-nix)
140115
and then enable flakes by editing either `~/.config/nix/nix.conf` or `/etc/nix/nix.conf` and adding:
@@ -203,62 +178,45 @@ nix run .#format Foo.hs
203178
We provide a development nix shell with a suitable development environment and
204179
a binary cache at [runtimeverification.cachix.org]. The development can be launched via `nix develop` and then calling `stack build/test/etc`.
205180

206-
When the `kore.cabal` package description file changes, run:
207-
208-
209-
```
210-
# Requires Nix with flakes enabled.
211-
nix run .#update-cabal
212-
```
213-
214-
or
215-
216-
```
217-
# Requires Nix to be installed.
218-
./nix/rematerialize.sh
219-
```
181+
### Upgrading dependencies
220182

221-
This script is also run by an automatic workflow.
183+
When one of the package description files (`kore.cabal`, `kore-rpc-types.cabal`) changes, or when upgrading to a newer `stack` resolver, the dependencies need to be consolidated to avoid accidental breakage from incompatible up-stream updates. We use a `cabal.project.freeze` file to pin the dependencies to what the current `stack` resolver is using.
222184

223-
### New GHC 9.2.5 dev shell
185+
The script [`scripts/freeze-cabal-to-stack-resolver.sh`](https://github.com/runtimeverification/haskell-backend/tree/master/scripts/freeze-cabal-to-stack-resolver.sh) should do most of that work (the existing `freeze` file must be removed before running it), and [`scripts/check-cabal-stack-sync.sh`](https://github.com/runtimeverification/haskell-backend/tree/master/scripts/check-cabal-stack-sync.sh) checks the result. Some manual adjustments will still be necessary for the `nix` builds in CI and locally to work.
224186

225-
In order to make use of the new profiling options in GHC 9.2, we've added a nix dev shell which builds kore with GHC 9.2.5. To open the shell, run
187+
In addition, any GHC or resolver upgrades must double-check the `compiler-nix-name` and `index-state` values in the [`flake.nix`](https://github.com/runtimeverification/haskell-backend/blob/master/flake.nix#L41-L42) file.
226188

227-
```
228-
nix develop .#ghc9
229-
```
230-
231-
Then, use stack to build:
232-
233-
```
234-
stack build
235-
```
236-
237-
If you modified the `kore.cabal` file and want to build with GHC 9, you will have to run
189+
### Integration tests
238190

239-
```
240-
# Requires Nix with flakes enabled.
241-
nix run .#update-cabal-ghc9
242-
```
191+
Haskell-backend provides an integration shell for running integration tests, which compile the K framework (of a specified version) against your current version of haskell backend and brings K into scope of your current shell.
243192

244-
### Integration tests
193+
The integration shell is part of the `k` repository, but invoked from the local tree, adding additional tools (see [`nix/integration-shell.nix`](https://github.com/runtimeverification/haskell-backend/blob/master/nix/integration-shell.nix) and [`../k/flake.nix`](https://github.com/runtimeverification/k/blob/master/flake.nix#L180)). Its `haskell-backend` dependency must be overridden to use the `haskell-backend` dependency from the current checked-out tree, and the `k` version will usually be the one from `deps/k_release`.
245194

246-
We provide a `test.nix` for running integration tests:
195+
To use this nix shell, execute
247196

248197
``` sh
249-
nix-build test.nix # run all integration tests
250-
nix-build test.nix --argstr test imp # run the integration tests in test/imp
251-
nix-shell test.nix # enter a shell where we can run tests manually
198+
me@somewhere:haskell-backend$ nix develop \
199+
github:runtimeverification/k/v$(cat deps/k_release)#kore-integration-tests \
200+
--override-input haskell-backend . --update-input haskell-backend
201+
...
202+
...(nix output)
203+
integration-shell:me@somewhere:haskell-backend$
252204
```
253205

254-
You can also us a new nix flake shell feature to compile the K framework against your current version of haskell backend and bring K into scope of your current shell via
206+
(This will take some time the first time you run it for a specific K framework version...)
207+
A specific commit or version tag of the K framework github repository can be used instead of `$(cat deps/k_release)`.
208+
209+
Running this command will add all of the K binaries like `kompile` or `kast` into the `PATH` of your current shell. This is not permanent and will only persist in your current shell window until you exit the active nix shell).
255210

256211
```
257-
nix shell github:runtimeverification/k/<commit> --override-input haskell-backend $(pwd)
212+
integration-shell:me@somewhere:haskell-backend$ make -C test/issue-3344 test
213+
...
214+
...(make output)
215+
integration-shell:me@somewhere:haskell-backend$ exit
216+
me@somewhere:haskell-backend$
258217
```
259218

260-
where `<commit>` can be empty or point to a specific version of the K framework github repository. Running this command will add all of the K binaries like `kompile` or `kast` into the `PATH` of your current shell (this is not permanent and will only persist in your current shell window until you close it).
261-
219+
262220

263221
[docs]: https://github.com/runtimeverification/haskell-backend/tree/master/docs
264222
[git]: https://git-scm.com/

deps/k_release

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5.6.130
1+
6.0.10

flake.lock

-67
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

+27-6
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@
1111
url = "github:edolstra/flake-compat";
1212
flake = false;
1313
};
14-
mach-nix.url = "github:DavHau/mach-nix";
1514
};
16-
outputs = { self, nixpkgs, haskell-nix, z3-src, mach-nix, ... }:
15+
outputs = { self, nixpkgs, haskell-nix, z3-src, ... }:
1716
let
1817
inherit (nixpkgs) lib;
1918
z3-overlay = (final: prev: {
@@ -28,7 +27,26 @@
2827
});
2928
});
3029
integration-tests-overlay = (final: prev: {
31-
kore-tests = final.callPackage ./nix/integration-shell.nix { mach-nix = mach-nix.lib."${prev.system}"; };
30+
kore-tests = final.callPackage ./nix/integration-shell.nix {
31+
python = final.python3.withPackages (ps:
32+
with ps;
33+
[
34+
(buildPythonPackage rec {
35+
pname = "jsonrpcclient";
36+
version = "4.0.3";
37+
src = prev.fetchFromGitHub {
38+
owner = "explodinglabs";
39+
repo = pname;
40+
rev = version;
41+
sha256 =
42+
"sha256-xqQwqNFXatGzc4JprZY1OpdPPGgpP5/ucG/qyV/n8hw=";
43+
};
44+
doCheck = false;
45+
format = "pyproject";
46+
buildInputs = [ setuptools ];
47+
})
48+
]);
49+
};
3250
});
3351
perSystem = lib.genAttrs nixpkgs.lib.systems.flakeExposed;
3452
nixpkgsFor = system:
@@ -161,16 +179,19 @@
161179
self.flake.${system}.apps // (let
162180
pkgs = nixpkgsFor system;
163181
profiling-script = pkgs.callPackage ./nix/run-profiling.nix {
164-
inherit (pkgs.haskellPackages)
165-
hp2pretty eventlog2html;
182+
inherit (pkgs.haskellPackages) hp2pretty eventlog2html;
166183
kore-exec =
167184
self.project.${system}.hsPkgs.kore.components.exes.kore-exec;
168185
kore-exec-prof =
169186
self.projectProfilingEventlog.${system}.hsPkgs.kore.components.exes.kore-exec;
170187
kore-exec-infotable =
171188
self.projectEventlogInfoTable.${system}.hsPkgs.kore.components.exes.kore-exec;
172189
};
173-
fourmolu = (pkgs.haskell-nix.hackage-package { name = "fourmolu"; version = fourmolu-version; inherit compiler-nix-name index-state; }).components.exes.fourmolu;
190+
fourmolu = (pkgs.haskell-nix.hackage-package {
191+
name = "fourmolu";
192+
version = fourmolu-version;
193+
inherit compiler-nix-name index-state;
194+
}).components.exes.fourmolu;
174195
scripts = pkgs.symlinkJoin {
175196
name = "fourmolu-format";
176197
paths = [ ./scripts ];

nix/integration-shell.nix

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
1-
{ cmake, openssl, pkg-config, procps, gmp, autoconf, automake, libtool, ncurses, jq, miller, z3, stdenv, lib, nix-gitignore, mach-nix, mkShell }: k:
1+
{ cmake, openssl, pkg-config, procps, gmp, autoconf, automake, libtool, ncurses
2+
, jq, miller, z3, stdenv, lib, nix-gitignore, mkShell, poetry, python }:
3+
k:
24
mkShell {
35
packages = [
46
k
57
ncurses # TODO: .../lib/kframework/setenv: line 31: tput: command not found
68
jq
79
miller # processing test statistics
810
z3
9-
(mach-nix.mkPython {
10-
requirements = ''
11-
jsonrpcclient
12-
poetry
13-
'';
14-
})
11+
poetry
12+
python
1513
# for evm-semantics plugin
1614
cmake
1715
openssl.dev

0 commit comments

Comments
 (0)