bazelbuild / bazelbuild/bazel-skylib

Feature Request: directory should support TreeArtifacts

Open
#566 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Starlark
Stars
444
Forks
202
PR merge metrics
No merged PRs in 30d

Description

The new directory and subdirectory rules seem to only accept regular files. While this works well for sysroots (only usage of these new rules i can find) that are extracted during loading phase, it does not work if the sysroot archives kept intact as an archive and only extracted during execution phase when actually needed.

I am proposing that we add support for sources that are `ctx.actions.declare_directory` and support globbing over them. This is probably not possible due to how TreeArtifacts works so i am not sure how this can be implemented without the help of Bazel core.

bazel-lib has a similar rule https://github.com/bazel-contrib/bazel-lib/blob/main/docs/directory_path.md it only supports "plucking" a file nested within treeartifacts but it only works if the consumer rule checks the DirectoryPathInfo (which i believe similar to what directory rule does)

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the directory and subdirectory rules and how they handle sources declared with ctx.actions.declare_directory. Compare the requested behavior with bazel-lib's directory_path.md and investigate Bazel's TreeArtifact limitations. Done means defining a feasible approach for accepting TreeArtifacts and globbing their contents, including whether Bazel core changes are required.

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
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.