bazel_build plugin
BazelElement - Element plugin for Bazel builds
BuildElement implementation for bazel builds. This plugin should be sufficiently powerful to build any bazel project, provided it is combined with a BazelSource source transform plugin to fetch any external bazel dependencies.
To use this plugin, add a source for your bazel project upstream, as well as a BazelSource plugin. The source requires a “repository resolved” file in the bazel workspace, this can be provided in the upstream project, or via a local or patch source. This resolved file must have been generated for the targets you wish to build, otherwise there may be missing dependencies.
This plugin really just provides a nice way to run bazel, with overwriteable variables you can use to add options. Some sensible looking defaults have been set, which can be overridden using specific variables.
Most importantly, you should specify the target variable with the bazel target you wish to build, e.g. //foo:bar.
Here is the default configuration for the bazel element
# Bazel default configuration
variables:
target: ""
bazel-startup-global: ""
bazel-startup-local: ""
bazel: bazel --output_user_root /bazel-home %{bazel-startup-global} %{bazel-startup-local}
bazel-build-global: ""
bazel-build-local: ""
strip: "sometimes"
compilation-mode: "fastbuild"
distdir: _bst_distdir
bazel-build: >-
%{bazel} build %{target}
--distdir %{distdir}
--verbose_failures
--strip %{strip}
--compilation_mode %{compilation-mode}
%{bazel-build-global}
%{bazel-build-local}
config:
# Commands for configuring the software
#
# We leave these blank, as bazel has no fixed way to
# configure software
#
configure-commands: []
# Commands for building the software
#
build-commands:
- "%{bazel-build}"
# Commands for installing the software into a
# destination folder
#
# We leave these blank as bazel has no fixed way to
# install software
#
install-commands: []
# We shouldn't need strip commands, as bazel should
# strip binaries if told
#
strip-commands: []