bazel_source plugin

bazel - stage bazel external dependencies

This is a Source Transform plugin that allows us to download the external dependencies for a bazel project. Due to the complicated nature of bazel fetching, this requires a manifest file generated by ` bazel cquery --experimental_repository_resolved_file=/path/to/manifest $targets `

This option is available for all versions of bazel documented, but for very early versions (<0.17.1) it may not be available.

If the upstream bazel project does not provide such a repository file, one may be introduced as a local or patch source. Failing that the plugin can be configured to fall back to a bazel on the host. Doing this is not recommended as we lose the ability to check SHAs, and also people using your project will have to have bazel installed. Due to this potential flakiness, using the host bazel will likely cause many warnings.

This plugin works by parsing the repository resolved file and downloading any sources into a “distdir” that can be used in the build by passing the –distdir option to bazel build. This is done automatically by the BazelElement plugin (by default).

The default configuration is:

Usage:

# Specify the bazel kind
kind: bazel_source

# Specify the path to the workspace directory
workspace-dir: .

# Specify the path to the repository resolved file
repo-file: .bst-sources

# Whether to allow falling back to host bazel if no repository resolved
# file is found
allow-host-bazel: False

# If host bazel is allowed as a fall back and no repository resolved
# file is found, specify which targets to track
#
# NOTE: This option only has an effect if host bazel is allowed as a
#       fallback
#
targets: '//...'

# The SHA256 of the repository resolved file. This is not used when
# falling back to host bazel due to non-determinism.
#
ref: abcdef1234567890...

** Configurable Warnings:**

This plugin provides the following configurable warnings:
  • missing-sha256: Fail when sources don’t specify a sha256 attribute