Arne Hormann
Arne Hormann

Reputation: 75

Create dependency list from WORKSPACE in Bazel?

I'd like to maintain a list of dependencies and their versions per Bazel project.

How do I query for WORKSPACE rules the BUILD rules depend on? How can I access the contained attributes?

EDIT I'd like to query based on a BUILD rule. So if I have multiple rules, I only want the WORKSPACE info based on the one I asked for.

Upvotes: 0

Views: 698

Answers (1)

Paul
Paul

Reputation: 605

The way I did this was to keep the workspace deps in a separate format, iterate them, and then build a markdown document.

See https://github.com/pubref/rules_protobuf/blob/master/DEPENDENCIES.md

https://github.com/pubref/rules_protobuf/blob/master/protobuf/internal/proto_dependencies.bzl

There's probably a way to do it via a genquery and native.existing_rules, but I have not tried that.

HTH, Paul

Upvotes: 1

Related Questions