Add something like this to your WORKSPACE file:
git_repository(
name = "io_bazel_rules_pex",
remote = "https://github.com/benley/bazel_rules_pex.git",
tag = "0.3.0",
)
load("@io_bazel_rules_pex//pex:pex_rules.bzl", "pex_repositories")
pex_repositories()
In a BUILD file where you want to use these rules, or in your
tools/build_rules/prelude_bazel
file if you want them present repo-wide, add:
load(
"@io_bazel_rules_pex//pex:pex_rules.bzl",
"pex_binary",
"pex_library",
"pex_test",
"pex_pytest",
)
Lastly, make sure that tools/build_rules/BUILD
exists, even if it is empty,
so that Bazel can find your prelude_bazel
file.
A variant of pex_test that uses py.test to run one or more sets of tests.
This produces two things:
<name>_runner
) containing all your code and its<name>_runner
executable with eachsrcs
enumerated as commandline arguments. This is the actualAlmost all of the attributes that can be used with pex_test work identically
here, including those not specifically mentioned in this docstring.
Exceptions are main
and entrypoint
, which cannot be used with this macro.
Rules to be invoked from WORKSPACE for remote dependencies.
Build a deployable pex executable.