Skip to content

repos.bzl refers to repositories before they're defined #42

Open
@CodingCanuck

Description

Stout's repos.bzl refers to other repos' repos.bzl files by using a repository label, e.g. the use of @com_github_3rdparty_stout_atomic_backoff in:

load("@com_github_3rdparty_stout_atomic_backoff//bazel:repos.bzl", stout_atomic_backoff_repos = "repos")

This works because stout's WORKSPACE.bazel file defines these repo labels before they're used, e.g.:

local_repository(
    name = "com_github_3rdparty_stout_atomic_backoff",
    path = "stout-atomic-backoff",
)

But this does not work when using stout in another repo by following the advice on https://github.com/3rdparty/stout#bazel to call stout's repos.bzl from the other repo's repos.bzl: in order for this to work, we need to avoid referring to already-defined repo labels in our repos.bzl file.

Other repositories accomplish this by not referring to repos.bzl files in dependencies' labeled repos, but instead copying those repos.bzl files into a 3rdparty top-level folder e.g. https://github.com/3rdparty/eventuals/blob/main/bazel/repos.bzl#L15-L18 :

load("//3rdparty/bazel-rules-asio:repos.bzl", asio_repos = "repos")
load("//3rdparty/bazel-rules-curl:repos.bzl", curl_repos = "repos")
load("//3rdparty/bazel-rules-jemalloc:repos.bzl", jemalloc_repos = "repos")
load("//3rdparty/bazel-rules-libuv:repos.bzl", libuv_repos = "repos")

I suspect we should follow the same pattern here.

Concretely, I think we should remove all repo references in the style of @repo_name from our repos.bzl file (except @bazel_tools which seem both safe and commonly used across repos) and instead add new subfolders of 3rdparty/ for each repo.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions