Rules for defining toolchains
get_cc_toolchain
get_cc_toolchain(name)
Attributes
name
|
Name; required
A unique name for this target. |
get_haskell_toolchain
get_haskell_toolchain(name)
Attributes
name
|
Name; required
A unique name for this target. |
get_nodejs_toolchain
get_nodejs_toolchain(name)
Attributes
name
|
Name; required
A unique name for this target. |
get_posix_toolchain
get_posix_toolchain(name)
Attributes
name
|
Name; required
A unique name for this target. |
get_cc_toolchain_impl
get_cc_toolchain_impl(ctx)
Attributes
ctx
|
required |
get_haskell_toolchain_impl
get_haskell_toolchain_impl(ctx)
Attributes
ctx
|
required |
get_nodejs_toolchain_impl
get_nodejs_toolchain_impl(ctx)
Attributes
ctx
|
required |
get_posix_toolchain_impl
get_posix_toolchain_impl(ctx)
Attributes
ctx
|
required |
haskell_toolchain
haskell_toolchain(name, version, static_runtime, fully_static_link, tools, libraries, asterius_binaries, ghcopts, repl_ghci_args, haddock_flags, cabalopts, locale_archive, kwargs)
Declare a compiler toolchain.
You need at least one of these declared somewhere in your BUILD
files for the other rules to work. Once declared, you then need to register the toolchain using register_toolchains
in your WORKSPACE
file (see example below).
Examples
In a BUILD
file:
haskell_toolchain(
name = "ghc",
version = "1.2.3",
static_runtime = static_runtime,
fully_static_link = fully_static_link,
tools = ["@sys_ghc//:bin"],
ghcopts = ["-Wall"],
)
where @sys_ghc
is an external repository defined in the WORKSPACE
, e.g. using:
nixpkgs_package(
name = 'sys_ghc',
attribute_path = 'haskell.compiler.ghc822',
)
register_toolchains("//:ghc")
Attributes
name
|
required
A unique name for this toolchain. |
version
|
required
Version of your GHC compiler. It has to match the version reported by the GHC used by bazel. |
static_runtime
|
required
Whether GHC was linked with a static runtime. |
fully_static_link
|
required
Whether GHC should build fully-statically-linked binaries. |
tools
|
required
GHC and executables that come with it. First item takes precedence. |
libraries
|
required
The set of libraries that come with GHC. Requires haskell_import targets. |
asterius_binaries
|
optional; default is None
An optional filegroup containing asterius binaries. If present the toolchain will target WebAssembly and only use binaries from |
ghcopts
|
optional; default is []
A collection of flags that will be passed to GHC on every invocation. |
repl_ghci_args
|
optional; default is []
A collection of flags that will be passed to GHCI on repl invocation. It extends the |
haddock_flags
|
optional; default is []
A collection of flags that will be passed to haddock. |
cabalopts
|
optional; default is []
Additional flags to pass to |
locale_archive
|
optional; default is None
Label pointing to the locale archive file to use. |
kwargs
|
optional
Common rule attributes. See Bazel documentation. |
rules_haskell_toolchains
rules_haskell_toolchains(version, compiler_flags, ghcopts, haddock_flags, repl_ghci_args, cabalopts, locale)
Register GHC binary distributions for all platforms as toolchains.
Toolchains can be used to compile Haskell code. This function registers one toolchain for each known binary distribution on all platforms of the given GHC version. During the build, one toolchain will be selected based on the host and target platforms (See toolchain resolution).
Attributes
version
|
optional; default is None
The desired GHC version |
compiler_flags
|
optional; default is None
|
ghcopts
|
optional; default is None
A collection of flags that will be passed to GHC on every invocation. |
haddock_flags
|
optional; default is None
|
repl_ghci_args
|
optional; default is None
|
cabalopts
|
optional; default is None
|
locale
|
optional; default is None
Locale that will be set during compiler invocations. Default: C.UTF-8 (en_US.UTF-8 on MacOS) |