Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LamBuf modules depending on other generated modules #234

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions testsuites/lbt-plutus/api/DayTypes.lbf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module DayTypes

import Plutus.V1 (PlutusData)
import Prelude (Eq, Json)
import Days (Day)

prod WorkDay = Day

derive Eq WorkDay
derive PlutusData WorkDay

record FreeDay = { day : Day }

derive Eq FreeDay
derive PlutusData FreeDay
10 changes: 0 additions & 10 deletions testsuites/lbt-plutus/api/Days.lbf
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,3 @@ sum Day = Monday | Tuesday | Wednesday | Thursday | Friday | Saturday | Sunday

derive Eq Day
derive PlutusData Day

prod WorkDay = Day

derive Eq WorkDay
derive PlutusData WorkDay

record FreeDay = { day : Day }

derive Eq FreeDay
derive PlutusData FreeDay
71 changes: 36 additions & 35 deletions testsuites/lbt-plutus/api/build.nix
Original file line number Diff line number Diff line change
@@ -1,42 +1,43 @@
_: {
perSystem = { config, ... }:
let
mainPkgArgs = lang: ({
name = "lbf-plutus-golden-api-${lang}";
src = ./.;
files = [ "Foo.lbf" "Foo/Bar.lbf" "DayTypes.lbf" ];
} // (if (lang == "typescript")
then {
npmExtraDependencies = [ config.packages.lbf-plutus-golden-api-days-typescript ];
}
else {
dependencies = [ "lbf-plutus-golden-api-days-${lang}" ];
}));

daysPkgArgs = lang: {
name = "lbf-plutus-golden-api-days-${lang}";
src = ./.;
files = [ "Days.lbf" ];
};
in
{
packages = {
lbf-plutus-golden-api-haskell = config.lbf-nix.lbfPlutusHaskell {
name = "lbf-plutus-golden-api";
src = ./.;
files = [ "Foo.lbf" "Foo/Bar.lbf" "Days.lbf" ];
};

lbf-plutus-golden-api-purescript = config.lbf-nix.lbfPlutusPurescript {
name = "lbf-plutus-golden-api";
src = ./.;
files = [ "Foo.lbf" "Foo/Bar.lbf" "Days.lbf" ];
};

lbf-plutus-golden-api-plutarch = config.lbf-nix.lbfPlutarch {
name = "lbf-plutus-plutarch-golden-api";
src = ./.;
files = [ "Foo.lbf" "Foo/Bar.lbf" "Days.lbf" ];
};

lbf-plutus-golden-api-plutustx = config.lbf-nix.lbfPlutusTx {
name = "lbf-plutus-plutustx-golden-api";
src = ./.;
files = [ "Foo.lbf" "Foo/Bar.lbf" "Days.lbf" ];
};

lbf-plutus-golden-api-rust = config.lbf-nix.lbfPlutusRust {
name = "lbf-plutus-rust-golden-api";
src = ./.;
files = [ "Foo.lbf" "Foo/Bar.lbf" "Days.lbf" ];
};

lbf-plutus-golden-api-typescript = config.lbf-nix.lbfPlutusTypescript {
name = "lbf-plutus-golden-api";
src = ./.;
files = [ "Foo.lbf" "Foo/Bar.lbf" "Days.lbf" ];
};
lbf-plutus-golden-api-haskell = config.lbf-nix.lbfPlutusHaskell (mainPkgArgs "haskell");
lbf-plutus-golden-api-days-haskell = config.lbf-nix.lbfPlutusHaskell (daysPkgArgs "haskell");

lbf-plutus-golden-api-purescript = config.lbf-nix.lbfPlutusPurescript (mainPkgArgs "purescript");
lbf-plutus-golden-api-days-purescript = config.lbf-nix.lbfPlutusPurescript (daysPkgArgs "purescript");

lbf-plutus-golden-api-plutarch = config.lbf-nix.lbfPlutarch (mainPkgArgs "plutarch");
lbf-plutus-golden-api-days-plutarch = config.lbf-nix.lbfPlutarch (daysPkgArgs "plutarch");

lbf-plutus-golden-api-plutustx = config.lbf-nix.lbfPlutusTx (mainPkgArgs "plutustx");
lbf-plutus-golden-api-days-plutustx = config.lbf-nix.lbfPlutusTx (daysPkgArgs "plutustx");

lbf-plutus-golden-api-rust = config.lbf-nix.lbfPlutusRust (mainPkgArgs "rust");
lbf-plutus-golden-api-days-rust = config.lbf-nix.lbfPlutusRust (daysPkgArgs "rust");

lbf-plutus-golden-api-typescript = config.lbf-nix.lbfPlutusTypescript (mainPkgArgs "typescript");
lbf-plutus-golden-api-days-typescript = config.lbf-nix.lbfPlutusTypescript (daysPkgArgs "typescript");

};
};
Expand Down
1 change: 1 addition & 0 deletions testsuites/lbt-plutus/lbt-plutus-haskell/build.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"${config.packages.lbf-prelude-haskell}"
"${config.packages.lbr-plutus-haskell-src}"
"${config.packages.lbf-plutus-haskell}"
"${config.packages.lbf-plutus-golden-api-days-haskell}"
"${config.packages.lbf-plutus-golden-api-haskell}"
"${config.packages.lbt-plutus-golden-haskell}"
];
Expand Down
34 changes: 18 additions & 16 deletions testsuites/lbt-plutus/lbt-plutus-haskell/lbt-plutus-haskell.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -86,19 +86,20 @@ common common-language
library
import: common-language
build-depends:
, base >=4.16
, bytestring >=0.11
, containers >=0.6
, directory >=1.3
, filepath >=1.4
, lbf-plutus-golden-api
, base >=4.16
, bytestring >=0.11
, containers >=0.6
, directory >=1.3
, filepath >=1.4
, lbf-plutus-golden-api-days-haskell
, lbf-plutus-golden-api-haskell
, lbr-plutus
, lbr-prelude
, plutus-ledger-api >=1.1
, plutus-tx >=1.1
, split >=0.2
, tasty >=1.4
, tasty-hunit >=0.10
, plutus-ledger-api >=1.1
, plutus-tx >=1.1
, split >=0.2
, tasty >=1.4
, tasty-hunit >=0.10

