Ver código fonte

RPC backend: use haskell-rpc command line flag, fix cabal file output

Pat Hickey 9 anos atrás
pai
commit
f501519666
2 arquivos alterados com 9 adições e 9 exclusões
  1. 7 7
      src/Gidl.hs
  2. 2 2
      src/Gidl/Backend/Rpc.hs

+ 7 - 7
src/Gidl.hs

@@ -67,13 +67,13 @@ initialOpts = Opts
 
 setBackend :: String -> OptParser Opts
 setBackend b = case map toUpper b of
-  "HASKELL" -> success (\o -> o { backend = HaskellBackend })
-  "IVORY"   -> success (\o -> o { backend = IvoryBackend })
-  "TOWER"   -> success (\o -> o { backend = TowerBackend })
-  "RPC"     -> success (\o -> o { backend = RpcBackend })
-  _         -> invalid ("\"" ++ b ++ "\" is not a valid backend.\n"
-                          ++ "Supported backends: haskell, ivory, tower")
-
+  "HASKELL"     -> success (\o -> o { backend = HaskellBackend })
+  "IVORY"       -> success (\o -> o { backend = IvoryBackend })
+  "TOWER"       -> success (\o -> o { backend = TowerBackend })
+  "HASKELL-RPC" -> success (\o -> o { backend = RpcBackend })
+  _             -> invalid e
+  where e = "\"" ++ b ++ "\" is not a valid backend.\n"
+          ++ "Supported backends: haskell, ivory, tower, haskell-rpc"
 setIdlPath :: String -> OptParser Opts
 setIdlPath p = success (\o -> o { idlpath = p })
 

+ 2 - 2
src/Gidl/Backend/Rpc.hs

@@ -35,7 +35,7 @@ rpcBackend :: TypeEnv -> InterfaceEnv -> String -> String -> [Artifact]
 rpcBackend (TypeEnv te) (InterfaceEnv ie) pkgName nsStr =
     cabalFileArtifact (defaultCabalFile pkgName modules buildDeps)
   : artifactCabalFile P.getDataDir "support/rpc/Makefile"
-  : map (artifactPath "src") (rpcBaseModule namespace : sourceMods)
+  : map (artifactPath "src") sourceMods
 
   where
 
@@ -46,7 +46,7 @@ rpcBackend (TypeEnv te) (InterfaceEnv ie) pkgName nsStr =
 
   modules    = [ filePathToPackage (artifactFileName m) | m <- sourceMods ]
 
-  sourceMods = tmods ++ imods
+  sourceMods = tmods ++ imods ++ [rpcBaseModule namespace]
 
   tmods      = [ typeModule True (namespace ++ ["Types"]) t
                | (_tn, t) <- te