Skip to content

Enable BAZEL_TRACK_SOURCE_DIRECTORIES by default #25834

@pauldraper

Description

@pauldraper

Description of the feature request:

The roll out of BAZEL_TRACK_SOURCE_DIRECTORIES has been taking a while (7+ years).

Any reason it shouldn't be enabled by default?

Which category does this issue belong to?

Core

What underlying problem are you trying to solve with this feature?

One particular example: npm external dependencies.

Starlark globbing every file, Bazel creating runfile symlinks for every file, etc. can be quite expensive (many tens, or even hundreds of thousands of files). Instead, I use one directory for the entire external dependencies. (Even though it's external, it's still a "source" directory.)

Have you found anything relevant by searching the web?

There is no fundamental reason why source artifacts cannot be tree artifacts or unresolved symlink artifacts, it's just that we haven't implemented it yet (we should, though -- referencing a source directory in a BUILD file is one of the few known long-standing incorrectness issues with Bazel; we have an implementation that kind of works which is enabled by the BAZEL_TRACK_SOURCE_DIRECTORIES=1 JVM property)

https://bazel.build/versions/8.1.0/contribute/codebase

But no indication what lacks about this option.

Any other information, logs, or outputs that you want to share?

/**
* A flag to enable / disable tracking of source directories. Uses a system property which can be
* set via a startup flag. The intention is for this code to be temporary, so I didn't want to add
* a permanent flag to startup options (and there's already --host_jvm_args, which we can use to
* roll this out). The flag affects Skyframe dependencies, so it needs to clear the Skyframe graph -
* the easiest way to do that is to restart the server, which is done when --host_jvm_args changes.
*/

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions