|
@@ -4,18 +4,17 @@ import Gidl.Types
|
|
|
import Gidl.Interface
|
|
|
import Gidl.Backend.Cabal
|
|
|
import Gidl.Backend.Ivory.Types
|
|
|
-import Gidl.Backend.Ivory.Test
|
|
|
import Gidl.Backend.Ivory.Interface
|
|
|
|
|
|
import Ivory.Artifact
|
|
|
|
|
|
import Data.Char (isSpace)
|
|
|
+import Text.PrettyPrint.Mainland
|
|
|
|
|
|
ivoryBackend :: TypeEnv -> InterfaceEnv -> String -> String -> [Artifact]
|
|
|
ivoryBackend te@(TypeEnv te') ie@(InterfaceEnv ie') pkgname namespace_raw =
|
|
|
[ cabalFileArtifact cf
|
|
|
, makefile
|
|
|
- , artifactPath "tests" serializeTestMod
|
|
|
] ++
|
|
|
[ artifactPath "src" m | m <- sourceMods
|
|
|
]
|
|
@@ -30,14 +29,9 @@ ivoryBackend te@(TypeEnv te') ie@(InterfaceEnv ie') pkgname namespace_raw =
|
|
|
, let ir = interfaceDescrToRepr iname ie te
|
|
|
]
|
|
|
sourceMods = tmods ++ imods
|
|
|
- cf = (defaultCabalFile pkgname cabalmods deps) { tests = [ serializeTest ] }
|
|
|
+ cf = (defaultCabalFile pkgname cabalmods deps)
|
|
|
cabalmods = [ filePathToPackage (artifactFileName m) | m <- sourceMods ]
|
|
|
- deps = [ "cereal", "QuickCheck" ]
|
|
|
-
|
|
|
- serializeTest = defaultCabalTest "serialize-test" "SerializeTest.hs"
|
|
|
- (pkgname:deps)
|
|
|
- serializeTestMod = serializeTestModule namespace
|
|
|
- [ interfaceDescrToRepr iname ie te | (iname, _i) <- ie']
|
|
|
+ deps = words "ivory ivory-stdlib ivory-serialize"
|
|
|
|
|
|
namespace = dotwords namespace_raw
|
|
|
|
|
@@ -48,3 +42,24 @@ ivoryBackend te@(TypeEnv te') ie@(InterfaceEnv ie') pkgname namespace_raw =
|
|
|
s' -> let (w, s'') = break isDot s' in w : dotwords s''
|
|
|
isDot c = (c == '.') || isSpace c
|
|
|
|
|
|
+makefile :: Artifact
|
|
|
+makefile = artifactText "Makefile" $
|
|
|
+ prettyLazyText 80 $ stack
|
|
|
+ [ text "IVORY_REPO ?= ../../../ivory"
|
|
|
+ , empty
|
|
|
+ , text "default:"
|
|
|
+ , text "\tcabal build"
|
|
|
+ , empty
|
|
|
+ , text "create-sandbox:"
|
|
|
+ , text "\tcabal sandbox init"
|
|
|
+ , text "\tcabal sandbox add-source $(IVORY_REPO)/ivory"
|
|
|
+ , text "\tcabal sandbox add-source $(IVORY_REPO)/ivory-artifact"
|
|
|
+ , text "\tcabal sandbox add-source $(IVORY_REPO)/ivory-serialize"
|
|
|
+ , text "\tcabal sandbox add-source $(IVORY_REPO)/ivory-stdlib"
|
|
|
+ , text "\tcabal install --enable-tests --dependencies-only"
|
|
|
+ , empty
|
|
|
+ , text "test:"
|
|
|
+ , text "\tcabal test"
|
|
|
+ , empty
|
|
|
+ ]
|
|
|
+
|