Skip to content

Remove implicit dependency on buildifier #44

@ian-h-chamberlain

Description

@ian-h-chamberlain

Only loading com_apt_itude_rules_pip and calling pip_repository rules, e.g.

load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
load("@com_apt_itude_rules_pip//rules:repository.bzl", "pip_repository")
load("//python:versions.bzl", "PYTHON2", "PYTHON3")

maybe(
    pip_repository,
    name = "pip2",
    python_interpreter = PYTHON2,
    requirements_per_platform = {
        "//thirdparty/pip/2:requirements-linux.txt": "linux",
        "//thirdparty/pip/2:requirements-osx.txt": "osx",
    },
)

maybe(
    pip_repository,
    name = "pip3",
    python_interpreter = PYTHON3,
    requirements_per_platform = {
        "//thirdparty/pip/3:requirements-linux.txt": "linux",
        "//thirdparty/pip/3:requirements-osx.txt": "osx",
    },
)

Results in the following error:

ERROR: Analysis of target '//thirdparty/pip/3:compile' failed; build aborted: error loading package '@com_apt_itude_rules_pip//': Unable to find pa
ckage for @com_github_bazelbuild_buildtools//buildifier:def.bzl: The repository '@com_github_bazelbuild_buildtools' could not be resolved.
INFO: Elapsed time: 0.233s

The problem seems to be caused by https://github.com/apt-itude/rules_pip/blob/master/BUILD where buildifier is being loaded. This should be moved to a private BUILD file instead of being publicly visible in the top level, so that other libraries depending on rules_pip are not required to depend on buildifier (and therefore go toolchains, etc).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions