proto-lens-setup-0.4.0.4: Cabal support for codegen with proto-lens.

Data.ProtoLens.Setup

Description

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.

Synopsis

# Documentation

Arguments

 :: FilePath The root directory under which .proto files can be found. -> IO ()

This behaves the same as defaultMain, but auto-generates Haskell files from .proto files which are:

• Listed in the .cabal file under extra-source-files,
• Located under the given root directory, and
• Correspond to a module ("Proto.*") in exposed-modules or other-modules of some component in the .cabal file.

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.

Arguments

 :: FilePath The root directory under which .proto files can be found. -> (LocalBuildInfo -> 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.

Arguments

 :: FilePath The root directory under which .proto files can be found. -> UserHooks -> UserHooks

Augment the given UserHooks to auto-generate Haskell files from the .proto files which are:

• Listed in the .cabal file under extra-source-files,
• Located under the given root directory, and
• Correspond to a module ("Proto.*") in exposed-modules or other-modules of some component in the .cabal file.

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.

Arguments

 :: FilePath The root directory under which .proto files can be found. -> (LocalBuildInfo -> 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.

Arguments

 :: [FilePath] Directories under which .proto files and/or files that they import 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.

Arguments

 :: 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.