Skip to content

Commit

Permalink
Added an API module to the executable spec, removed Lib
Browse files Browse the repository at this point in the history
  • Loading branch information
Soupstraw committed Nov 1, 2023
1 parent 54b74bd commit 20bb449
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 14 deletions.
13 changes: 8 additions & 5 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ rec {

mkSpecDerivation = { project, main }: rec {
docs = stdenv.mkDerivation {
pname = "docs";
pname = "${project}-docs";
version = "0.1";
src = "${formalLedger}";
meta = { };
Expand All @@ -87,7 +87,7 @@ rec {
};

html = stdenv.mkDerivation {
pname = "html";
pname = "${project}-html";
version = "0.1";
src = "${formalLedger}";
meta = { };
Expand All @@ -103,7 +103,7 @@ rec {
};

hsSrc = stdenv.mkDerivation {
pname = "hs-src";
pname = "${project}-hs-src";
version = "0.1";
src = "${formalLedger}";
meta = { };
Expand All @@ -122,7 +122,10 @@ rec {
test -n "$(find $out/haskell/ -type f -name '*.hs')"
# OUT_DIR=$out make "${project}".hsTest
'';
dontInstall = true;
installPhase = ''
mv $out/haskell/${main}/* $out
rm -rf $out/haskell
'';
};

# hsDocs = stdenv.mkDerivation {
Expand All @@ -144,7 +147,7 @@ rec {
# dontInstall = true;
# };

hsExe = haskellPackages.callCabal2nix "${project}" "${hsSrc}/haskell/${main}" { };
hsExe = haskellPackages.callCabal2nix "${project}" "${hsSrc}" { };

};

Expand Down
6 changes: 3 additions & 3 deletions src/Ledger/hs-src/cardano-ledger-executable-spec.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ test-suite test

library
import: globalOptions
hs-source-dirs: .
exposed-modules:
Lib
hs-source-dirs: src
build-depends:
text,
ieee,
tree-diff
exposed-modules:
MAlonzo.Code.Ledger.Foreign.API
-- This will be generated automatically when building with nix
other-modules:
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
module Lib
module MAlonzo.Code.Ledger.Foreign.API
( module MAlonzo.Code.Ledger.Foreign.LedgerTypes
, module MAlonzo.Code.Ledger.Foreign.HSLedger
) where

import MAlonzo.Code.Ledger.Foreign.LedgerTypes
import MAlonzo.Code.Ledger.Foreign.HSLedger

2 changes: 1 addition & 1 deletion src/Ledger/hs-src/test/UtxowSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Control.Monad ( foldM )
import Test.Hspec ( Spec, describe, it )
import Test.HUnit ( (@?=) )

import Lib
import MAlonzo.Code.Ledger.Foreign.API

(.->) = (,)

Expand Down
6 changes: 3 additions & 3 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ PRE=$(addprefix $(LATEX_DIR)/,\
PDF_DIR=$(OUT_DIR)/pdfs
HTML_DIR=$(OUT_DIR)/html
HS_DIR=$(OUT_DIR)/haskell
MALONZO_DIR=MAlonzo/Code
MALONZO_DIR=src/MAlonzo/Code
CABAL_TEST=cabal run test
LEDGER=Ledger
MIDNIGHT=MidnightExample
Expand Down Expand Up @@ -50,8 +50,8 @@ define agdaToHs =
mkdir -p $(HS_DIST)
cp -r $(PROJECT)/hs-src/* $(HS_DIST)/
cp $(PROJECT)/hs-src/$(CABAL_FILE) $(HS_DIST)/
$(AGDA) --transliterate -c --ghc-dont-call-ghc --compile-dir $(HS_DIST) $<
find $(HS_DIST)/MAlonzo -name "*.hs" -print\
$(AGDA) --transliterate -c --ghc-dont-call-ghc --compile-dir $(HS_DIST)/src $<
find $(HS_DIST)/src/MAlonzo -name "*.hs" -print\
| sed "s#^$(HS_DIST)/# #;s#\.hs##;s#/#.#g"\
>> $(HS_DIST)/$(CABAL_FILE)
endef
Expand Down

0 comments on commit 20bb449

Please sign in to comment.