Commits

Andy Gocke committed 9006dba

Starting protocol buffers

Comments (0)

Files changed (3)

+import Distribution.Simple
+import Distribution.Simple.Program.Types
+
+main = defaultMainWithHooks simpleUserHooks { hookedPrograms = [hprotoc] }
+
+hprotocProgram :: Program
+hprotocProgram = (simpleProgram "hprotoc") {
+  programFindVersion = findProgramVersion "--version" $ \str ->
+    -- Invoking "hprotoc --version" gives a string like
+    -- "Welcome to protocol-buffers version x ..."
+    case words str of
+         (_:_:_:_:ver:_) -> ver
+         _ -> ""
+}
+  
+
+ppHprotoc :: BuildInfo -> LocalBuildInfo -> PreProcessor
+ppHprotoc _ lbi = PreProcessor {
+  platformIndependent = True,
+
-name:          editor
-version:       0.0
-synopsis:      An editor
-author:        Andy Gocke
-cabal-version: >= 1.10
-build-type:    Simple
+Name:          editor
+Version:       0.0
+Synopsis:      An editor
+Author:        Andy Gocke
+Cabal-version: >= 1.10
+Build-type:    Custom
 
 executable editor-backend
-  build-depends:  base,
+  Build-depends:  base,
                   http-types,
                   QuickCheck,
                   wai,
                   warp
-  main-is:        editor-backend.hs
-  hs-source-dirs: backend
+  Build-tools:    hprotoc
+  Main-Is:        editor-backend.hs
+  Hs-Source-Dirs: backend
 
   Default-Language: Haskell2010

protocols/shell-commands.proto

 }
 
 message CommandResponse {
-  required int32 return_code;
+  required int32 return_code = 1;
 }