proto3-suite => 97c4f66 (#37)

* `proto3-suite` => `9394ade` and regenerate CG artifacts

* `proto3-suite` => `56cf36f`

* `proto3-wire` => `a938330`

* `proto3-suite` => `e8f2acb`

* Update `stack.yaml`

* Update CG artifacts for Echo and Arithmetic examples

* Update `stack.yaml`

* `proto3-suite` => `aff63e6` and add related nix deps

* Update CG artifacts for Echo and Arithmetic examples

* `proto3-suite` => `97c4f66`

* Nitpick: Rename test exe from `test` to `tests`

* Add `.gitattributes` files to mark generated modules
This commit is contained in:
intractable 2017-11-02 15:36:57 -05:00 committed by GitHub
parent 4a30625a70
commit 19125b42be
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 196 additions and 31 deletions

1
examples/echo/echo-hs/.gitattributes vendored Normal file
View file

@ -0,0 +1 @@
Echo.hs linguist-generated

View file

@ -4,22 +4,26 @@
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedStrings #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-} {-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-name-shadowing #-} {-# OPTIONS_GHC -fno-warn-name-shadowing #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
-- | Generated by Haskell protocol buffer compiler. DO NOT EDIT! -- | Generated by Haskell protocol buffer compiler. DO NOT EDIT!
module Echo where module Echo where
import qualified Prelude as Hs import qualified Prelude as Hs
import qualified Proto3.Suite.DotProto as HsProtobuf import qualified Proto3.Suite.DotProto as HsProtobuf
import qualified Proto3.Suite.Types as HsProtobuf import qualified Proto3.Suite.Types as HsProtobuf
import qualified Proto3.Suite.Class as HsProtobuf import qualified Proto3.Suite.Class as HsProtobuf
import qualified Proto3.Suite.JSONPB as HsJSONPB
import Proto3.Suite.JSONPB ((.=), (.:))
import qualified Proto3.Wire as HsProtobuf import qualified Proto3.Wire as HsProtobuf
import Control.Applicative ((<*>), (<|>)) import Control.Applicative ((<*>), (<|>), (<$>))
import qualified Control.Monad as Hs
import qualified Data.Text.Lazy as Hs (Text) import qualified Data.Text.Lazy as Hs (Text)
import qualified Data.ByteString as Hs import qualified Data.ByteString as Hs
import qualified Data.String as Hs (fromString) import qualified Data.String as Hs (fromString)
import qualified Data.Vector as Hs (Vector) import qualified Data.Vector as Hs (Vector)
import qualified Data.Int as Hs (Int16, Int32, Int64) import qualified Data.Int as Hs (Int16, Int32, Int64)
import qualified Data.Word as Hs (Word16, Word32, Word64) import qualified Data.Word as Hs (Word16, Word32, Word64)
import GHC.Generics as Hs import qualified GHC.Generics as Hs
import GHC.Enum as Hs import qualified GHC.Enum as Hs
import Network.GRPC.HighLevel.Generated as HsGRPC import Network.GRPC.HighLevel.Generated as HsGRPC
import Network.GRPC.HighLevel.Client as HsGRPC import Network.GRPC.HighLevel.Client as HsGRPC
import Network.GRPC.HighLevel.Server as HsGRPC hiding (serverLoop) import Network.GRPC.HighLevel.Server as HsGRPC hiding (serverLoop)
@ -28,8 +32,8 @@ import Network.GRPC.HighLevel.Server.Unregistered as HsGRPC
import Network.GRPC.LowLevel.Call as HsGRPC import Network.GRPC.LowLevel.Call as HsGRPC
data Echo request response = Echo{echoDoEcho :: data Echo request response = Echo{echoDoEcho ::
request 'HsGRPC.Normal EchoRequest EchoResponse -> request 'HsGRPC.Normal Echo.EchoRequest Echo.EchoResponse ->
Hs.IO (response 'HsGRPC.Normal EchoResponse)} Hs.IO (response 'HsGRPC.Normal Echo.EchoResponse)}
deriving Hs.Generic deriving Hs.Generic
echoServer :: echoServer ::
@ -83,6 +87,25 @@ instance HsProtobuf.Message EchoRequest where
[] []
Hs.Nothing)] Hs.Nothing)]
instance HsJSONPB.ToJSONPB EchoRequest where
toJSONPB (EchoRequest f1) = (HsJSONPB.object ["message" .= f1])
toEncodingPB (EchoRequest f1) = (HsJSONPB.pairs ["message" .= f1])
instance HsJSONPB.FromJSONPB EchoRequest where
parseJSONPB
= (HsJSONPB.withObject "EchoRequest"
(\ obj -> (Hs.pure EchoRequest) <*> obj .: "message"))
instance HsJSONPB.ToJSON EchoRequest where
toJSON = HsJSONPB.toAesonValue
toEncoding = HsJSONPB.toAesonEncoding
instance HsJSONPB.FromJSON EchoRequest where
parseJSON = HsJSONPB.parseJSONPB
instance HsJSONPB.ToSchema EchoRequest where
declareNamedSchema = HsJSONPB.genericDeclareNamedSchemaJSONPB
data EchoResponse = EchoResponse{echoResponseMessage :: Hs.Text} data EchoResponse = EchoResponse{echoResponseMessage :: Hs.Text}
deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic) deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic)
@ -105,3 +128,22 @@ instance HsProtobuf.Message EchoResponse where
(HsProtobuf.Single "message") (HsProtobuf.Single "message")
[] []
Hs.Nothing)] Hs.Nothing)]
instance HsJSONPB.ToJSONPB EchoResponse where
toJSONPB (EchoResponse f1) = (HsJSONPB.object ["message" .= f1])
toEncodingPB (EchoResponse f1) = (HsJSONPB.pairs ["message" .= f1])
instance HsJSONPB.FromJSONPB EchoResponse where
parseJSONPB
= (HsJSONPB.withObject "EchoResponse"
(\ obj -> (Hs.pure EchoResponse) <*> obj .: "message"))
instance HsJSONPB.ToJSON EchoResponse where
toJSON = HsJSONPB.toAesonValue
toEncoding = HsJSONPB.toAesonEncoding
instance HsJSONPB.FromJSON EchoResponse where
parseJSON = HsJSONPB.parseJSONPB
instance HsJSONPB.ToSchema EchoResponse where
declareNamedSchema = HsJSONPB.genericDeclareNamedSchemaJSONPB

