bazelbuild / bazelbuild/bazel-skylib

Add bzl_library support for @bazel_tools

Open
#127 2 comments 0 reactions 0 assignees View on GitHub
P4 type: feature request
Dominant language
Starlark
Stars
444
Forks
202
PR merge metrics
No merged PRs in 30d

Description

(Maybe this belongs in Bazel's component.)

It was mentioned on the Slack that you can't define a bzl_library for your own .bzl files if they load files in @bazel_tools. At the same time, we can't just naively add bzl_library targets for each .bzl in @bazel_tools because it would make Bazel depend on skylib. The user also can't define their own bzl_library targets for the files in @bazel_tools due to visibility / exports_files issues.

As a somewhat clunky workaround, I suggest that we export all .bzl files underneath @bazel_tools with visibility granted to a specific subpackage, e.g. `@bazel_tools//bzl_exports`. That subpackage would load bzl_library from skylib and re-export these as bzl_library targets. This way, users who have skylib can depend on this subpackage, and users who don't have skylib will have no need to import it.

Contributor guide

Open the contributing guide

Research direction

Start by resolving whether this belongs in Bazel or bazel-skylib, then investigate how .bzl files under @bazel_tools can be exported without adding a skylib dependency to Bazel. Evaluate the proposed @bazel_tools//bzl_exports subpackage and its visibility and exports_files behavior. Done means users with skylib can define bzl_library targets for these files while users without skylib remain unaffected.

Written by the indexing model from the issue text.

Assessment

Domain
build-system
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.