bazelbuild / bazelbuild/bazel

Allow `load` to be optional

Open
#11,188 5 comments 9 reactions 0 assignees View on GitHub
not stale P4 team-Starlark-Integration type: feature request
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 18h
Merged PRs (30d)
75

Description

### Description of the feature request:

It is sometimes useful to optionally load files if they are present. This can be seen in `.bazelrc`'s `try-import` statement. It would be very helpful if there was a similar `try-load` statement that could also be called (or an `optional` flag to the existing `load` statement.

Places where this might be useful include in macro generation, where a `try-load` could be attempted, and if successful, additional flags could be set on generated targets.

Contributor guide

Open the contributing guide

Research direction

Start by examining the existing `load` behavior and the `.bazelrc` `try-import` statement for relevant semantics. Decide whether the feature should use a `try-load` statement or an optional flag, then identify the associated tests and define completion as allowing absent files without failing while preserving normal loading behavior.

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.