1
examples/tutorial/.gitattributes vendored Normal file
View file

@ -0,0 +1 @@
Arithmetic.hs linguist-generated

View file

@ -4,22 +4,26 @@
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedStrings #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-} {-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-name-shadowing #-} {-# OPTIONS_GHC -fno-warn-name-shadowing #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
-- | Generated by Haskell protocol buffer compiler. DO NOT EDIT! -- | Generated by Haskell protocol buffer compiler. DO NOT EDIT!
module Arithmetic where module Arithmetic where
import qualified Prelude as Hs import qualified Prelude as Hs
import qualified Proto3.Suite.DotProto as HsProtobuf import qualified Proto3.Suite.DotProto as HsProtobuf
import qualified Proto3.Suite.Types as HsProtobuf import qualified Proto3.Suite.Types as HsProtobuf
import qualified Proto3.Suite.Class as HsProtobuf import qualified Proto3.Suite.Class as HsProtobuf
import qualified Proto3.Suite.JSONPB as HsJSONPB
import Proto3.Suite.JSONPB ((.=), (.:))
import qualified Proto3.Wire as HsProtobuf import qualified Proto3.Wire as HsProtobuf
import Control.Applicative ((<*>), (<|>)) import Control.Applicative ((<*>), (<|>), (<$>))
import qualified Control.Monad as Hs
import qualified Data.Text.Lazy as Hs (Text) import qualified Data.Text.Lazy as Hs (Text)
import qualified Data.ByteString as Hs import qualified Data.ByteString as Hs
import qualified Data.String as Hs (fromString) import qualified Data.String as Hs (fromString)
import qualified Data.Vector as Hs (Vector) import qualified Data.Vector as Hs (Vector)
import qualified Data.Int as Hs (Int16, Int32, Int64) import qualified Data.Int as Hs (Int16, Int32, Int64)
import qualified Data.Word as Hs (Word16, Word32, Word64) import qualified Data.Word as Hs (Word16, Word32, Word64)
import GHC.Generics as Hs import qualified GHC.Generics as Hs
import GHC.Enum as Hs import qualified GHC.Enum as Hs
import Network.GRPC.HighLevel.Generated as HsGRPC import Network.GRPC.HighLevel.Generated as HsGRPC
import Network.GRPC.HighLevel.Client as HsGRPC import Network.GRPC.HighLevel.Client as HsGRPC
import Network.GRPC.HighLevel.Server as HsGRPC hiding (serverLoop) import Network.GRPC.HighLevel.Server as HsGRPC hiding (serverLoop)
@ -28,11 +32,17 @@ import Network.GRPC.HighLevel.Server.Unregistered as HsGRPC
import Network.GRPC.LowLevel.Call as HsGRPC import Network.GRPC.LowLevel.Call as HsGRPC
data Arithmetic request response = Arithmetic{arithmeticAdd :: data Arithmetic request response = Arithmetic{arithmeticAdd ::
request 'HsGRPC.Normal TwoInts OneInt -> request 'HsGRPC.Normal Arithmetic.TwoInts
Hs.IO (response 'HsGRPC.Normal OneInt), Arithmetic.OneInt
->
Hs.IO (response 'HsGRPC.Normal Arithmetic.OneInt),
arithmeticRunningSum :: arithmeticRunningSum ::
request 'HsGRPC.ClientStreaming OneInt OneInt -> request 'HsGRPC.ClientStreaming Arithmetic.OneInt
Hs.IO (response 'HsGRPC.ClientStreaming OneInt)} Arithmetic.OneInt
->
Hs.IO
(response 'HsGRPC.ClientStreaming
Arithmetic.OneInt)}
deriving Hs.Generic deriving Hs.Generic
arithmeticServer :: arithmeticServer ::
@ -106,6 +116,26 @@ instance HsProtobuf.Message TwoInts where
[] []
Hs.Nothing)] Hs.Nothing)]
instance HsJSONPB.ToJSONPB TwoInts where
toJSONPB (TwoInts f1 f2) = (HsJSONPB.object ["x" .= f1, "y" .= f2])
toEncodingPB (TwoInts f1 f2)
= (HsJSONPB.pairs ["x" .= f1, "y" .= f2])
instance HsJSONPB.FromJSONPB TwoInts where
parseJSONPB
= (HsJSONPB.withObject "TwoInts"
(\ obj -> (Hs.pure TwoInts) <*> obj .: "x" <*> obj .: "y"))
instance HsJSONPB.ToJSON TwoInts where
toJSON = HsJSONPB.toAesonValue
toEncoding = HsJSONPB.toAesonEncoding
instance HsJSONPB.FromJSON TwoInts where
parseJSON = HsJSONPB.parseJSONPB
instance HsJSONPB.ToSchema TwoInts where
declareNamedSchema = HsJSONPB.genericDeclareNamedSchemaJSONPB
data OneInt = OneInt{oneIntResult :: Hs.Int32} data OneInt = OneInt{oneIntResult :: Hs.Int32}
deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic) deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic)
@ -127,3 +157,22 @@ instance HsProtobuf.Message OneInt where
(HsProtobuf.Single "result") (HsProtobuf.Single "result")
[] []
Hs.Nothing)] Hs.Nothing)]
instance HsJSONPB.ToJSONPB OneInt where
toJSONPB (OneInt f1) = (HsJSONPB.object ["result" .= f1])
toEncodingPB (OneInt f1) = (HsJSONPB.pairs ["result" .= f1])
instance HsJSONPB.FromJSONPB OneInt where
parseJSONPB
= (HsJSONPB.withObject "OneInt"
(\ obj -> (Hs.pure OneInt) <*> obj .: "result"))
instance HsJSONPB.ToJSON OneInt where
toJSON = HsJSONPB.toAesonValue
toEncoding = HsJSONPB.toAesonEncoding
instance HsJSONPB.FromJSON OneInt where
parseJSON = HsJSONPB.parseJSONPB
instance HsJSONPB.ToSchema OneInt where
declareNamedSchema = HsJSONPB.genericDeclareNamedSchemaJSONPB

