Safe Haskell | None |
---|---|
Language | Haskell2010 |
Helper functions to generate proto files as part of a Setup.hs
script.
These functions assume that the proto-lens-protoc
executable is on the
PATH, and throw an exception otherwise. That executable will be installed
automatically as part of installing this package; in particular, it should
be enough to just list `proto-lens-protoc` in a user package's
`build-dependencies`.
See README.md
for instructions on how to use proto-lens with Cabal.
- defaultMainGeneratingProtos :: FilePath -> IO ()
- defaultMainGeneratingSpecificProtos :: FilePath -> (PackageDescription -> IO [FilePath]) -> IO ()
- generatingProtos :: FilePath -> UserHooks -> UserHooks
- generatingSpecificProtos :: FilePath -> (PackageDescription -> IO [FilePath]) -> UserHooks -> UserHooks
- generateProtos :: FilePath -> FilePath -> [FilePath] -> IO ()
Documentation
defaultMainGeneratingProtos Source #
This behaves the same as defaultMain
, but
auto-generates Haskell files from the .proto files listed in
the .cabal
file under extra-source-files
which are located under the
given root directory.
Writes the generated files to the autogen directory (dist/build/autogen
for Cabal, and .stack-work/dist/.../build/autogen
for stack).
Throws an exception if the proto-lens-protoc
executable is not on the PATH.
defaultMainGeneratingSpecificProtos Source #
:: FilePath | The root directory under which .proto files can be found. |
-> (PackageDescription -> IO [FilePath]) | A function to return a list of .proto files. Takes the Cabal package description as input. Non-absolute paths are treated as relative to the provided root directory. |
-> IO () |
This behaves the same as defaultMain
, but
auto-generates Haskell files from the .proto files listed. The given .proto
files should be under the given root directory.
Writes the generated files to the autogen directory (dist/build/autogen
for Cabal, and .stack-work/dist/.../build/autogen
for stack).
Throws an exception if the proto-lens-protoc
executable is not on the PATH.
Augment the given UserHooks
to auto-generate Haskell files from the
.proto files listed in the .cabal
file under extra-source-files
which
are located under the given root directory.
Writes the generated files to the autogen directory (dist/build/autogen
for Cabal, and .stack-work/dist/.../build/autogen
for stack).
Throws an exception if the proto-lens-protoc
executable is not on the PATH.
generatingSpecificProtos Source #
:: FilePath | The root directory under which .proto files can be found. |
-> (PackageDescription -> IO [FilePath]) | A function to return a list of .proto files. Takes the Cabal package description as input. Non-absolute paths are treated as relative to the provided root directory. |
-> UserHooks | |
-> UserHooks |
Augment the given UserHooks
to auto-generate Haskell files from the
.proto files returned by a function getProtos
.
Writes the generated files to the autogen directory (dist/build/autogen
for Cabal, and .stack-work/dist/.../build/autogen
for stack).
Throws an exception if the proto-lens-protoc
executable is not on the PATH.
:: FilePath | The root directory under which .proto files can be found. |
-> FilePath | The output directory for the generated Haskell files. |
-> [FilePath] | The .proto files to process. |
-> IO () |
Run the proto compiler to generate Haskell files from the given .proto files.
Writes the generated files to the autogen directory (dist/build/autogen
for Cabal, and .stack-work/dist/.../build/autogen
for stack).
Throws an exception if the proto-lens-protoc
executable is not on the PATH.