hs-source-dirs: src
exposed-modules:
Expand Down Expand Up @@ -127,16 +128,17 @@ test-suite tests
hs-source-dirs: test
main-is: Test.hs
build-depends:
, base >=4.16
, hedgehog >=1.2
, lbf-plutus-golden-api >=0.1
, base >=4.16
, hedgehog >=1.2
, lbf-plutus-golden-api-days-haskell >=0.1
, lbf-plutus-golden-api-haskell >=0.1
, lbr-plutus
, lbr-prelude
, lbt-plutus-golden-data
, lbt-plutus-haskell
, plutus-tx
, tasty >=1.4
, tasty-hedgehog >=1.4
, tasty >=1.4
, tasty-hedgehog >=1.4

other-modules:
Test.LambdaBuffers.Runtime.Plutus.Generators.Correct
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ module Test.LambdaBuffers.Plutus.Golden (
) where

import Data.ByteString qualified as B
import LambdaBuffers.Days (Day (Day'Friday, Day'Monday, Day'Saturday, Day'Sunday, Day'Thursday, Day'Tuesday, Day'Wednesday), FreeDay (FreeDay), WorkDay (WorkDay))
import LambdaBuffers.DayTypes (FreeDay (FreeDay), WorkDay (WorkDay))
import LambdaBuffers.Days (Day (Day'Friday, Day'Monday, Day'Saturday, Day'Sunday, Day'Thursday, Day'Tuesday, Day'Wednesday))
import LambdaBuffers.Foo (A (A), B (B), C (C), D (D), FInt (FInt), GInt (GInt))
import LambdaBuffers.Foo.Bar (F (F'Nil, F'Rec), FooComplicated (FooComplicated), FooProd (FooProd), FooRec (FooRec), FooSum (FooSum'Bar, FooSum'Baz, FooSum'Faz, FooSum'Foo, FooSum'Qax), G (G'Nil, G'Rec))
import PlutusLedgerApi.V1 qualified as PlutusV1
Expand Down
2 changes: 2 additions & 0 deletions testsuites/lbt-plutus/lbt-plutus-plutarch/build.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
# Golden api
"${config.packages.lbf-plutus-golden-api-plutarch}"
"${config.packages.lbf-plutus-golden-api-haskell}"
"${config.packages.lbf-plutus-golden-api-days-haskell}"
"${config.packages.lbf-plutus-golden-api-days-plutarch}"
# Golden data
"${config.packages.lbt-plutus-golden-haskell}"
# Plutarch itself
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,20 +104,22 @@ test-suite tests
hs-source-dirs: test
main-is: Test.hs
build-depends:
, base >=4.16
, base >=4.16
, lbf-plutus
, lbf-plutus-golden-api
, lbf-plutus-golden-api-days-haskell
, lbf-plutus-golden-api-days-plutarch
, lbf-plutus-golden-api-haskell
, lbf-plutus-golden-api-plutarch
, lbf-plutus-plutarch
, lbf-plutus-plutarch-golden-api
, lbf-prelude
, lbf-prelude-plutarch
, lbr-plutarch
, lbr-plutus
, lbt-plutus-plutarch
, plutarch >=1.3
, plutus-tx >=1.1
, tasty >=1.4
, plutarch >=1.3
, plutus-tx >=1.1
, tasty >=1.4
, tasty-expected-failure
, tasty-hunit >=0.10
, tasty-hunit >=0.10

other-modules: Test.LambdaBuffers.Runtime.Plutarch.PlutusData
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

module Test.LambdaBuffers.Runtime.Plutarch.PlutusData (tests) where

import LambdaBuffers.DayTypes qualified as HlDayTypes
import LambdaBuffers.DayTypes.Plutarch qualified as PlDayTypes
import LambdaBuffers.Days qualified as HlDays
import LambdaBuffers.Days.Plutarch qualified as PlDays
import LambdaBuffers.Foo qualified as HlFoo
Expand Down Expand Up @@ -44,8 +46,8 @@ transparentGoldens =
testGroup
"Transparent golden types"
[ forallGoldens @HlDays.Day @PlDays.Day "Days.Day" 6
, forallGoldens @HlDays.FreeDay @PlDays.FreeDay "Days.FreeDay" 1
, forallGoldens @HlDays.WorkDay @PlDays.WorkDay "Days.WorkDay" 4
, forallGoldens @HlDayTypes.FreeDay @PlDayTypes.FreeDay "Days.FreeDay" 1
, forallGoldens @HlDayTypes.WorkDay @PlDayTypes.WorkDay "Days.WorkDay" 4
, forallGoldens @HlFoo.A @PlFoo.A "Foo.A" 9
, forallGoldens @HlFoo.B @PlFoo.B "Foo.B" 9
, forallGoldens @HlFoo.C @PlFoo.C "Foo.C" 9
Expand Down
2 changes: 2 additions & 0 deletions testsuites/lbt-plutus/lbt-plutus-plutustx/build.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"${config.packages.lbf-prelude-plutustx}"
"${config.packages.lbf-plutus-plutustx}"
"${config.packages.lbf-plutus-golden-api-plutustx}"
"${config.packages.lbf-plutus-golden-api-days-plutustx}"
"${config.packages.lbr-plutustx-src}"

# LB Haskell backend imports (Prelude and Plutus)
Expand All @@ -22,6 +23,7 @@
"${config.packages.lbr-plutus-haskell-src}"
"${config.packages.lbf-plutus-haskell}"
"${config.packages.lbf-plutus-golden-api-haskell}"
"${config.packages.lbf-plutus-golden-api-days-haskell}"
"${config.packages.lbt-plutus-golden-haskell}"

# Plutarch (just for script evaluation module)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,25 +89,27 @@ test-suite tests
hs-source-dirs: test
main-is: Test.hs
build-depends:
, base >=4.16
, bytestring >=0.11
, filepath >=1.4
, lbf-plutus >=0.1
, lbf-plutus-golden-api
, base >=4.16
, bytestring >=0.11
, filepath >=1.4
, lbf-plutus >=0.1
, lbf-plutus-golden-api-days-haskell
, lbf-plutus-golden-api-days-plutustx
, lbf-plutus-golden-api-haskell
, lbf-plutus-golden-api-plutustx
, lbf-plutus-plutustx
, lbf-plutus-plutustx-golden-api
, lbf-prelude
, lbf-prelude-plutustx
, lbr-plutus
, lbr-plutustx
, lbr-prelude
, lbt-plutus-golden-data
, plutarch
, plutus-core >=1.20
, plutus-ledger-api >=1.20
, plutus-core >=1.20
, plutus-ledger-api >=1.20
, plutus-tx
, plutus-tx-plugin
, tasty >=1.4
, tasty >=1.4
, tasty-expected-failure
, tasty-hunit

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
module Test.LambdaBuffers.Runtime.PlutusTx.PlutusData (tests) where

import Data.ByteString qualified as B
import LambdaBuffers.DayTypes qualified as HlDayTypes
import LambdaBuffers.DayTypes.PlutusTx qualified as PlDayTypes
import LambdaBuffers.Days qualified as HlDays
import LambdaBuffers.Days.PlutusTx qualified as PlDays
import LambdaBuffers.Foo qualified as HlFoo
Expand Down Expand Up @@ -47,8 +49,8 @@ transparentGoldens =
testGroup
"Transparent golden types"
[ forallGoldens @HlDays.Day @PlDays.Day PlutusTx.dayCompiled "Days.Day" 6
, forallGoldens @HlDays.FreeDay @PlDays.FreeDay PlutusTx.freeDayCompiled "Days.FreeDay" 1
, forallGoldens @HlDays.WorkDay @PlDays.WorkDay PlutusTx.workDayCompiled "Days.WorkDay" 4
, forallGoldens @HlDayTypes.FreeDay @PlDayTypes.FreeDay PlutusTx.freeDayCompiled "Days.FreeDay" 1
, forallGoldens @HlDayTypes.WorkDay @PlDayTypes.WorkDay PlutusTx.workDayCompiled "Days.WorkDay" 4
, forallGoldens @HlFoo.A @PlFoo.A PlutusTx.fooACompiled "Foo.A" 9
, forallGoldens @HlFoo.B @PlFoo.B PlutusTx.fooBCompiled "Foo.B" 9
, forallGoldens @HlFoo.C @PlFoo.C PlutusTx.fooCCompiled "Foo.C" 9
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ module Test.LambdaBuffers.Runtime.PlutusTx.PlutusTx (
scriptContext2Compiled,
) where

import LambdaBuffers.Days.PlutusTx (Day, FreeDay, WorkDay)
import LambdaBuffers.DayTypes.PlutusTx (FreeDay, WorkDay)
import LambdaBuffers.Days.PlutusTx (Day)
import LambdaBuffers.Foo.PlutusTx (A, B, C, D, E, FInt, GInt)
import LambdaBuffers.Plutus.V2.PlutusTx qualified as PlutusV2
import PlutusLedgerApi.V1 qualified as PlutusV1
Expand Down
1 change: 1 addition & 0 deletions testsuites/lbt-plutus/lbt-plutus-purescript/build.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

extraSources = [
config.packages.lbf-plutus-golden-api-purescript
config.packages.lbf-plutus-golden-api-days-purescript
config.packages.lbf-prelude-purescript
config.packages.lbf-plutus-purescript
config.packages."purescript:lbr-prelude:src"
Expand Down
1 change: 1 addition & 0 deletions testsuites/lbt-plutus/lbt-plutus-purescript/data
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ import JS.BigInt (BigInt)
import JS.BigInt as BigInt
import Data.Either (Either(Left, Right))
import Data.Maybe (Maybe(Nothing, Just))
import LambdaBuffers.Days (Day(Day'Friday, Day'Monday, Day'Saturday, Day'Sunday, Day'Thursday, Day'Tuesday, Day'Wednesday), FreeDay(FreeDay), WorkDay(WorkDay))
import LambdaBuffers.Days (Day(Day'Friday, Day'Monday, Day'Saturday, Day'Sunday, Day'Thursday, Day'Tuesday, Day'Wednesday))
import LambdaBuffers.DayTypes (FreeDay(FreeDay), WorkDay(WorkDay))
import LambdaBuffers.Foo (A(A), B(B), C(C), D(D), FInt(..), GInt(..))
import LambdaBuffers.Foo.Bar (F(..), FooComplicated(FooComplicated), FooProd(FooProd), FooRec(FooRec), FooSum(FooSum'Bar, FooSum'Baz, FooSum'Faz, FooSum'Foo, FooSum'Qax), G(..))
import Test.LambdaBuffers.Plutus.Generators.Correct as Lbr
Expand Down
18 changes: 16 additions & 2 deletions testsuites/lbt-plutus/lbt-plutus-rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion testsuites/lbt-plutus/lbt-plutus-rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ edition = "2021"

[dependencies]
plutus-ledger-api = { version = "0.2.1", features = ["lbf"] }
lbf-plutus-rust-golden-api = { path = ".extras/lbf-plutus-rust-golden-api-0.1.0" }
lbf-plutus-golden-api-rust = { path = ".extras/lbf-plutus-golden-api-rust-0.1.0" }
lbf-plutus-golden-api-days-rust = { path = ".extras/lbf-plutus-golden-api-days-rust-0.1.0" }
lbf-prelude = { path = ".extras/lbf-prelude-0.1.0" }
lbr-prelude = { version = "0.1.1" }
serde_json = "1.0.108"
Expand Down
Loading