View file

@ -221,7 +221,7 @@ executable echo-client
hs-source-dirs: examples/echo/echo-hs hs-source-dirs: examples/echo/echo-hs
main-is: EchoClient.hs main-is: EchoClient.hs
test-suite test test-suite tests
build-depends: build-depends:
base >=4.8 && <5.0 base >=4.8 && <5.0
, grpc-haskell , grpc-haskell

10
nix/cabal-doctest.nix Normal file
View file

@ -0,0 +1,10 @@
{ mkDerivation, base, Cabal, directory, filepath, stdenv }:
mkDerivation {
pname = "cabal-doctest";
version = "1.0.2";
sha256 = "0h3wsjf2mg8kw1zvxc0f9nzchj5kzvza9z0arcyixkd9rkgqq6sa";
libraryHaskellDepends = [ base Cabal directory filepath ];
homepage = "https://github.com/phadej/cabal-doctest";
description = "A Setup.hs helper for doctests running";
license = stdenv.lib.licenses.bsd3;
}

View file

@ -0,0 +1,23 @@
{ mkDerivation, aeson, base, base-compat, hashable, lens
, QuickCheck, semigroupoids, semigroups, stdenv, tasty
, tasty-quickcheck, text, transformers, unordered-containers
}:
mkDerivation {
pname = "insert-ordered-containers";
version = "0.2.1.0";
sha256 = "1612f455dw37da9g7bsd1s5kyi84mnr1ifnjw69892amyimi47fp";
revision = "3";
editedCabalFile = "6fdce987672b006226243aa17522b57ec7a9e1cab247802eddbdaa9dc5b06446";
libraryHaskellDepends = [
aeson base base-compat hashable lens semigroupoids semigroups text
transformers unordered-containers
];
testHaskellDepends = [
aeson base base-compat hashable lens QuickCheck semigroupoids
semigroups tasty tasty-quickcheck text transformers
unordered-containers
];
homepage = "https://github.com/phadej/insert-ordered-containers#readme";
description = "Associative containers retating insertion order for traversals";
license = stdenv.lib.licenses.bsd3;
}

