Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1194: SRE-36 haskell overhaul r=disassembler a=craigem This is the overhaul of Haskell for `cardano-ledger-specs` along the lines of `cardano-node` [PR #507](IntersectMBO/cardano-node#507). Co-authored-by: Craige McWhirter <craige.mcwhirter@iohk.io>
- Loading branch information
Showing
38 changed files
with
533 additions
and
1,421 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
{ iohkCardanoLedgerSpecsPackages ? import ../default.nix {} | ||
, pkgs ? iohkCardanoLedgerSpecsPackages.pkgs | ||
, iohkLib ? iohkCardanoLedgerSpecsPackages.iohkLib | ||
{ pkgs ? import ../nix {} | ||
, commonLib ? pkgs.commonLib | ||
}: | ||
|
||
iohkLib.haskellBuildUtils.stackRebuild { | ||
commonLib.haskellBuildUtils.stackRebuild { | ||
script = ./rebuild.hs; | ||
buildTools = []; | ||
libs = ps: []; | ||
shell = import ../nix/stack-shell.nix {}; | ||
shell = import ../nix/stack-shell.nix; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/sh | ||
set -eu | ||
|
||
# This script checks that the `stack.yaml` and `cabal.project` files have | ||
# consistent git hashes for the packages they depend on. We use | ||
# `cardano-repo-tool`'s `update-cabal-project` command which modifies | ||
# `cabal.project` to be consistent with `stack.yaml`s versions. If the | ||
# diff is non-empty, we know they're out of sync. | ||
|
||
# Check that functions are defined. | ||
HELP_TEXT="cardano-repo-tool not found." | ||
type cardano-repo-tool > /dev/null 2>&1 || { echo "${HELP_TEXT}"; exit 1; } | ||
HELP_TEXT="git not found." | ||
type git > /dev/null 2>&1 || { echo "${HELP_TEXT}"; exit 1; } | ||
|
||
# Update `cabal.project` from the `stack.yaml` file. | ||
cardano-repo-tool update-cabal-project | ||
|
||
git diff cabal.project | tee stack-cabal.patch | ||
|
||
if test "$(wc -l < stack-cabal.patch)" -gt 0 ; then | ||
buildkite-agent artifact upload stack-cabal.patch --job "$BUILDKITE_JOB_ID" | ||
exit 1 | ||
fi | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
status = [ | ||
"buildkite/cardano-ledger-specs", | ||
"ci/hydra:Cardano:cardano-ledger-specs:required", | ||
] | ||
timeout_sec = 7200 | ||
required_approvals = 1 | ||
block_labels = [ "WIP", "DO NOT MERGE" ] | ||
delete_merged_branches = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
let | ||
pkgs = import ../../../default.nix {}; | ||
in | ||
pkgs.nix-tools.libs.cs-blockchain | ||
pkgs.libs.cs-blockchain |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
let | ||
pkgs = import ../../../default.nix {}; | ||
in | ||
pkgs.nix-tools.libs.cs-ledger | ||
pkgs.libs.cs-ledger |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
let | ||
pkgs = import ../../../default.nix {}; | ||
in | ||
pkgs.nix-tools.libs.small-steps | ||
pkgs.libs.small-steps |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,54 @@ | ||
############################################################################ | ||
# Based on iohk-skeleton project at https://github.com/input-output-hk/iohk-nix/ | ||
############################################################################ | ||
|
||
{ system ? builtins.currentSystem | ||
, crossSystem ? null | ||
# allows to cutomize haskellNix (ghc and profiling, see ./nix/haskell.nix) | ||
, config ? {} | ||
# Import IOHK common nix lib | ||
, iohkLib ? import ./nix/iohk-common.nix { inherit system crossSystem config; } | ||
# Use nixpkgs pin from iohkLib | ||
, pkgs ? iohkLib.pkgs | ||
# allows to override dependencies of the project without modifications, | ||
# eg. to test build against local checkout of iohk-nix: | ||
# nix build -f default.nix cardano-node --arg sourcesOverride '{ | ||
# iohk-nix = ../iohk-nix; | ||
# }' | ||
, sourcesOverride ? {} | ||
# pinned version of nixpkgs augmented with overlays (iohk-nix and our packages). | ||
, pkgs ? import ./nix { inherit system crossSystem config sourcesOverride; } | ||
, gitrev ? pkgs.iohkNix.commitIdFromGitRepoOrZero ./.git | ||
}: | ||
|
||
with pkgs; with commonLib; | ||
let | ||
haskell = pkgs.callPackage iohkLib.nix-tools.haskell {}; | ||
src = iohkLib.cleanSourceHaskell ./.; | ||
util = pkgs.callPackage ./nix/util.nix {}; | ||
|
||
# Import the Haskell package set. | ||
haskellPackages = import ./nix/pkgs.nix { | ||
inherit pkgs haskell src; | ||
# Provide cross-compiling secret sauce | ||
inherit (iohkLib.nix-tools) iohk-extras iohk-module; | ||
}; | ||
|
||
in { | ||
inherit pkgs iohkLib src haskellPackages; | ||
|
||
# Grab the executable components of our packages. | ||
inherit (haskellPackages.non-integer.components.exes) nonInt; | ||
|
||
tests = util.collectComponents "tests" util.isCardanoLedgerSpecs haskellPackages; | ||
benchmarks = util.collectComponents "benchmarks" util.isCardanoLedgerSpecs haskellPackages; | ||
|
||
# This provides a development environment that can be used with nix-shell or | ||
# lorri. See https://input-output-hk.github.io/haskell.nix/user-guide/development/ | ||
shell = haskellPackages.shellFor { | ||
name = "cardano-ledger-specs-shell"; | ||
# List all local packages in the project. | ||
packages = ps: with ps; [ | ||
small-steps | ||
cs-ledger | ||
cs-blockchain | ||
delegation | ||
non-integer | ||
]; | ||
# These programs will be available inside the nix-shell. | ||
buildInputs = | ||
with pkgs.haskellPackages; [ hlint stylish-haskell weeder ] | ||
# Add your own packages to the shell. | ||
++ [ ]; | ||
}; | ||
|
||
# Attributes of PDF builds of LaTeX documentation. | ||
byronLedgerSpec = import ./byron/ledger/formal-spec { inherit pkgs; }; | ||
byronChainSpec = import ./byron/chain/formal-spec { inherit pkgs; }; | ||
semanticsSpec = import ./byron/semantics/formal-spec { inherit pkgs; }; | ||
shelleyLedgerSpec = import ./shelley/chain-and-ledger/formal-spec { inherit pkgs; }; | ||
delegationDesignSpec = import ./shelley/design-spec { inherit pkgs; }; | ||
nonIntegerCalculations = import ./shelley/chain-and-ledger/dependencies/non-integer/doc {inherit pkgs; }; | ||
blocksCDDLSpec = import ./byron/cddl-spec {inherit pkgs; }; | ||
} | ||
|
||
haskellPackages = recRecurseIntoAttrs | ||
# we are only intersted in listing the project packages: | ||
(selectProjectPackages cardanoLedgerSpecsHaskellPackages); | ||
|
||
self = { | ||
inherit haskellPackages check-hydra; | ||
|
||
# `tests` are the test suites which have been built. | ||
tests = collectComponents' "tests" haskellPackages; | ||
# `benchmarks` (only built, not run). | ||
benchmarks = collectComponents' "benchmarks" haskellPackages; | ||
|
||
libs = collectComponents' "library" haskellPackages; | ||
|
||
exes = collectComponents' "exes" haskellPackages; | ||
|
||
checks = recurseIntoAttrs { | ||
# `checks.tests` collect results of executing the tests: | ||
tests = collectChecks haskellPackages; | ||
}; | ||
|
||
shell = import ./shell.nix { | ||
inherit pkgs; | ||
withHoogle = true; | ||
}; | ||
|
||
|
||
# Attributes of PDF builds of LaTeX documentation. | ||
byronLedgerSpec = import ./byron/ledger/formal-spec { inherit pkgs; }; | ||
byronChainSpec = import ./byron/chain/formal-spec { inherit pkgs; }; | ||
semanticsSpec = import ./byron/semantics/formal-spec { inherit pkgs; }; | ||
shelleyLedgerSpec = import ./shelley/chain-and-ledger/formal-spec { inherit pkgs; }; | ||
delegationDesignSpec = import ./shelley/design-spec { inherit pkgs; }; | ||
nonIntegerCalculations = import ./shelley/chain-and-ledger/dependencies/non-integer/doc {inherit pkgs; }; | ||
blocksCDDLSpec = import ./byron/cddl-spec {inherit pkgs; }; | ||
}; | ||
in self |
Oops, something went wrong.