View file

@ -1,25 +1,27 @@
{ mkDerivation, aeson, attoparsec, base, base64-bytestring { mkDerivation, aeson, aeson-pretty, attoparsec, base
, bytestring, cereal, containers, deepseq, doctest, fetchgit, foldl , base64-bytestring, bytestring, cereal, containers, deepseq
, haskell-src, lens, mtl, neat-interpolation, optparse-generic , doctest, fetchgit, foldl, haskell-src, lens, mtl
, parsec, parsers, pretty, pretty-show, proto3-wire, QuickCheck , neat-interpolation, optparse-generic, parsec, parsers, pretty
, range-set-list, safe, semigroups, stdenv, system-filepath, tasty , pretty-show, proto3-wire, QuickCheck, range-set-list, safe
, tasty-hunit, tasty-quickcheck, text, transformers, turtle, vector , semigroups, stdenv, swagger2, system-filepath, tasty, tasty-hunit
, tasty-quickcheck, text, transformers, turtle, vector
}: }:
mkDerivation { mkDerivation {
pname = "proto3-suite"; pname = "proto3-suite";
version = "0.1.0.0"; version = "0.1.0.0";
src = fetchgit { src = fetchgit {
url = "https://github.com/awakesecurity/proto3-suite.git"; url = "https://github.com/awakenetworks/proto3-suite";
sha256 = "0fa5jdzzs45p54fxc8prpbrc1ckpa86lsp3lkjdzf5rbhlvpvim3"; sha256 = "076fh739580vp9h23d4zw3mddmd0md39c7k4x8macwy502wgdf1j";
rev = "281a533df6b1d1cfa369729f2a149374958e78c2"; rev = "97c4f66c8972416cca8b0bd1d9b307863bbc82e2";
}; };
isLibrary = true; isLibrary = true;
isExecutable = true; isExecutable = true;
libraryHaskellDepends = [ libraryHaskellDepends = [
aeson attoparsec base base64-bytestring bytestring cereal aeson aeson-pretty attoparsec base base64-bytestring bytestring
containers deepseq foldl haskell-src lens mtl neat-interpolation cereal containers deepseq foldl haskell-src lens mtl
parsec parsers pretty pretty-show proto3-wire QuickCheck safe neat-interpolation parsec parsers pretty pretty-show proto3-wire
semigroups system-filepath text transformers turtle vector QuickCheck safe semigroups swagger2 system-filepath text
transformers turtle vector
]; ];
executableHaskellDepends = [ executableHaskellDepends = [
base containers optparse-generic proto3-wire range-set-list base containers optparse-generic proto3-wire range-set-list

View file

@ -6,9 +6,9 @@ mkDerivation {
pname = "proto3-wire"; pname = "proto3-wire";
version = "1.0.0"; version = "1.0.0";
src = fetchgit { src = fetchgit {
url = "https://github.com/awakesecurity/proto3-wire"; url = "https://github.com/awakenetworks/proto3-wire.git";
sha256 = "0pcacsz33n84rkc6yi99yq2dy4fisrhqpfbkqa3nfsjqhlw43gcf"; sha256 = "14n0d16an782ayipirm5v2mvp58jgf65xvffqzp08p50sksil3gi";
rev = "077b7e329fd7f43b0628c23b83c5e2e05334002e"; rev = "a938330bf794cf3fa05591d03906915df98d157c";
}; };
libraryHaskellDepends = [ libraryHaskellDepends = [
base bytestring cereal containers deepseq hashable QuickCheck safe base bytestring cereal containers deepseq hashable QuickCheck safe

27
nix/swagger2.nix Normal file
View file

@ -0,0 +1,27 @@
{ mkDerivation, aeson, aeson-qq, base, base-compat, bytestring
, Cabal, cabal-doctest, containers, doctest, generics-sop, Glob
, hashable, hspec, http-media, HUnit, insert-ordered-containers
, lens, mtl, network, QuickCheck, scientific, stdenv
, template-haskell, text, time, transformers, transformers-compat
, unordered-containers, uuid-types, vector
}:
mkDerivation {
pname = "swagger2";
version = "2.1.6";
sha256 = "01a29h56vfyw0ilij1pn6qwy50ca90kyj884vs1q52vvh572758j";
setupHaskellDepends = [ base Cabal cabal-doctest ];
libraryHaskellDepends = [
aeson base base-compat bytestring containers generics-sop hashable
http-media insert-ordered-containers lens mtl network scientific
template-haskell text time transformers transformers-compat
unordered-containers uuid-types vector
];
testHaskellDepends = [
aeson aeson-qq base base-compat bytestring containers doctest Glob
hashable hspec HUnit insert-ordered-containers lens mtl QuickCheck
text time unordered-containers vector
];
homepage = "https://github.com/GetShopTV/swagger2";
description = "Swagger 2.0 data model";
license = stdenv.lib.licenses.bsd3;
}

View file

@ -179,6 +179,12 @@ let
pkgs.haskell.lib.dontCheck pkgs.haskell.lib.dontCheck
(haskellPackagesNew.callPackage ./nix/aeson.nix {}); (haskellPackagesNew.callPackage ./nix/aeson.nix {});
cabal-doctest =
haskellPackagesNew.callPackage ./nix/cabal-doctest.nix { };
insert-ordered-containers =
haskellPackagesNew.callPackage ./nix/insert-ordered-containers.nix { };
optparse-applicative = optparse-applicative =
haskellPackagesNew.callPackage ./nix/optparse-applicative.nix { }; haskellPackagesNew.callPackage ./nix/optparse-applicative.nix { };
@ -270,6 +276,9 @@ let
''; '';
}); });
swagger2 =
pkgs.haskell.lib.dontHaddock (haskellPackagesNew.callPackage ./nix/swagger2.nix { });
turtle = turtle =
haskellPackagesNew.callPackage ./nix/turtle.nix { }; haskellPackagesNew.callPackage ./nix/turtle.nix { };

View file

@ -9,15 +9,16 @@ packages:
- '.' - '.'
- location: - location:
git: git@github.com:awakenetworks/proto3-suite.git git: git@github.com:awakenetworks/proto3-suite.git
commit: 281a533df6b1d1cfa369729f2a149374958e78c2 commit: 97c4f66c8972416cca8b0bd1d9b307863bbc82e2
extra-dep: true extra-dep: true
- location: - location:
git: git@github.com:awakenetworks/proto3-wire.git git: git@github.com:awakenetworks/proto3-wire.git
commit: 077b7e329fd7f43b0628c23b83c5e2e05334002e commit: a938330bf794cf3fa05591d03906915df98d157c
extra-dep: true extra-dep: true
# Packages to be pulled from upstream that are not in the resolver (e.g., acme-missiles-0.3) # Packages to be pulled from upstream that are not in the resolver (e.g., acme-missiles-0.3)
extra-deps: [ aeson-1.1.1.0 extra-deps: [ aeson-1.1.1.0
, managed-1.0.5 , managed-1.0.5
, swagger2-2.1.6
] ]
# Override default flag values for local packages and extra-deps # Override default flag values for local packages and extra-deps